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
9338220c
Commit
9338220c
authored
Mar 19, 2013
by
Steve Müller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix platform create constraint foreign table name quotation
parent
45bdac96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+2
-1
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+6
-3
No files found.
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
9338220c
...
...
@@ -1362,7 +1362,8 @@ abstract class AbstractPlatform
$foreignColumns
[]
=
$column
;
}
$referencesClause
=
' REFERENCES '
.
$constraint
->
getForeignTableName
()
.
' ('
.
implode
(
', '
,
$foreignColumns
)
.
')'
;
$referencesClause
=
' REFERENCES '
.
$constraint
->
getQuotedForeignTableName
(
$this
)
.
' ('
.
implode
(
', '
,
$foreignColumns
)
.
')'
;
}
$query
.=
' '
.
$columnList
.
$referencesClause
;
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
9338220c
...
...
@@ -4,6 +4,7 @@ namespace Doctrine\Tests\DBAL\Platforms;
use
Doctrine\Common\EventManager
;
use
Doctrine\DBAL\Events
;
use
Doctrine\DBAL\Schema\ForeignKeyConstraint
;
use
Doctrine\DBAL\Schema\Table
;
use
Doctrine\DBAL\Schema\TableDiff
;
...
...
@@ -153,7 +154,7 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$fk
=
new
\Doctrine\DBAL\Schema\ForeignKeyConstraint
(
array
(
'fk_name'
),
'foreign'
,
array
(
'id'
),
'constraint_fk'
);
$sql
=
$this
->
_platform
->
getCreateConstraintSQL
(
$fk
,
'test'
);
$this
->
assertEquals
(
$this
->
getGenerateConstraintForeignKeySql
(),
$sql
);
$this
->
assertEquals
(
$this
->
getGenerateConstraintForeignKeySql
(
$fk
),
$sql
);
}
public
function
testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys
()
...
...
@@ -209,9 +210,11 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
return
'ALTER TABLE test ADD CONSTRAINT constraint_name PRIMARY KEY (test)'
;
}
public
function
getGenerateConstraintForeignKeySql
()
public
function
getGenerateConstraintForeignKeySql
(
\Doctrine\DBAL\Schema\ForeignKeyConstraint
$fk
)
{
return
'ALTER TABLE test ADD CONSTRAINT constraint_fk FOREIGN KEY (fk_name) REFERENCES foreign (id)'
;
$quotedForeignTable
=
$fk
->
getQuotedForeignTableName
(
$this
->
_platform
);
return
"ALTER TABLE test ADD CONSTRAINT constraint_fk FOREIGN KEY (fk_name) REFERENCES
$quotedForeignTable
(id)"
;
}
abstract
public
function
getGenerateAlterTableSql
();
...
...
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