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
904d6759
Unverified
Commit
904d6759
authored
Apr 15, 2019
by
Michael Moravec
Committed by
Sergei Morozov
Jun 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated Table::addUnnamedForeignKeyConstraint() and Table::addNamedForeignKeyConstraint()
parent
3d5847a0
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
48 deletions
+10
-48
UPGRADE.md
UPGRADE.md
+1
-0
Table.php
src/Schema/Table.php
+4
-43
PostgreSqlSchemaManagerTest.php
tests/Functional/Schema/PostgreSqlSchemaManagerTest.php
+1
-1
AbstractPostgreSQLPlatformTestCase.php
tests/Platforms/AbstractPostgreSQLPlatformTestCase.php
+1
-1
ComparatorTest.php
tests/Schema/ComparatorTest.php
+2
-2
MySQLSchemaTest.php
tests/Schema/Platforms/MySQLSchemaTest.php
+1
-1
No files found.
UPGRADE.md
View file @
904d6759
...
...
@@ -8,6 +8,7 @@
*
Removed
`MysqlSessionInit`
listener.
*
Removed
`MysqlPlatform::getCollationFieldDeclaration()`
.
*
Removed
`AbstractPlatform::getIdentityColumnNullInsertSQL()`
.
*
Removed
`Table::addUnnamedForeignKeyConstraint()`
and
`Table::addNamedForeignKeyConstraint()`
.
## BC BREAK changes the `Driver::connect()` signature
...
...
src/Schema/Table.php
View file @
904d6759
...
...
@@ -361,55 +361,16 @@ class Table extends AbstractAsset
* @param string[] $localColumnNames
* @param string[] $foreignColumnNames
* @param mixed[] $options
* @param string|null $
constraintN
ame
* @param string|null $
n
ame
*
* @return self
*/
public
function
addForeignKeyConstraint
(
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
[],
$
constraintN
ame
=
null
)
public
function
addForeignKeyConstraint
(
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
[],
$
n
ame
=
null
)
{
if
(
$
constraintN
ame
===
null
)
{
$
constraintN
ame
=
$this
->
_generateIdentifierName
(
array_merge
((
array
)
$this
->
getName
(),
$localColumnNames
),
'fk'
,
$this
->
_getMaxIdentifierLength
());
if
(
$
n
ame
===
null
)
{
$
n
ame
=
$this
->
_generateIdentifierName
(
array_merge
((
array
)
$this
->
getName
(),
$localColumnNames
),
'fk'
,
$this
->
_getMaxIdentifierLength
());
}
return
$this
->
addNamedForeignKeyConstraint
(
$constraintName
,
$foreignTable
,
$localColumnNames
,
$foreignColumnNames
,
$options
);
}
/**
* Adds a foreign key constraint.
*
* Name is to be generated by the database itself.
*
* @deprecated Use {@link addForeignKeyConstraint}
*
* @param Table|string $foreignTable Table schema instance or table name
* @param string[] $localColumnNames
* @param string[] $foreignColumnNames
* @param mixed[] $options
*
* @return self
*/
public
function
addUnnamedForeignKeyConstraint
(
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
[])
{
return
$this
->
addForeignKeyConstraint
(
$foreignTable
,
$localColumnNames
,
$foreignColumnNames
,
$options
);
}
/**
* Adds a foreign key constraint with a given name.
*
* @deprecated Use {@link addForeignKeyConstraint}
*
* @param string $name
* @param Table|string $foreignTable Table schema instance or table name
* @param string[] $localColumnNames
* @param string[] $foreignColumnNames
* @param mixed[] $options
*
* @return self
*
* @throws SchemaException
*/
public
function
addNamedForeignKeyConstraint
(
$name
,
$foreignTable
,
array
$localColumnNames
,
array
$foreignColumnNames
,
array
$options
=
[])
{
if
(
$foreignTable
instanceof
Table
)
{
foreach
(
$foreignColumnNames
as
$columnName
)
{
if
(
!
$foreignTable
->
hasColumn
(
$columnName
))
{
...
...
tests/Functional/Schema/PostgreSqlSchemaManagerTest.php
View file @
904d6759
...
...
@@ -164,7 +164,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$column
=
$nestedSchemaTable
->
addColumn
(
'id'
,
'integer'
);
$column
->
setAutoincrement
(
true
);
$nestedSchemaTable
->
setPrimaryKey
([
'id'
]);
$nestedSchemaTable
->
add
Unnamed
ForeignKeyConstraint
(
$nestedRelatedTable
,
[
'id'
],
[
'id'
]);
$nestedSchemaTable
->
addForeignKeyConstraint
(
$nestedRelatedTable
,
[
'id'
],
[
'id'
]);
$this
->
schemaManager
->
createTable
(
$nestedRelatedTable
);
$this
->
schemaManager
->
createTable
(
$nestedSchemaTable
);
...
...
tests/Platforms/AbstractPostgreSQLPlatformTestCase.php
View file @
904d6759
...
...
@@ -589,7 +589,7 @@ abstract class AbstractPostgreSQLPlatformTestCase extends AbstractPlatformTestCa
$oldTable
=
clone
$newTable
;
$oldTable
->
addColumn
(
'parent_id'
,
'integer'
);
$oldTable
->
add
Unnamed
ForeignKeyConstraint
(
'mytable'
,
[
'parent_id'
],
[
'id'
]);
$oldTable
->
addForeignKeyConstraint
(
'mytable'
,
[
'parent_id'
],
[
'id'
]);
$comparator
=
new
Comparator
();
$tableDiff
=
$comparator
->
diffTable
(
$oldTable
,
$newTable
);
...
...
tests/Schema/ComparatorTest.php
View file @
904d6759
...
...
@@ -680,11 +680,11 @@ class ComparatorTest extends TestCase
{
$tableA
=
new
Table
(
'foo'
);
$tableA
->
addColumn
(
'id'
,
'integer'
);
$tableA
->
add
NamedForeignKeyConstraint
(
'foo_constraint'
,
'bar'
,
[
'id'
],
[
'id'
]
);
$tableA
->
add
ForeignKeyConstraint
(
'bar'
,
[
'id'
],
[
'id'
],
[],
'foo_constraint'
);
$tableB
=
new
Table
(
'foo'
);
$tableB
->
addColumn
(
'ID'
,
'integer'
);
$tableB
->
add
NamedForeignKeyConstraint
(
'bar_constraint'
,
'bar'
,
[
'id'
],
[
'id'
]
);
$tableB
->
add
ForeignKeyConstraint
(
'bar'
,
[
'id'
],
[
'id'
],
[],
'bar_constraint'
);
$c
=
new
Comparator
();
$tableDiff
=
$c
->
diffTable
(
$tableA
,
$tableB
);
...
...
tests/Schema/Platforms/MySQLSchemaTest.php
View file @
904d6759
...
...
@@ -51,7 +51,7 @@ class MySQLSchemaTest extends TestCase
{
$tableOld
=
new
Table
(
'test'
);
$tableOld
->
addColumn
(
'foo_id'
,
'integer'
);
$tableOld
->
add
Unnamed
ForeignKeyConstraint
(
'test_foreign'
,
[
'foo_id'
],
[
'foo_id'
]);
$tableOld
->
addForeignKeyConstraint
(
'test_foreign'
,
[
'foo_id'
],
[
'foo_id'
]);
$sqls
=
[];
foreach
(
$tableOld
->
getForeignKeys
()
as
$fk
)
{
...
...
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