Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
69c8531d
Commit
69c8531d
authored
Jun 12, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test files for the foreign key support
parent
445d1f9c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
96 additions
and
0 deletions
+96
-0
PgsqlTestCase.php
tests/Export/PgsqlTestCase.php
+7
-0
FooRecord.php
tests/Export/_files/FooRecord.php
+89
-0
No files found.
tests/Export/PgsqlTestCase.php
View file @
69c8531d
...
...
@@ -77,5 +77,12 @@ class Doctrine_Export_Pgsql_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (name CHAR(10), type INT, PRIMARY KEY(name, type))'
);
}
public
function
testExportSql
()
{
$sql
=
$this
->
export
->
exportSql
(
dirname
(
__FILE__
)
.
DIRECTORY_SEPARATOR
.
'_files'
);
print
"<pre>"
;
print_r
(
$sql
);
}
}
?>
tests/Export/_files/FooRecord.php
0 → 100644
View file @
69c8531d
<?php
class
FooRecord
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'foo'
);
$this
->
hasColumn
(
'name'
,
'string'
,
200
,
array
(
'notnull'
=>
true
));
$this
->
hasColumn
(
'parent_id'
,
'integer'
);
$this
->
hasColumn
(
'local_foo'
,
'integer'
);
}
public
function
setUp
()
{
$this
->
hasMany
(
'FooRecord as FooFriend'
,
array
(
'local'
=>
'foo1'
,
'foreign'
=>
'foo2'
,
'equal'
=>
true
,
'refClass'
=>
'FooReferenceRecord'
,
));
$this
->
hasMany
(
'FooRecord as FooParents'
,
array
(
'local'
=>
'foo1'
,
'foreign'
=>
'foo2'
,
'refClass'
=>
'FooReferenceRecord'
,
'onDelete'
=>
'CASCADE'
,
));
$this
->
hasMany
(
'FooRecord as FooChildren'
,
array
(
'local'
=>
'foo2'
,
'foreign'
=>
'foo1'
,
'refClass'
=>
'FooReferenceRecord'
,
));
$this
->
hasMany
(
'FooRecord as Children'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'parent_id'
));
$this
->
hasOne
(
'FooRecord as Parent'
,
array
(
'local'
=>
'parent_id'
,
'foreign'
=>
'id'
,
'onDelete'
=>
'CASCADE'
));
$this
->
hasOne
(
'FooForeignlyOwnedWithPk'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'id'
,
'constraint'
=>
true
));
$this
->
hasOne
(
'FooLocallyOwned'
,
array
(
'local'
=>
'local_foo'
,
'onDelete'
=>
'RESTRICT'
));
}
}
class
FooBarRecord
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'fooId'
,
'integer'
,
null
,
array
(
'primary'
=>
true
));
$this
->
hasColumn
(
'barId'
,
'integer'
,
null
,
array
(
'primary'
=>
true
));
}
}
class
BarRecord
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
}
}
class
FooLocallyOwned
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
}
}
class
FooForeignlyOwned
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
$this
->
hasColumn
(
'fooId'
,
'integer'
);
}
}
class
FooForeignlyOwnedWithPk
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
200
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'FooRecord'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'id'
));
}
}
class
FooReferenceRecord
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
setTableName
(
'foo_reference'
);
$this
->
hasColumn
(
'foo1'
,
'integer'
,
null
,
array
(
'primary'
=>
true
));
$this
->
hasColumn
(
'foo2'
,
'integer'
,
null
,
array
(
'primary'
=>
true
));
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment