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
e65517e0
Commit
e65517e0
authored
Jan 07, 2013
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #242 from Ocramius/hotfix/DBAL-370
Restore SqlitePlatform#supportsForeignKeyConstraints (no lies!)
parents
31bd1538
35305949
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
7 deletions
+32
-7
SqlitePlatform.php
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
+8
-0
SchemaManagerFunctionalTestCase.php
...BAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
+8
-6
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+16
-1
No files found.
lib/Doctrine/DBAL/Platforms/SqlitePlatform.php
View file @
e65517e0
...
...
@@ -602,6 +602,14 @@ class SqlitePlatform extends AbstractPlatform
return
true
;
}
/**
* {@inheritDoc}
*/
public
function
supportsForeignKeyConstraints
()
{
return
false
;
}
/**
* {@inheritDoc}
*/
...
...
tests/Doctrine/Tests/DBAL/Functional/Schema/SchemaManagerFunctionalTestCase.php
View file @
e65517e0
...
...
@@ -433,12 +433,14 @@ class SchemaManagerFunctionalTestCase extends \Doctrine\Tests\DbalFunctionalTest
// dont check for index size here, some platforms automatically add indexes for foreign keys.
$this
->
assertFalse
(
$table
->
hasIndex
(
'foo_idx'
));
$this
->
assertEquals
(
1
,
count
(
$table
->
getForeignKeys
()));
$fks
=
$table
->
getForeignKeys
();
$foreignKey
=
current
(
$fks
);
$this
->
assertEquals
(
'alter_table_foreign'
,
strtolower
(
$foreignKey
->
getForeignTableName
()));
$this
->
assertEquals
(
array
(
'foreign_key_test'
),
array_map
(
'strtolower'
,
$foreignKey
->
getColumns
()));
$this
->
assertEquals
(
array
(
'id'
),
array_map
(
'strtolower'
,
$foreignKey
->
getForeignColumns
()));
if
(
$this
->
_sm
->
getDatabasePlatform
()
->
supportsForeignKeyConstraints
())
{
$fks
=
$table
->
getForeignKeys
();
$this
->
assertCount
(
1
,
$fks
);
$foreignKey
=
current
(
$fks
);
$this
->
assertEquals
(
'alter_table_foreign'
,
strtolower
(
$foreignKey
->
getForeignTableName
()));
$this
->
assertEquals
(
array
(
'foreign_key_test'
),
array_map
(
'strtolower'
,
$foreignKey
->
getColumns
()));
$this
->
assertEquals
(
array
(
'id'
),
array_map
(
'strtolower'
,
$foreignKey
->
getForeignColumns
()));
}
}
public
function
testCreateAndListViews
()
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
e65517e0
...
...
@@ -10,7 +10,7 @@ use Doctrine\DBAL\Schema\TableDiff;
abstract
class
AbstractPlatformTestCase
extends
\Doctrine\Tests\DbalTestCase
{
/**
* @var Doctrine\DBAL\Platforms\AbstractPlatform
* @var
\
Doctrine\DBAL\Platforms\AbstractPlatform
*/
protected
$_platform
;
...
...
@@ -156,6 +156,21 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$this
->
assertEquals
(
$this
->
getGenerateConstraintForeignKeySql
(),
$sql
);
}
public
function
testGeneratesForeignKeySqlOnlyWhenSupportingForeignKeys
()
{
$fk
=
new
\Doctrine\DBAL\Schema\ForeignKeyConstraint
(
array
(
'fk_name'
),
'foreign'
,
array
(
'id'
),
'constraint_fk'
);
if
(
$this
->
_platform
->
supportsForeignKeyConstraints
())
{
$this
->
assertInternalType
(
'string'
,
$this
->
_platform
->
getCreateForeignKeySQL
(
$fk
,
'test'
)
);
}
else
{
$this
->
setExpectedException
(
'Doctrine\DBAL\DBALException'
);
$this
->
_platform
->
getCreateForeignKeySQL
(
$fk
,
'test'
);
}
}
protected
function
getBitAndComparisonExpressionSql
(
$value1
,
$value2
)
{
return
'('
.
$value1
.
' & '
.
$value2
.
')'
;
...
...
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