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
4fb5f7c2
Commit
4fb5f7c2
authored
Oct 16, 2007
by
romanb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added createForeignKey() support to export module and migrations
parent
abde67f7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
3 deletions
+37
-3
Export.php
lib/Doctrine/Export.php
+12
-1
Migration.php
lib/Doctrine/Migration.php
+17
-2
Process.php
lib/Doctrine/Migration/Process.php
+8
-0
No files found.
lib/Doctrine/Export.php
View file @
4fb5f7c2
...
...
@@ -458,6 +458,17 @@ class Doctrine_Export extends Doctrine_Connection_Module
return
$query
;
}
/**
* createForeignKey
*
* @param string $table name of the table on which the foreign key is to be created
* @param array $definition associative array that defines properties of the foreign key to be created.
* @return string
*/
public
function
createForeignKey
(
$table
,
array
$definition
)
{
return
$this
->
conn
->
execute
(
$this
->
createForeignKeySql
(
$table
,
$definition
));
}
/**
* alter an existing table
* (this method is implemented by the drivers)
...
...
lib/Doctrine/Migration.php
View file @
4fb5f7c2
...
...
@@ -43,7 +43,8 @@ class Doctrine_Migration
'added_indexes'
=>
array
(),
'removed_indexes'
=>
array
(),
'created_constraints'
=>
array
(),
'dropped_constraints'
=>
array
()),
'dropped_constraints'
=>
array
(),
'created_fks'
=>
array
()),
$migrationTableName
=
'migration_version'
,
$migrationClassesDirectory
=
array
(),
$migrationClasses
=
array
();
...
...
@@ -411,7 +412,7 @@ class Doctrine_Migration
}
/**
*
create
Constraint
*
drop
Constraint
*
* @param string $tableName
* @param string $constraintName
...
...
@@ -424,6 +425,20 @@ class Doctrine_Migration
$this
->
addChange
(
'dropped_constraints'
,
$options
);
}
/**
* createForeignKey
*
* @param string $tableName
* @param string $constraintName
* @return void
*/
public
function
createForeignKey
(
$tableName
,
array
$definition
)
{
$options
=
get_defined_vars
();
$this
->
addChange
(
'created_fks'
,
$options
);
}
/**
* addColumn
*
...
...
lib/Doctrine/Migration/Process.php
View file @
4fb5f7c2
...
...
@@ -142,4 +142,12 @@ class Doctrine_Migration_Process
$constraint
[
'primary'
]);
}
}
public
function
processCreatedFks
(
$foreignKeys
)
{
foreach
(
$foreignKeys
as
$fk
)
{
$conn
=
$this
->
getConnection
(
$fk
[
'tableName'
]);
$conn
->
export
->
createForeignKey
(
$fk
[
'tableName'
],
$fk
[
'definition'
]);
}
}
}
\ No newline at end of file
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