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
72465c6f
Commit
72465c6f
authored
Mar 24, 2012
by
Benjamin Eberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix CS: "AS" => "as" in foreach loops.
parent
92d1254e
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
127 additions
and
127 deletions
+127
-127
Driver.php
lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
+2
-2
OracleSessionInit.php
lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
+1
-1
AbstractPlatform.php
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
+14
-14
DB2Platform.php
lib/Doctrine/DBAL/Platforms/DB2Platform.php
+5
-5
DrizzlePlatform.php
lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
+4
-4
ReservedKeywordsValidator.php
...ine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
+2
-2
MySqlPlatform.php
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
+5
-5
OraclePlatform.php
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
+4
-4
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+2
-2
SQLServerPlatform.php
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
+6
-6
Statement.php
lib/Doctrine/DBAL/Portability/Statement.php
+2
-2
QueryBuilder.php
lib/Doctrine/DBAL/Query/QueryBuilder.php
+2
-2
SQLParserUtils.php
lib/Doctrine/DBAL/SQLParserUtils.php
+2
-2
AbstractAsset.php
lib/Doctrine/DBAL/Schema/AbstractAsset.php
+1
-1
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+4
-4
Column.php
lib/Doctrine/DBAL/Schema/Column.php
+2
-2
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+17
-17
DB2SchemaManager.php
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
+3
-3
Index.php
lib/Doctrine/DBAL/Schema/Index.php
+1
-1
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+2
-2
OracleSchemaManager.php
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
+2
-2
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+2
-2
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+2
-2
Schema.php
lib/Doctrine/DBAL/Schema/Schema.php
+6
-6
SchemaDiff.php
lib/Doctrine/DBAL/Schema/SchemaDiff.php
+9
-9
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+3
-3
Table.php
lib/Doctrine/DBAL/Schema/Table.php
+17
-17
DropSchemaSqlCollector.php
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
+3
-3
ReservedWordsCommand.php
...trine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
+2
-2
No files found.
lib/Doctrine/DBAL/Driver/PDOSqlite/Driver.php
View file @
72465c6f
...
@@ -59,7 +59,7 @@ class Driver implements \Doctrine\DBAL\Driver
...
@@ -59,7 +59,7 @@ class Driver implements \Doctrine\DBAL\Driver
$driverOptions
$driverOptions
);
);
foreach
(
$this
->
_userDefinedFunctions
AS
$fn
=>
$data
)
{
foreach
(
$this
->
_userDefinedFunctions
as
$fn
=>
$data
)
{
$pdo
->
sqliteCreateFunction
(
$fn
,
$data
[
'callback'
],
$data
[
'numArgs'
]);
$pdo
->
sqliteCreateFunction
(
$fn
,
$data
[
'callback'
],
$data
[
'numArgs'
]);
}
}
...
@@ -113,4 +113,4 @@ class Driver implements \Doctrine\DBAL\Driver
...
@@ -113,4 +113,4 @@ class Driver implements \Doctrine\DBAL\Driver
$params
=
$conn
->
getParams
();
$params
=
$conn
->
getParams
();
return
isset
(
$params
[
'path'
])
?
$params
[
'path'
]
:
null
;
return
isset
(
$params
[
'path'
])
?
$params
[
'path'
]
:
null
;
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Event/Listeners/OracleSessionInit.php
View file @
72465c6f
...
@@ -64,7 +64,7 @@ class OracleSessionInit implements EventSubscriber
...
@@ -64,7 +64,7 @@ class OracleSessionInit implements EventSubscriber
if
(
count
(
$this
->
_defaultSessionVars
))
{
if
(
count
(
$this
->
_defaultSessionVars
))
{
array_change_key_case
(
$this
->
_defaultSessionVars
,
\CASE_UPPER
);
array_change_key_case
(
$this
->
_defaultSessionVars
,
\CASE_UPPER
);
$vars
=
array
();
$vars
=
array
();
foreach
(
$this
->
_defaultSessionVars
AS
$option
=>
$value
)
{
foreach
(
$this
->
_defaultSessionVars
as
$option
=>
$value
)
{
$vars
[]
=
$option
.
" = '"
.
$value
.
"'"
;
$vars
[]
=
$option
.
" = '"
.
$value
.
"'"
;
}
}
$sql
=
"ALTER SESSION SET "
.
implode
(
" "
,
$vars
);
$sql
=
"ALTER SESSION SET "
.
implode
(
" "
,
$vars
);
...
...
lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
View file @
72465c6f
...
@@ -1048,7 +1048,7 @@ abstract class AbstractPlatform
...
@@ -1048,7 +1048,7 @@ abstract class AbstractPlatform
$options
[
'primary'
]
=
array
();
$options
[
'primary'
]
=
array
();
if
((
$createFlags
&
self
::
CREATE_INDEXES
)
>
0
)
{
if
((
$createFlags
&
self
::
CREATE_INDEXES
)
>
0
)
{
foreach
(
$table
->
getIndexes
()
AS
$index
)
{
foreach
(
$table
->
getIndexes
()
as
$index
)
{
/* @var $index Index */
/* @var $index Index */
if
(
$index
->
isPrimary
())
{
if
(
$index
->
isPrimary
())
{
$options
[
'primary'
]
=
$index
->
getColumns
();
$options
[
'primary'
]
=
$index
->
getColumns
();
...
@@ -1061,7 +1061,7 @@ abstract class AbstractPlatform
...
@@ -1061,7 +1061,7 @@ abstract class AbstractPlatform
$columnSql
=
array
();
$columnSql
=
array
();
$columns
=
array
();
$columns
=
array
();
foreach
(
$table
->
getColumns
()
AS
$column
)
{
foreach
(
$table
->
getColumns
()
as
$column
)
{
/* @var \Doctrine\DBAL\Schema\Column $column */
/* @var \Doctrine\DBAL\Schema\Column $column */
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaCreateTableColumn
))
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaCreateTableColumn
))
{
...
@@ -1103,7 +1103,7 @@ abstract class AbstractPlatform
...
@@ -1103,7 +1103,7 @@ abstract class AbstractPlatform
if
((
$createFlags
&
self
::
CREATE_FOREIGNKEYS
)
>
0
)
{
if
((
$createFlags
&
self
::
CREATE_FOREIGNKEYS
)
>
0
)
{
$options
[
'foreignKeys'
]
=
array
();
$options
[
'foreignKeys'
]
=
array
();
foreach
(
$table
->
getForeignKeys
()
AS
$fkConstraint
)
{
foreach
(
$table
->
getForeignKeys
()
as
$fkConstraint
)
{
$options
[
'foreignKeys'
][]
=
$fkConstraint
;
$options
[
'foreignKeys'
][]
=
$fkConstraint
;
}
}
}
}
...
@@ -1119,7 +1119,7 @@ abstract class AbstractPlatform
...
@@ -1119,7 +1119,7 @@ abstract class AbstractPlatform
$sql
=
$this
->
_getCreateTableSQL
(
$tableName
,
$columns
,
$options
);
$sql
=
$this
->
_getCreateTableSQL
(
$tableName
,
$columns
,
$options
);
if
(
$this
->
supportsCommentOnStatement
())
{
if
(
$this
->
supportsCommentOnStatement
())
{
foreach
(
$table
->
getColumns
()
AS
$column
)
{
foreach
(
$table
->
getColumns
()
as
$column
)
{
if
(
$this
->
getColumnComment
(
$column
))
{
if
(
$this
->
getColumnComment
(
$column
))
{
$sql
[]
=
$this
->
getCommentOnColumnSQL
(
$tableName
,
$column
->
getName
(),
$this
->
getColumnComment
(
$column
));
$sql
[]
=
$this
->
getCommentOnColumnSQL
(
$tableName
,
$column
->
getName
(),
$this
->
getColumnComment
(
$column
));
}
}
...
@@ -1171,7 +1171,7 @@ abstract class AbstractPlatform
...
@@ -1171,7 +1171,7 @@ abstract class AbstractPlatform
$sql
[]
=
$query
;
$sql
[]
=
$query
;
if
(
isset
(
$options
[
'foreignKeys'
]))
{
if
(
isset
(
$options
[
'foreignKeys'
]))
{
foreach
((
array
)
$options
[
'foreignKeys'
]
AS
$definition
)
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$definition
)
{
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$tableName
);
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$tableName
);
}
}
}
}
...
@@ -1242,7 +1242,7 @@ abstract class AbstractPlatform
...
@@ -1242,7 +1242,7 @@ abstract class AbstractPlatform
$query
.=
' FOREIGN KEY'
;
$query
.=
' FOREIGN KEY'
;
$foreignColumns
=
array
();
$foreignColumns
=
array
();
foreach
(
$constraint
->
getForeignColumns
()
AS
$column
)
{
foreach
(
$constraint
->
getForeignColumns
()
as
$column
)
{
$foreignColumns
[]
=
$column
;
$foreignColumns
[]
=
$column
;
}
}
...
@@ -1496,18 +1496,18 @@ abstract class AbstractPlatform
...
@@ -1496,18 +1496,18 @@ abstract class AbstractPlatform
$sql
=
array
();
$sql
=
array
();
if
(
$this
->
supportsForeignKeyConstraints
())
{
if
(
$this
->
supportsForeignKeyConstraints
())
{
foreach
(
$diff
->
removedForeignKeys
AS
$foreignKey
)
{
foreach
(
$diff
->
removedForeignKeys
as
$foreignKey
)
{
$sql
[]
=
$this
->
getDropForeignKeySQL
(
$foreignKey
,
$tableName
);
$sql
[]
=
$this
->
getDropForeignKeySQL
(
$foreignKey
,
$tableName
);
}
}
foreach
(
$diff
->
changedForeignKeys
AS
$foreignKey
)
{
foreach
(
$diff
->
changedForeignKeys
as
$foreignKey
)
{
$sql
[]
=
$this
->
getDropForeignKeySQL
(
$foreignKey
,
$tableName
);
$sql
[]
=
$this
->
getDropForeignKeySQL
(
$foreignKey
,
$tableName
);
}
}
}
}
foreach
(
$diff
->
removedIndexes
AS
$index
)
{
foreach
(
$diff
->
removedIndexes
as
$index
)
{
$sql
[]
=
$this
->
getDropIndexSQL
(
$index
,
$tableName
);
$sql
[]
=
$this
->
getDropIndexSQL
(
$index
,
$tableName
);
}
}
foreach
(
$diff
->
changedIndexes
AS
$index
)
{
foreach
(
$diff
->
changedIndexes
as
$index
)
{
$sql
[]
=
$this
->
getDropIndexSQL
(
$index
,
$tableName
);
$sql
[]
=
$this
->
getDropIndexSQL
(
$index
,
$tableName
);
}
}
...
@@ -1524,18 +1524,18 @@ abstract class AbstractPlatform
...
@@ -1524,18 +1524,18 @@ abstract class AbstractPlatform
$sql
=
array
();
$sql
=
array
();
if
(
$this
->
supportsForeignKeyConstraints
())
{
if
(
$this
->
supportsForeignKeyConstraints
())
{
foreach
(
$diff
->
addedForeignKeys
AS
$foreignKey
)
{
foreach
(
$diff
->
addedForeignKeys
as
$foreignKey
)
{
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$foreignKey
,
$tableName
);
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$foreignKey
,
$tableName
);
}
}
foreach
(
$diff
->
changedForeignKeys
AS
$foreignKey
)
{
foreach
(
$diff
->
changedForeignKeys
as
$foreignKey
)
{
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$foreignKey
,
$tableName
);
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$foreignKey
,
$tableName
);
}
}
}
}
foreach
(
$diff
->
addedIndexes
AS
$index
)
{
foreach
(
$diff
->
addedIndexes
as
$index
)
{
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$tableName
);
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$tableName
);
}
}
foreach
(
$diff
->
changedIndexes
AS
$index
)
{
foreach
(
$diff
->
changedIndexes
as
$index
)
{
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$tableName
);
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$tableName
);
}
}
...
...
lib/Doctrine/DBAL/Platforms/DB2Platform.php
View file @
72465c6f
...
@@ -376,7 +376,7 @@ class DB2Platform extends AbstractPlatform
...
@@ -376,7 +376,7 @@ class DB2Platform extends AbstractPlatform
$columnSql
=
array
();
$columnSql
=
array
();
$queryParts
=
array
();
$queryParts
=
array
();
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
foreach
(
$diff
->
addedColumns
as
$fieldName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -384,7 +384,7 @@ class DB2Platform extends AbstractPlatform
...
@@ -384,7 +384,7 @@ class DB2Platform extends AbstractPlatform
$queryParts
[]
=
'ADD COLUMN '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
$queryParts
[]
=
'ADD COLUMN '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -392,7 +392,7 @@ class DB2Platform extends AbstractPlatform
...
@@ -392,7 +392,7 @@ class DB2Platform extends AbstractPlatform
$queryParts
[]
=
'DROP COLUMN '
.
$column
->
getQuotedName
(
$this
);
$queryParts
[]
=
'DROP COLUMN '
.
$column
->
getQuotedName
(
$this
);
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
as
$columnDiff
)
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -403,7 +403,7 @@ class DB2Platform extends AbstractPlatform
...
@@ -403,7 +403,7 @@ class DB2Platform extends AbstractPlatform
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -584,4 +584,4 @@ class DB2Platform extends AbstractPlatform
...
@@ -584,4 +584,4 @@ class DB2Platform extends AbstractPlatform
{
{
return
'Doctrine\DBAL\Platforms\Keywords\DB2Keywords'
;
return
'Doctrine\DBAL\Platforms\Keywords\DB2Keywords'
;
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
View file @
72465c6f
...
@@ -302,7 +302,7 @@ class DrizzlePlatform extends AbstractPlatform
...
@@ -302,7 +302,7 @@ class DrizzlePlatform extends AbstractPlatform
$queryParts
[]
=
'RENAME TO '
.
$diff
->
newName
;
$queryParts
[]
=
'RENAME TO '
.
$diff
->
newName
;
}
}
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
foreach
(
$diff
->
addedColumns
as
$fieldName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -312,7 +312,7 @@ class DrizzlePlatform extends AbstractPlatform
...
@@ -312,7 +312,7 @@ class DrizzlePlatform extends AbstractPlatform
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
}
}
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -320,7 +320,7 @@ class DrizzlePlatform extends AbstractPlatform
...
@@ -320,7 +320,7 @@ class DrizzlePlatform extends AbstractPlatform
$queryParts
[]
=
'DROP '
.
$column
->
getQuotedName
(
$this
);
$queryParts
[]
=
'DROP '
.
$column
->
getQuotedName
(
$this
);
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
as
$columnDiff
)
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -333,7 +333,7 @@ class DrizzlePlatform extends AbstractPlatform
...
@@ -333,7 +333,7 @@ class DrizzlePlatform extends AbstractPlatform
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
...
lib/Doctrine/DBAL/Platforms/Keywords/ReservedKeywordsValidator.php
View file @
72465c6f
...
@@ -61,7 +61,7 @@ class ReservedKeywordsValidator implements Visitor
...
@@ -61,7 +61,7 @@ class ReservedKeywordsValidator implements Visitor
}
}
$keywordLists
=
array
();
$keywordLists
=
array
();
foreach
(
$this
->
keywordLists
AS
$keywordList
)
{
foreach
(
$this
->
keywordLists
as
$keywordList
)
{
if
(
$keywordList
->
isKeyword
(
$word
))
{
if
(
$keywordList
->
isKeyword
(
$word
))
{
$keywordLists
[]
=
$keywordList
->
getName
();
$keywordLists
[]
=
$keywordList
->
getName
();
}
}
...
@@ -113,4 +113,4 @@ class ReservedKeywordsValidator implements Visitor
...
@@ -113,4 +113,4 @@ class ReservedKeywordsValidator implements Visitor
$this
->
isReservedWord
(
$table
->
getName
())
$this
->
isReservedWord
(
$table
->
getName
())
);
);
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
View file @
72465c6f
...
@@ -460,7 +460,7 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -460,7 +460,7 @@ class MySqlPlatform extends AbstractPlatform
$queryParts
[]
=
'RENAME TO '
.
$diff
->
newName
;
$queryParts
[]
=
'RENAME TO '
.
$diff
->
newName
;
}
}
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
foreach
(
$diff
->
addedColumns
as
$fieldName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -470,7 +470,7 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -470,7 +470,7 @@ class MySqlPlatform extends AbstractPlatform
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
}
}
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -478,7 +478,7 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -478,7 +478,7 @@ class MySqlPlatform extends AbstractPlatform
$queryParts
[]
=
'DROP '
.
$column
->
getQuotedName
(
$this
);
$queryParts
[]
=
'DROP '
.
$column
->
getQuotedName
(
$this
);
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
as
$columnDiff
)
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -491,7 +491,7 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -491,7 +491,7 @@ class MySqlPlatform extends AbstractPlatform
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$columnArray
);
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -530,7 +530,7 @@ class MySqlPlatform extends AbstractPlatform
...
@@ -530,7 +530,7 @@ class MySqlPlatform extends AbstractPlatform
$sql
=
array
();
$sql
=
array
();
$table
=
$diff
->
name
;
$table
=
$diff
->
name
;
foreach
(
$diff
->
removedIndexes
AS
$remKey
=>
$remIndex
)
{
foreach
(
$diff
->
removedIndexes
as
$remKey
=>
$remIndex
)
{
foreach
(
$diff
->
addedIndexes
as
$addKey
=>
$addIndex
)
{
foreach
(
$diff
->
addedIndexes
as
$addKey
=>
$addIndex
)
{
if
(
$remIndex
->
getColumns
()
==
$addIndex
->
getColumns
())
{
if
(
$remIndex
->
getColumns
()
==
$addIndex
->
getColumns
())
{
...
...
lib/Doctrine/DBAL/Platforms/OraclePlatform.php
View file @
72465c6f
...
@@ -572,7 +572,7 @@ LEFT JOIN user_cons_columns r_cols
...
@@ -572,7 +572,7 @@ LEFT JOIN user_cons_columns r_cols
$columnSql
=
array
();
$columnSql
=
array
();
$fields
=
array
();
$fields
=
array
();
foreach
(
$diff
->
addedColumns
AS
$column
)
{
foreach
(
$diff
->
addedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -587,7 +587,7 @@ LEFT JOIN user_cons_columns r_cols
...
@@ -587,7 +587,7 @@ LEFT JOIN user_cons_columns r_cols
}
}
$fields
=
array
();
$fields
=
array
();
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
as
$columnDiff
)
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -602,7 +602,7 @@ LEFT JOIN user_cons_columns r_cols
...
@@ -602,7 +602,7 @@ LEFT JOIN user_cons_columns r_cols
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' MODIFY ('
.
implode
(
', '
,
$fields
)
.
')'
;
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' MODIFY ('
.
implode
(
', '
,
$fields
)
.
')'
;
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -611,7 +611,7 @@ LEFT JOIN user_cons_columns r_cols
...
@@ -611,7 +611,7 @@ LEFT JOIN user_cons_columns r_cols
}
}
$fields
=
array
();
$fields
=
array
();
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
...
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
72465c6f
...
@@ -404,7 +404,7 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -404,7 +404,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
$query
;
$sql
[]
=
'ALTER TABLE '
.
$diff
->
name
.
' '
.
$query
;
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
as
$columnDiff
)
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -533,7 +533,7 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -533,7 +533,7 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql
[]
=
$query
;
$sql
[]
=
$query
;
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
foreach
(
$options
[
'indexes'
]
AS
$index
)
{
foreach
(
$options
[
'indexes'
]
as
$index
)
{
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$tableName
);
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$tableName
);
}
}
}
}
...
...
lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
View file @
72465c6f
...
@@ -213,13 +213,13 @@ class SQLServerPlatform extends AbstractPlatform
...
@@ -213,13 +213,13 @@ class SQLServerPlatform extends AbstractPlatform
$sql
[]
=
$query
;
$sql
[]
=
$query
;
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
if
(
isset
(
$options
[
'indexes'
])
&&
!
empty
(
$options
[
'indexes'
]))
{
foreach
(
$options
[
'indexes'
]
AS
$index
)
{
foreach
(
$options
[
'indexes'
]
as
$index
)
{
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$tableName
);
$sql
[]
=
$this
->
getCreateIndexSQL
(
$index
,
$tableName
);
}
}
}
}
if
(
isset
(
$options
[
'foreignKeys'
]))
{
if
(
isset
(
$options
[
'foreignKeys'
]))
{
foreach
((
array
)
$options
[
'foreignKeys'
]
AS
$definition
)
{
foreach
((
array
)
$options
[
'foreignKeys'
]
as
$definition
)
{
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$tableName
);
$sql
[]
=
$this
->
getCreateForeignKeySQL
(
$definition
,
$tableName
);
}
}
}
}
...
@@ -322,7 +322,7 @@ class SQLServerPlatform extends AbstractPlatform
...
@@ -322,7 +322,7 @@ class SQLServerPlatform extends AbstractPlatform
$queryParts
[]
=
'RENAME TO '
.
$diff
->
newName
;
$queryParts
[]
=
'RENAME TO '
.
$diff
->
newName
;
}
}
foreach
(
$diff
->
addedColumns
AS
$fieldName
=>
$column
)
{
foreach
(
$diff
->
addedColumns
as
$fieldName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableAddColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -330,7 +330,7 @@ class SQLServerPlatform extends AbstractPlatform
...
@@ -330,7 +330,7 @@ class SQLServerPlatform extends AbstractPlatform
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
$queryParts
[]
=
'ADD '
.
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
removedColumns
AS
$column
)
{
foreach
(
$diff
->
removedColumns
as
$column
)
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRemoveColumn
(
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -338,7 +338,7 @@ class SQLServerPlatform extends AbstractPlatform
...
@@ -338,7 +338,7 @@ class SQLServerPlatform extends AbstractPlatform
$queryParts
[]
=
'DROP COLUMN '
.
$column
->
getQuotedName
(
$this
);
$queryParts
[]
=
'DROP COLUMN '
.
$column
->
getQuotedName
(
$this
);
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
as
$columnDiff
)
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableChangeColumn
(
$columnDiff
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
@@ -349,7 +349,7 @@ class SQLServerPlatform extends AbstractPlatform
...
@@ -349,7 +349,7 @@ class SQLServerPlatform extends AbstractPlatform
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
$this
->
getColumnDeclarationSQL
(
$column
->
getQuotedName
(
$this
),
$column
->
toArray
());
}
}
foreach
(
$diff
->
renamedColumns
AS
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
if
(
$this
->
onSchemaAlterTableRenameColumn
(
$oldColumnName
,
$column
,
$diff
,
$columnSql
))
{
continue
;
continue
;
}
}
...
...
lib/Doctrine/DBAL/Portability/Statement.php
View file @
72465c6f
...
@@ -138,7 +138,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
...
@@ -138,7 +138,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
return
$rows
;
return
$rows
;
}
}
foreach
(
$rows
AS
$num
=>
$row
)
{
foreach
(
$rows
as
$num
=>
$row
)
{
$rows
[
$num
]
=
$this
->
fixRow
(
$row
,
$iterateRow
,
$fixCase
);
$rows
[
$num
]
=
$this
->
fixRow
(
$row
,
$iterateRow
,
$fixCase
);
}
}
...
@@ -156,7 +156,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
...
@@ -156,7 +156,7 @@ class Statement implements \IteratorAggregate, \Doctrine\DBAL\Driver\Statement
}
}
if
(
$iterateRow
)
{
if
(
$iterateRow
)
{
foreach
(
$row
AS
$k
=>
$v
)
{
foreach
(
$row
as
$k
=>
$v
)
{
if
((
$this
->
portability
&
Connection
::
PORTABILITY_EMPTY_TO_NULL
)
&&
$v
===
''
)
{
if
((
$this
->
portability
&
Connection
::
PORTABILITY_EMPTY_TO_NULL
)
&&
$v
===
''
)
{
$row
[
$k
]
=
null
;
$row
[
$k
]
=
null
;
}
else
if
((
$this
->
portability
&
Connection
::
PORTABILITY_RTRIM
)
&&
is_string
(
$v
))
{
}
else
if
((
$this
->
portability
&
Connection
::
PORTABILITY_RTRIM
)
&&
is_string
(
$v
))
{
...
...
lib/Doctrine/DBAL/Query/QueryBuilder.php
View file @
72465c6f
...
@@ -374,7 +374,7 @@ class QueryBuilder
...
@@ -374,7 +374,7 @@ class QueryBuilder
if
(
$append
)
{
if
(
$append
)
{
if
(
$sqlPartName
==
"orderBy"
||
$sqlPartName
==
"groupBy"
||
$sqlPartName
==
"select"
||
$sqlPartName
==
"set"
)
{
if
(
$sqlPartName
==
"orderBy"
||
$sqlPartName
==
"groupBy"
||
$sqlPartName
==
"select"
||
$sqlPartName
==
"set"
)
{
foreach
(
$sqlPart
AS
$part
)
{
foreach
(
$sqlPart
as
$part
)
{
$this
->
sqlParts
[
$sqlPartName
][]
=
$part
;
$this
->
sqlParts
[
$sqlPartName
][]
=
$part
;
}
}
}
else
if
(
$isArray
&&
is_array
(
$sqlPart
[
key
(
$sqlPart
)]))
{
}
else
if
(
$isArray
&&
is_array
(
$sqlPart
[
key
(
$sqlPart
)]))
{
...
@@ -1088,4 +1088,4 @@ class QueryBuilder
...
@@ -1088,4 +1088,4 @@ class QueryBuilder
$this
->
setParameter
(
$this
->
boundCounter
,
$value
,
$type
);
$this
->
setParameter
(
$this
->
boundCounter
,
$value
,
$type
);
return
"?"
;
return
"?"
;
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/SQLParserUtils.php
View file @
72465c6f
...
@@ -88,7 +88,7 @@ class SQLParserUtils
...
@@ -88,7 +88,7 @@ class SQLParserUtils
$isPositional
=
is_int
(
key
(
$params
));
$isPositional
=
is_int
(
key
(
$params
));
$arrayPositions
=
array
();
$arrayPositions
=
array
();
$bindIndex
=
-
1
;
$bindIndex
=
-
1
;
foreach
(
$types
AS
$name
=>
$type
)
{
foreach
(
$types
as
$name
=>
$type
)
{
++
$bindIndex
;
++
$bindIndex
;
if
(
$type
===
Connection
::
PARAM_INT_ARRAY
||
$type
===
Connection
::
PARAM_STR_ARRAY
)
{
if
(
$type
===
Connection
::
PARAM_INT_ARRAY
||
$type
===
Connection
::
PARAM_STR_ARRAY
)
{
if
(
$isPositional
)
{
if
(
$isPositional
)
{
...
@@ -107,7 +107,7 @@ class SQLParserUtils
...
@@ -107,7 +107,7 @@ class SQLParserUtils
if
(
$isPositional
)
{
if
(
$isPositional
)
{
$paramOffset
=
0
;
$paramOffset
=
0
;
$queryOffset
=
0
;
$queryOffset
=
0
;
foreach
(
$paramPos
AS
$needle
=>
$needlePos
)
{
foreach
(
$paramPos
as
$needle
=>
$needlePos
)
{
if
(
!
isset
(
$arrayPositions
[
$needle
]))
{
if
(
!
isset
(
$arrayPositions
[
$needle
]))
{
continue
;
continue
;
}
}
...
...
lib/Doctrine/DBAL/Schema/AbstractAsset.php
View file @
72465c6f
...
@@ -175,7 +175,7 @@ abstract class AbstractAsset
...
@@ -175,7 +175,7 @@ abstract class AbstractAsset
{
{
$keywords
=
$platform
->
getReservedKeywordsList
();
$keywords
=
$platform
->
getReservedKeywordsList
();
$parts
=
explode
(
"."
,
$this
->
getName
());
$parts
=
explode
(
"."
,
$this
->
getName
());
foreach
(
$parts
AS
$k
=>
$v
)
{
foreach
(
$parts
as
$k
=>
$v
)
{
$parts
[
$k
]
=
(
$this
->
_quoted
||
$keywords
->
isKeyword
(
$v
))
?
$platform
->
quoteIdentifier
(
$v
)
:
$v
;
$parts
[
$k
]
=
(
$this
->
_quoted
||
$keywords
->
isKeyword
(
$v
))
?
$platform
->
quoteIdentifier
(
$v
)
:
$v
;
}
}
...
...
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
72465c6f
...
@@ -238,7 +238,7 @@ abstract class AbstractSchemaManager
...
@@ -238,7 +238,7 @@ abstract class AbstractSchemaManager
$tableNames
=
$this
->
listTableNames
();
$tableNames
=
$this
->
listTableNames
();
$tables
=
array
();
$tables
=
array
();
foreach
(
$tableNames
AS
$tableName
)
{
foreach
(
$tableNames
as
$tableName
)
{
$tables
[]
=
$this
->
listTableDetails
(
$tableName
);
$tables
[]
=
$this
->
listTableDetails
(
$tableName
);
}
}
...
@@ -549,7 +549,7 @@ abstract class AbstractSchemaManager
...
@@ -549,7 +549,7 @@ abstract class AbstractSchemaManager
{
{
$queries
=
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
);
$queries
=
$this
->
_platform
->
getAlterTableSQL
(
$tableDiff
);
if
(
is_array
(
$queries
)
&&
count
(
$queries
))
{
if
(
is_array
(
$queries
)
&&
count
(
$queries
))
{
foreach
(
$queries
AS
$ddlQuery
)
{
foreach
(
$queries
as
$ddlQuery
)
{
$this
->
_execSql
(
$ddlQuery
);
$this
->
_execSql
(
$ddlQuery
);
}
}
}
}
...
@@ -698,7 +698,7 @@ abstract class AbstractSchemaManager
...
@@ -698,7 +698,7 @@ abstract class AbstractSchemaManager
protected
function
_getPortableTableIndexesList
(
$tableIndexRows
,
$tableName
=
null
)
protected
function
_getPortableTableIndexesList
(
$tableIndexRows
,
$tableName
=
null
)
{
{
$result
=
array
();
$result
=
array
();
foreach
(
$tableIndexRows
AS
$tableIndex
)
{
foreach
(
$tableIndexRows
as
$tableIndex
)
{
$indexName
=
$keyName
=
$tableIndex
[
'key_name'
];
$indexName
=
$keyName
=
$tableIndex
[
'key_name'
];
if
(
$tableIndex
[
'primary'
])
{
if
(
$tableIndex
[
'primary'
])
{
$keyName
=
'primary'
;
$keyName
=
'primary'
;
...
@@ -721,7 +721,7 @@ abstract class AbstractSchemaManager
...
@@ -721,7 +721,7 @@ abstract class AbstractSchemaManager
$eventManager
=
$this
->
_platform
->
getEventManager
();
$eventManager
=
$this
->
_platform
->
getEventManager
();
$indexes
=
array
();
$indexes
=
array
();
foreach
(
$result
AS
$indexKey
=>
$data
)
{
foreach
(
$result
as
$indexKey
=>
$data
)
{
$index
=
null
;
$index
=
null
;
$defaultPrevented
=
false
;
$defaultPrevented
=
false
;
...
...
lib/Doctrine/DBAL/Schema/Column.php
View file @
72465c6f
...
@@ -125,7 +125,7 @@ class Column extends AbstractAsset
...
@@ -125,7 +125,7 @@ class Column extends AbstractAsset
*/
*/
public
function
setOptions
(
array
$options
)
public
function
setOptions
(
array
$options
)
{
{
foreach
(
$options
AS
$name
=>
$value
)
{
foreach
(
$options
as
$name
=>
$value
)
{
$method
=
"set"
.
$name
;
$method
=
"set"
.
$name
;
if
(
method_exists
(
$this
,
$method
))
{
if
(
method_exists
(
$this
,
$method
))
{
$this
->
$method
(
$value
);
$this
->
$method
(
$value
);
...
@@ -420,4 +420,4 @@ class Column extends AbstractAsset
...
@@ -420,4 +420,4 @@ class Column extends AbstractAsset
'comment'
=>
$this
->
_comment
,
'comment'
=>
$this
->
_comment
,
),
$this
->
_platformOptions
,
$this
->
_customSchemaOptions
);
),
$this
->
_platformOptions
,
$this
->
_customSchemaOptions
);
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
72465c6f
...
@@ -61,7 +61,7 @@ class Comparator
...
@@ -61,7 +61,7 @@ class Comparator
$foreignKeysToTable
=
array
();
$foreignKeysToTable
=
array
();
foreach
(
$toSchema
->
getTables
()
AS
$table
)
{
foreach
(
$toSchema
->
getTables
()
as
$table
)
{
$tableName
=
$table
->
getShortestName
(
$toSchema
->
getName
());
$tableName
=
$table
->
getShortestName
(
$toSchema
->
getName
());
if
(
!
$fromSchema
->
hasTable
(
$tableName
))
{
if
(
!
$fromSchema
->
hasTable
(
$tableName
))
{
$diff
->
newTables
[
$tableName
]
=
$toSchema
->
getTable
(
$tableName
);
$diff
->
newTables
[
$tableName
]
=
$toSchema
->
getTable
(
$tableName
);
...
@@ -74,7 +74,7 @@ class Comparator
...
@@ -74,7 +74,7 @@ class Comparator
}
}
/* Check if there are tables removed */
/* Check if there are tables removed */
foreach
(
$fromSchema
->
getTables
()
AS
$table
)
{
foreach
(
$fromSchema
->
getTables
()
as
$table
)
{
$tableName
=
$table
->
getShortestName
(
$fromSchema
->
getName
());
$tableName
=
$table
->
getShortestName
(
$fromSchema
->
getName
());
$table
=
$fromSchema
->
getTable
(
$tableName
);
$table
=
$fromSchema
->
getTable
(
$tableName
);
...
@@ -83,7 +83,7 @@ class Comparator
...
@@ -83,7 +83,7 @@ class Comparator
}
}
// also remember all foreign keys that point to a specific table
// also remember all foreign keys that point to a specific table
foreach
(
$table
->
getForeignKeys
()
AS
$foreignKey
)
{
foreach
(
$table
->
getForeignKeys
()
as
$foreignKey
)
{
$foreignTable
=
strtolower
(
$foreignKey
->
getForeignTableName
());
$foreignTable
=
strtolower
(
$foreignKey
->
getForeignTableName
());
if
(
!
isset
(
$foreignKeysToTable
[
$foreignTable
]))
{
if
(
!
isset
(
$foreignKeysToTable
[
$foreignTable
]))
{
$foreignKeysToTable
[
$foreignTable
]
=
array
();
$foreignKeysToTable
[
$foreignTable
]
=
array
();
...
@@ -92,13 +92,13 @@ class Comparator
...
@@ -92,13 +92,13 @@ class Comparator
}
}
}
}
foreach
(
$diff
->
removedTables
AS
$tableName
=>
$table
)
{
foreach
(
$diff
->
removedTables
as
$tableName
=>
$table
)
{
if
(
isset
(
$foreignKeysToTable
[
$tableName
]))
{
if
(
isset
(
$foreignKeysToTable
[
$tableName
]))
{
$diff
->
orphanedForeignKeys
=
array_merge
(
$diff
->
orphanedForeignKeys
,
$foreignKeysToTable
[
$tableName
]);
$diff
->
orphanedForeignKeys
=
array_merge
(
$diff
->
orphanedForeignKeys
,
$foreignKeysToTable
[
$tableName
]);
}
}
}
}
foreach
(
$toSchema
->
getSequences
()
AS
$sequence
)
{
foreach
(
$toSchema
->
getSequences
()
as
$sequence
)
{
$sequenceName
=
$sequence
->
getShortestName
(
$toSchema
->
getName
());
$sequenceName
=
$sequence
->
getShortestName
(
$toSchema
->
getName
());
if
(
!
$fromSchema
->
hasSequence
(
$sequenceName
))
{
if
(
!
$fromSchema
->
hasSequence
(
$sequenceName
))
{
$diff
->
newSequences
[]
=
$sequence
;
$diff
->
newSequences
[]
=
$sequence
;
...
@@ -109,7 +109,7 @@ class Comparator
...
@@ -109,7 +109,7 @@ class Comparator
}
}
}
}
foreach
(
$fromSchema
->
getSequences
()
AS
$sequence
)
{
foreach
(
$fromSchema
->
getSequences
()
as
$sequence
)
{
$sequenceName
=
$sequence
->
getShortestName
(
$fromSchema
->
getName
());
$sequenceName
=
$sequence
->
getShortestName
(
$fromSchema
->
getName
());
if
(
!
$toSchema
->
hasSequence
(
$sequenceName
))
{
if
(
!
$toSchema
->
hasSequence
(
$sequenceName
))
{
$diff
->
removedSequences
[]
=
$sequence
;
$diff
->
removedSequences
[]
=
$sequence
;
...
@@ -186,8 +186,8 @@ class Comparator
...
@@ -186,8 +186,8 @@ class Comparator
$table1Indexes
=
$table1
->
getIndexes
();
$table1Indexes
=
$table1
->
getIndexes
();
$table2Indexes
=
$table2
->
getIndexes
();
$table2Indexes
=
$table2
->
getIndexes
();
foreach
(
$table2Indexes
AS
$index2Name
=>
$index2Definition
)
{
foreach
(
$table2Indexes
as
$index2Name
=>
$index2Definition
)
{
foreach
(
$table1Indexes
AS
$index1Name
=>
$index1Definition
)
{
foreach
(
$table1Indexes
as
$index1Name
=>
$index1Definition
)
{
if
(
$this
->
diffIndex
(
$index1Definition
,
$index2Definition
)
===
false
)
{
if
(
$this
->
diffIndex
(
$index1Definition
,
$index2Definition
)
===
false
)
{
unset
(
$table1Indexes
[
$index1Name
]);
unset
(
$table1Indexes
[
$index1Name
]);
unset
(
$table2Indexes
[
$index2Name
]);
unset
(
$table2Indexes
[
$index2Name
]);
...
@@ -202,12 +202,12 @@ class Comparator
...
@@ -202,12 +202,12 @@ class Comparator
}
}
}
}
foreach
(
$table1Indexes
AS
$index1Name
=>
$index1Definition
)
{
foreach
(
$table1Indexes
as
$index1Name
=>
$index1Definition
)
{
$tableDifferences
->
removedIndexes
[
$index1Name
]
=
$index1Definition
;
$tableDifferences
->
removedIndexes
[
$index1Name
]
=
$index1Definition
;
$changes
++
;
$changes
++
;
}
}
foreach
(
$table2Indexes
AS
$index2Name
=>
$index2Definition
)
{
foreach
(
$table2Indexes
as
$index2Name
=>
$index2Definition
)
{
$tableDifferences
->
addedIndexes
[
$index2Name
]
=
$index2Definition
;
$tableDifferences
->
addedIndexes
[
$index2Name
]
=
$index2Definition
;
$changes
++
;
$changes
++
;
}
}
...
@@ -215,8 +215,8 @@ class Comparator
...
@@ -215,8 +215,8 @@ class Comparator
$fromFkeys
=
$table1
->
getForeignKeys
();
$fromFkeys
=
$table1
->
getForeignKeys
();
$toFkeys
=
$table2
->
getForeignKeys
();
$toFkeys
=
$table2
->
getForeignKeys
();
foreach
(
$fromFkeys
AS
$key1
=>
$constraint1
)
{
foreach
(
$fromFkeys
as
$key1
=>
$constraint1
)
{
foreach
(
$toFkeys
AS
$key2
=>
$constraint2
)
{
foreach
(
$toFkeys
as
$key2
=>
$constraint2
)
{
if
(
$this
->
diffForeignKey
(
$constraint1
,
$constraint2
)
===
false
)
{
if
(
$this
->
diffForeignKey
(
$constraint1
,
$constraint2
)
===
false
)
{
unset
(
$fromFkeys
[
$key1
]);
unset
(
$fromFkeys
[
$key1
]);
unset
(
$toFkeys
[
$key2
]);
unset
(
$toFkeys
[
$key2
]);
...
@@ -231,12 +231,12 @@ class Comparator
...
@@ -231,12 +231,12 @@ class Comparator
}
}
}
}
foreach
(
$fromFkeys
AS
$key1
=>
$constraint1
)
{
foreach
(
$fromFkeys
as
$key1
=>
$constraint1
)
{
$tableDifferences
->
removedForeignKeys
[]
=
$constraint1
;
$tableDifferences
->
removedForeignKeys
[]
=
$constraint1
;
$changes
++
;
$changes
++
;
}
}
foreach
(
$toFkeys
AS
$key2
=>
$constraint2
)
{
foreach
(
$toFkeys
as
$key2
=>
$constraint2
)
{
$tableDifferences
->
addedForeignKeys
[]
=
$constraint2
;
$tableDifferences
->
addedForeignKeys
[]
=
$constraint2
;
$changes
++
;
$changes
++
;
}
}
...
@@ -253,15 +253,15 @@ class Comparator
...
@@ -253,15 +253,15 @@ class Comparator
private
function
detectColumnRenamings
(
TableDiff
$tableDifferences
)
private
function
detectColumnRenamings
(
TableDiff
$tableDifferences
)
{
{
$renameCandidates
=
array
();
$renameCandidates
=
array
();
foreach
(
$tableDifferences
->
addedColumns
AS
$addedColumnName
=>
$addedColumn
)
{
foreach
(
$tableDifferences
->
addedColumns
as
$addedColumnName
=>
$addedColumn
)
{
foreach
(
$tableDifferences
->
removedColumns
AS
$removedColumnName
=>
$removedColumn
)
{
foreach
(
$tableDifferences
->
removedColumns
as
$removedColumnName
=>
$removedColumn
)
{
if
(
count
(
$this
->
diffColumn
(
$addedColumn
,
$removedColumn
))
==
0
)
{
if
(
count
(
$this
->
diffColumn
(
$addedColumn
,
$removedColumn
))
==
0
)
{
$renameCandidates
[
$addedColumn
->
getName
()][]
=
array
(
$removedColumn
,
$addedColumn
,
$addedColumnName
);
$renameCandidates
[
$addedColumn
->
getName
()][]
=
array
(
$removedColumn
,
$addedColumn
,
$addedColumnName
);
}
}
}
}
}
}
foreach
(
$renameCandidates
AS
$candidate
=>
$candidateColumns
)
{
foreach
(
$renameCandidates
as
$candidate
=>
$candidateColumns
)
{
if
(
count
(
$candidateColumns
)
==
1
)
{
if
(
count
(
$candidateColumns
)
==
1
)
{
list
(
$removedColumn
,
$addedColumn
)
=
$candidateColumns
[
0
];
list
(
$removedColumn
,
$addedColumn
)
=
$candidateColumns
[
0
];
$removedColumnName
=
strtolower
(
$removedColumn
->
getName
());
$removedColumnName
=
strtolower
(
$removedColumn
->
getName
());
...
...
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
View file @
72465c6f
...
@@ -113,7 +113,7 @@ class DB2SchemaManager extends AbstractSchemaManager
...
@@ -113,7 +113,7 @@ class DB2SchemaManager extends AbstractSchemaManager
protected
function
_getPortableTablesList
(
$tables
)
protected
function
_getPortableTablesList
(
$tables
)
{
{
$tableNames
=
array
();
$tableNames
=
array
();
foreach
(
$tables
AS
$tableRow
)
{
foreach
(
$tables
as
$tableRow
)
{
$tableRow
=
array_change_key_case
(
$tableRow
,
\CASE_LOWER
);
$tableRow
=
array_change_key_case
(
$tableRow
,
\CASE_LOWER
);
$tableNames
[]
=
$tableRow
[
'name'
];
$tableNames
[]
=
$tableRow
[
'name'
];
}
}
...
@@ -126,7 +126,7 @@ class DB2SchemaManager extends AbstractSchemaManager
...
@@ -126,7 +126,7 @@ class DB2SchemaManager extends AbstractSchemaManager
$tableIndexRows
=
array
();
$tableIndexRows
=
array
();
$indexes
=
array
();
$indexes
=
array
();
foreach
(
$tableIndexes
AS
$indexKey
=>
$data
)
{
foreach
(
$tableIndexes
as
$indexKey
=>
$data
)
{
$data
=
array_change_key_case
(
$data
,
\CASE_LOWER
);
$data
=
array_change_key_case
(
$data
,
\CASE_LOWER
);
$unique
=
(
$data
[
'uniquerule'
]
==
"D"
)
?
false
:
true
;
$unique
=
(
$data
[
'uniquerule'
]
==
"D"
)
?
false
:
true
;
$primary
=
(
$data
[
'uniquerule'
]
==
"P"
);
$primary
=
(
$data
[
'uniquerule'
]
==
"P"
);
...
@@ -211,4 +211,4 @@ class DB2SchemaManager extends AbstractSchemaManager
...
@@ -211,4 +211,4 @@ class DB2SchemaManager extends AbstractSchemaManager
return
new
View
(
$view
[
'name'
],
$sql
);
return
new
View
(
$view
[
'name'
],
$sql
);
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Schema/Index.php
View file @
72465c6f
...
@@ -59,7 +59,7 @@ class Index extends AbstractAsset implements Constraint
...
@@ -59,7 +59,7 @@ class Index extends AbstractAsset implements Constraint
$this
->
_isUnique
=
$isUnique
;
$this
->
_isUnique
=
$isUnique
;
$this
->
_isPrimary
=
$isPrimary
;
$this
->
_isPrimary
=
$isPrimary
;
foreach
(
$columns
AS
$column
)
{
foreach
(
$columns
as
$column
)
{
$this
->
_addColumn
(
$column
);
$this
->
_addColumn
(
$column
);
}
}
foreach
(
$flags
as
$flag
)
{
foreach
(
$flags
as
$flag
)
{
...
...
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
72465c6f
...
@@ -52,7 +52,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
...
@@ -52,7 +52,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
protected
function
_getPortableTableIndexesList
(
$tableIndexes
,
$tableName
=
null
)
protected
function
_getPortableTableIndexesList
(
$tableIndexes
,
$tableName
=
null
)
{
{
foreach
(
$tableIndexes
AS
$k
=>
$v
)
{
foreach
(
$tableIndexes
as
$k
=>
$v
)
{
$v
=
array_change_key_case
(
$v
,
CASE_LOWER
);
$v
=
array_change_key_case
(
$v
,
CASE_LOWER
);
if
(
$v
[
'key_name'
]
==
'PRIMARY'
)
{
if
(
$v
[
'key_name'
]
==
'PRIMARY'
)
{
$v
[
'primary'
]
=
true
;
$v
[
'primary'
]
=
true
;
...
@@ -200,7 +200,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
...
@@ -200,7 +200,7 @@ class MySqlSchemaManager extends AbstractSchemaManager
}
}
$result
=
array
();
$result
=
array
();
foreach
(
$list
AS
$constraint
)
{
foreach
(
$list
as
$constraint
)
{
$result
[]
=
new
ForeignKeyConstraint
(
$result
[]
=
new
ForeignKeyConstraint
(
array_values
(
$constraint
[
'local'
]),
$constraint
[
'foreignTable'
],
array_values
(
$constraint
[
'local'
]),
$constraint
[
'foreignTable'
],
array_values
(
$constraint
[
'foreign'
]),
$constraint
[
'name'
],
array_values
(
$constraint
[
'foreign'
]),
$constraint
[
'name'
],
...
...
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
72465c6f
...
@@ -219,7 +219,7 @@ class OracleSchemaManager extends AbstractSchemaManager
...
@@ -219,7 +219,7 @@ class OracleSchemaManager extends AbstractSchemaManager
}
}
$result
=
array
();
$result
=
array
();
foreach
(
$list
AS
$constraint
)
{
foreach
(
$list
as
$constraint
)
{
$result
[]
=
new
ForeignKeyConstraint
(
$result
[]
=
new
ForeignKeyConstraint
(
array_values
(
$constraint
[
'local'
]),
$constraint
[
'foreignTable'
],
array_values
(
$constraint
[
'local'
]),
$constraint
[
'foreignTable'
],
array_values
(
$constraint
[
'foreign'
]),
$constraint
[
'name'
],
array_values
(
$constraint
[
'foreign'
]),
$constraint
[
'name'
],
...
@@ -283,4 +283,4 @@ class OracleSchemaManager extends AbstractSchemaManager
...
@@ -283,4 +283,4 @@ class OracleSchemaManager extends AbstractSchemaManager
return
parent
::
dropTable
(
$name
);
return
parent
::
dropTable
(
$name
);
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
72465c6f
...
@@ -194,7 +194,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
...
@@ -194,7 +194,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
protected
function
_getPortableTableIndexesList
(
$tableIndexes
,
$tableName
=
null
)
protected
function
_getPortableTableIndexesList
(
$tableIndexes
,
$tableName
=
null
)
{
{
$buffer
=
array
();
$buffer
=
array
();
foreach
(
$tableIndexes
AS
$row
)
{
foreach
(
$tableIndexes
as
$row
)
{
$colNumbers
=
explode
(
' '
,
$row
[
'indkey'
]);
$colNumbers
=
explode
(
' '
,
$row
[
'indkey'
]);
$colNumbersSql
=
'IN ('
.
join
(
' ,'
,
$colNumbers
)
.
' )'
;
$colNumbersSql
=
'IN ('
.
join
(
' ,'
,
$colNumbers
)
.
' )'
;
$columnNameSql
=
"SELECT attnum, attname FROM pg_attribute
$columnNameSql
=
"SELECT attnum, attname FROM pg_attribute
...
@@ -204,7 +204,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
...
@@ -204,7 +204,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
$indexColumns
=
$stmt
->
fetchAll
();
$indexColumns
=
$stmt
->
fetchAll
();
// required for getting the order of the columns right.
// required for getting the order of the columns right.
foreach
(
$colNumbers
AS
$colNum
)
{
foreach
(
$colNumbers
as
$colNum
)
{
foreach
(
$indexColumns
as
$colRow
)
{
foreach
(
$indexColumns
as
$colRow
)
{
if
(
$colNum
==
$colRow
[
'attnum'
])
{
if
(
$colNum
==
$colRow
[
'attnum'
])
{
$buffer
[]
=
array
(
$buffer
[]
=
array
(
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
72465c6f
...
@@ -106,7 +106,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -106,7 +106,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
{
{
// TODO: Remove code duplication with AbstractSchemaManager;
// TODO: Remove code duplication with AbstractSchemaManager;
$result
=
array
();
$result
=
array
();
foreach
(
$tableIndexRows
AS
$tableIndex
)
{
foreach
(
$tableIndexRows
as
$tableIndex
)
{
$indexName
=
$keyName
=
$tableIndex
[
'index_name'
];
$indexName
=
$keyName
=
$tableIndex
[
'index_name'
];
if
(
strpos
(
$tableIndex
[
'index_description'
],
'primary key'
)
!==
false
)
{
if
(
strpos
(
$tableIndex
[
'index_description'
],
'primary key'
)
!==
false
)
{
$keyName
=
'primary'
;
$keyName
=
'primary'
;
...
@@ -132,7 +132,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -132,7 +132,7 @@ class SQLServerSchemaManager extends AbstractSchemaManager
$eventManager
=
$this
->
_platform
->
getEventManager
();
$eventManager
=
$this
->
_platform
->
getEventManager
();
$indexes
=
array
();
$indexes
=
array
();
foreach
(
$result
AS
$indexKey
=>
$data
)
{
foreach
(
$result
as
$indexKey
=>
$data
)
{
$index
=
null
;
$index
=
null
;
$defaultPrevented
=
false
;
$defaultPrevented
=
false
;
...
...
lib/Doctrine/DBAL/Schema/Schema.php
View file @
72465c6f
...
@@ -84,10 +84,10 @@ class Schema extends AbstractAsset
...
@@ -84,10 +84,10 @@ class Schema extends AbstractAsset
$this
->
_schemaConfig
=
$schemaConfig
;
$this
->
_schemaConfig
=
$schemaConfig
;
$this
->
_setName
(
$schemaConfig
->
getName
()
?:
'public'
);
$this
->
_setName
(
$schemaConfig
->
getName
()
?:
'public'
);
foreach
(
$tables
AS
$table
)
{
foreach
(
$tables
as
$table
)
{
$this
->
_addTable
(
$table
);
$this
->
_addTable
(
$table
);
}
}
foreach
(
$sequences
AS
$sequence
)
{
foreach
(
$sequences
as
$sequence
)
{
$this
->
_addSequence
(
$sequence
);
$this
->
_addSequence
(
$sequence
);
}
}
}
}
...
@@ -342,10 +342,10 @@ class Schema extends AbstractAsset
...
@@ -342,10 +342,10 @@ class Schema extends AbstractAsset
{
{
$visitor
->
acceptSchema
(
$this
);
$visitor
->
acceptSchema
(
$this
);
foreach
(
$this
->
_tables
AS
$table
)
{
foreach
(
$this
->
_tables
as
$table
)
{
$table
->
visit
(
$visitor
);
$table
->
visit
(
$visitor
);
}
}
foreach
(
$this
->
_sequences
AS
$sequence
)
{
foreach
(
$this
->
_sequences
as
$sequence
)
{
$sequence
->
visit
(
$visitor
);
$sequence
->
visit
(
$visitor
);
}
}
}
}
...
@@ -357,10 +357,10 @@ class Schema extends AbstractAsset
...
@@ -357,10 +357,10 @@ class Schema extends AbstractAsset
*/
*/
public
function
__clone
()
public
function
__clone
()
{
{
foreach
(
$this
->
_tables
AS
$k
=>
$table
)
{
foreach
(
$this
->
_tables
as
$k
=>
$table
)
{
$this
->
_tables
[
$k
]
=
clone
$table
;
$this
->
_tables
[
$k
]
=
clone
$table
;
}
}
foreach
(
$this
->
_sequences
AS
$k
=>
$sequence
)
{
foreach
(
$this
->
_sequences
as
$k
=>
$sequence
)
{
$this
->
_sequences
[
$k
]
=
clone
$sequence
;
$this
->
_sequences
[
$k
]
=
clone
$sequence
;
}
}
}
}
...
...
lib/Doctrine/DBAL/Schema/SchemaDiff.php
View file @
72465c6f
...
@@ -125,36 +125,36 @@ class SchemaDiff
...
@@ -125,36 +125,36 @@ class SchemaDiff
$sql
=
array
();
$sql
=
array
();
if
(
$platform
->
supportsForeignKeyConstraints
()
&&
$saveMode
==
false
)
{
if
(
$platform
->
supportsForeignKeyConstraints
()
&&
$saveMode
==
false
)
{
foreach
(
$this
->
orphanedForeignKeys
AS
$orphanedForeignKey
)
{
foreach
(
$this
->
orphanedForeignKeys
as
$orphanedForeignKey
)
{
$sql
[]
=
$platform
->
getDropForeignKeySQL
(
$orphanedForeignKey
,
$orphanedForeignKey
->
getLocalTableName
());
$sql
[]
=
$platform
->
getDropForeignKeySQL
(
$orphanedForeignKey
,
$orphanedForeignKey
->
getLocalTableName
());
}
}
}
}
if
(
$platform
->
supportsSequences
()
==
true
)
{
if
(
$platform
->
supportsSequences
()
==
true
)
{
foreach
(
$this
->
changedSequences
AS
$sequence
)
{
foreach
(
$this
->
changedSequences
as
$sequence
)
{
$sql
[]
=
$platform
->
getAlterSequenceSQL
(
$sequence
);
$sql
[]
=
$platform
->
getAlterSequenceSQL
(
$sequence
);
}
}
if
(
$saveMode
===
false
)
{
if
(
$saveMode
===
false
)
{
foreach
(
$this
->
removedSequences
AS
$sequence
)
{
foreach
(
$this
->
removedSequences
as
$sequence
)
{
$sql
[]
=
$platform
->
getDropSequenceSQL
(
$sequence
);
$sql
[]
=
$platform
->
getDropSequenceSQL
(
$sequence
);
}
}
}
}
foreach
(
$this
->
newSequences
AS
$sequence
)
{
foreach
(
$this
->
newSequences
as
$sequence
)
{
$sql
[]
=
$platform
->
getCreateSequenceSQL
(
$sequence
);
$sql
[]
=
$platform
->
getCreateSequenceSQL
(
$sequence
);
}
}
}
}
$foreignKeySql
=
array
();
$foreignKeySql
=
array
();
foreach
(
$this
->
newTables
AS
$table
)
{
foreach
(
$this
->
newTables
as
$table
)
{
$sql
=
array_merge
(
$sql
=
array_merge
(
$sql
,
$sql
,
$platform
->
getCreateTableSQL
(
$table
,
AbstractPlatform
::
CREATE_INDEXES
)
$platform
->
getCreateTableSQL
(
$table
,
AbstractPlatform
::
CREATE_INDEXES
)
);
);
if
(
$platform
->
supportsForeignKeyConstraints
())
{
if
(
$platform
->
supportsForeignKeyConstraints
())
{
foreach
(
$table
->
getForeignKeys
()
AS
$foreignKey
)
{
foreach
(
$table
->
getForeignKeys
()
as
$foreignKey
)
{
$foreignKeySql
[]
=
$platform
->
getCreateForeignKeySQL
(
$foreignKey
,
$table
);
$foreignKeySql
[]
=
$platform
->
getCreateForeignKeySQL
(
$foreignKey
,
$table
);
}
}
}
}
...
@@ -162,15 +162,15 @@ class SchemaDiff
...
@@ -162,15 +162,15 @@ class SchemaDiff
$sql
=
array_merge
(
$sql
,
$foreignKeySql
);
$sql
=
array_merge
(
$sql
,
$foreignKeySql
);
if
(
$saveMode
===
false
)
{
if
(
$saveMode
===
false
)
{
foreach
(
$this
->
removedTables
AS
$table
)
{
foreach
(
$this
->
removedTables
as
$table
)
{
$sql
[]
=
$platform
->
getDropTableSQL
(
$table
);
$sql
[]
=
$platform
->
getDropTableSQL
(
$table
);
}
}
}
}
foreach
(
$this
->
changedTables
AS
$tableDiff
)
{
foreach
(
$this
->
changedTables
as
$tableDiff
)
{
$sql
=
array_merge
(
$sql
,
$platform
->
getAlterTableSQL
(
$tableDiff
));
$sql
=
array_merge
(
$sql
,
$platform
->
getAlterTableSQL
(
$tableDiff
));
}
}
return
$sql
;
return
$sql
;
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
72465c6f
...
@@ -80,7 +80,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
...
@@ -80,7 +80,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
// fetch primary
// fetch primary
$stmt
=
$this
->
_conn
->
executeQuery
(
"PRAGMA TABLE_INFO ('
$tableName
')"
);
$stmt
=
$this
->
_conn
->
executeQuery
(
"PRAGMA TABLE_INFO ('
$tableName
')"
);
$indexArray
=
$stmt
->
fetchAll
(
\PDO
::
FETCH_ASSOC
);
$indexArray
=
$stmt
->
fetchAll
(
\PDO
::
FETCH_ASSOC
);
foreach
(
$indexArray
AS
$indexColumnRow
)
{
foreach
(
$indexArray
as
$indexColumnRow
)
{
if
(
$indexColumnRow
[
'pk'
]
==
"1"
)
{
if
(
$indexColumnRow
[
'pk'
]
==
"1"
)
{
$indexBuffer
[]
=
array
(
$indexBuffer
[]
=
array
(
'key_name'
=>
'primary'
,
'key_name'
=>
'primary'
,
...
@@ -92,7 +92,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
...
@@ -92,7 +92,7 @@ class SqliteSchemaManager extends AbstractSchemaManager
}
}
// fetch regular indexes
// fetch regular indexes
foreach
(
$tableIndexes
AS
$tableIndex
)
{
foreach
(
$tableIndexes
as
$tableIndex
)
{
// Ignore indexes with reserved names, e.g. autoindexes
// Ignore indexes with reserved names, e.g. autoindexes
if
(
strpos
(
$tableIndex
[
'name'
],
'sqlite_'
)
!==
0
)
{
if
(
strpos
(
$tableIndex
[
'name'
],
'sqlite_'
)
!==
0
)
{
$keyName
=
$tableIndex
[
'name'
];
$keyName
=
$tableIndex
[
'name'
];
...
@@ -187,4 +187,4 @@ class SqliteSchemaManager extends AbstractSchemaManager
...
@@ -187,4 +187,4 @@ class SqliteSchemaManager extends AbstractSchemaManager
{
{
return
new
View
(
$view
[
'name'
],
$view
[
'sql'
]);
return
new
View
(
$view
[
'name'
],
$view
[
'sql'
]);
}
}
}
}
\ No newline at end of file
lib/Doctrine/DBAL/Schema/Table.php
View file @
72465c6f
...
@@ -89,15 +89,15 @@ class Table extends AbstractAsset
...
@@ -89,15 +89,15 @@ class Table extends AbstractAsset
$this
->
_setName
(
$tableName
);
$this
->
_setName
(
$tableName
);
$this
->
_idGeneratorType
=
$idGeneratorType
;
$this
->
_idGeneratorType
=
$idGeneratorType
;
foreach
(
$columns
AS
$column
)
{
foreach
(
$columns
as
$column
)
{
$this
->
_addColumn
(
$column
);
$this
->
_addColumn
(
$column
);
}
}
foreach
(
$indexes
AS
$idx
)
{
foreach
(
$indexes
as
$idx
)
{
$this
->
_addIndex
(
$idx
);
$this
->
_addIndex
(
$idx
);
}
}
foreach
(
$fkConstraints
AS
$constraint
)
{
foreach
(
$fkConstraints
as
$constraint
)
{
$this
->
_addForeignKeyConstraint
(
$constraint
);
$this
->
_addForeignKeyConstraint
(
$constraint
);
}
}
...
@@ -135,7 +135,7 @@ class Table extends AbstractAsset
...
@@ -135,7 +135,7 @@ class Table extends AbstractAsset
{
{
$primaryKey
=
$this
->
_createIndex
(
$columns
,
$indexName
?:
"primary"
,
true
,
true
);
$primaryKey
=
$this
->
_createIndex
(
$columns
,
$indexName
?:
"primary"
,
true
,
true
);
foreach
(
$columns
AS
$columnName
)
{
foreach
(
$columns
as
$columnName
)
{
$column
=
$this
->
getColumn
(
$columnName
);
$column
=
$this
->
getColumn
(
$columnName
);
$column
->
setNotnull
(
true
);
$column
->
setNotnull
(
true
);
}
}
...
@@ -211,7 +211,7 @@ class Table extends AbstractAsset
...
@@ -211,7 +211,7 @@ class Table extends AbstractAsset
*/
*/
public
function
columnsAreIndexed
(
array
$columnsNames
)
public
function
columnsAreIndexed
(
array
$columnsNames
)
{
{
foreach
(
$this
->
getIndexes
()
AS
$index
)
{
foreach
(
$this
->
getIndexes
()
as
$index
)
{
/* @var $index Index */
/* @var $index Index */
if
(
$index
->
spansColumns
(
$columnsNames
))
{
if
(
$index
->
spansColumns
(
$columnsNames
))
{
return
true
;
return
true
;
...
@@ -234,7 +234,7 @@ class Table extends AbstractAsset
...
@@ -234,7 +234,7 @@ class Table extends AbstractAsset
throw
SchemaException
::
indexNameInvalid
(
$indexName
);
throw
SchemaException
::
indexNameInvalid
(
$indexName
);
}
}
foreach
(
$columnNames
AS
$columnName
=>
$indexColOptions
)
{
foreach
(
$columnNames
as
$columnName
=>
$indexColOptions
)
{
if
(
is_numeric
(
$columnName
)
&&
is_string
(
$indexColOptions
))
{
if
(
is_numeric
(
$columnName
)
&&
is_string
(
$indexColOptions
))
{
$columnName
=
$indexColOptions
;
$columnName
=
$indexColOptions
;
}
}
...
@@ -357,7 +357,7 @@ class Table extends AbstractAsset
...
@@ -357,7 +357,7 @@ class Table extends AbstractAsset
if
(
$foreignTable
instanceof
Table
)
{
if
(
$foreignTable
instanceof
Table
)
{
$foreignTableName
=
$foreignTable
->
getName
();
$foreignTableName
=
$foreignTable
->
getName
();
foreach
(
$foreignColumnNames
AS
$columnName
)
{
foreach
(
$foreignColumnNames
as
$columnName
)
{
if
(
!
$foreignTable
->
hasColumn
(
$columnName
))
{
if
(
!
$foreignTable
->
hasColumn
(
$columnName
))
{
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$foreignTable
->
getName
());
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$foreignTable
->
getName
());
}
}
...
@@ -366,7 +366,7 @@ class Table extends AbstractAsset
...
@@ -366,7 +366,7 @@ class Table extends AbstractAsset
$foreignTableName
=
$foreignTable
;
$foreignTableName
=
$foreignTable
;
}
}
foreach
(
$localColumnNames
AS
$columnName
)
{
foreach
(
$localColumnNames
as
$columnName
)
{
if
(
!
$this
->
hasColumn
(
$columnName
))
{
if
(
!
$this
->
hasColumn
(
$columnName
))
{
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$this
->
_name
);
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$this
->
_name
);
}
}
...
@@ -415,7 +415,7 @@ class Table extends AbstractAsset
...
@@ -415,7 +415,7 @@ class Table extends AbstractAsset
protected
function
_addIndex
(
Index
$indexCandidate
)
protected
function
_addIndex
(
Index
$indexCandidate
)
{
{
// check for duplicates
// check for duplicates
foreach
(
$this
->
_indexes
AS
$existingIndex
)
{
foreach
(
$this
->
_indexes
as
$existingIndex
)
{
if
(
$indexCandidate
->
isFullfilledBy
(
$existingIndex
))
{
if
(
$indexCandidate
->
isFullfilledBy
(
$existingIndex
))
{
return
$this
;
return
$this
;
}
}
...
@@ -429,7 +429,7 @@ class Table extends AbstractAsset
...
@@ -429,7 +429,7 @@ class Table extends AbstractAsset
}
}
// remove overruled indexes
// remove overruled indexes
foreach
(
$this
->
_indexes
AS
$idxKey
=>
$existingIndex
)
{
foreach
(
$this
->
_indexes
as
$idxKey
=>
$existingIndex
)
{
if
(
$indexCandidate
->
overrules
(
$existingIndex
))
{
if
(
$indexCandidate
->
overrules
(
$existingIndex
))
{
unset
(
$this
->
_indexes
[
$idxKey
]);
unset
(
$this
->
_indexes
[
$idxKey
]);
}
}
...
@@ -515,7 +515,7 @@ class Table extends AbstractAsset
...
@@ -515,7 +515,7 @@ class Table extends AbstractAsset
if
(
$this
->
hasPrimaryKey
())
{
if
(
$this
->
hasPrimaryKey
())
{
$pkCols
=
$this
->
getPrimaryKey
()
->
getColumns
();
$pkCols
=
$this
->
getPrimaryKey
()
->
getColumns
();
}
}
foreach
(
$this
->
getForeignKeys
()
AS
$fk
)
{
foreach
(
$this
->
getForeignKeys
()
as
$fk
)
{
/* @var $fk ForeignKeyConstraint */
/* @var $fk ForeignKeyConstraint */
$fkCols
=
array_merge
(
$fkCols
,
$fk
->
getColumns
());
$fkCols
=
array_merge
(
$fkCols
,
$fk
->
getColumns
());
}
}
...
@@ -640,15 +640,15 @@ class Table extends AbstractAsset
...
@@ -640,15 +640,15 @@ class Table extends AbstractAsset
{
{
$visitor
->
acceptTable
(
$this
);
$visitor
->
acceptTable
(
$this
);
foreach
(
$this
->
getColumns
()
AS
$column
)
{
foreach
(
$this
->
getColumns
()
as
$column
)
{
$visitor
->
acceptColumn
(
$this
,
$column
);
$visitor
->
acceptColumn
(
$this
,
$column
);
}
}
foreach
(
$this
->
getIndexes
()
AS
$index
)
{
foreach
(
$this
->
getIndexes
()
as
$index
)
{
$visitor
->
acceptIndex
(
$this
,
$index
);
$visitor
->
acceptIndex
(
$this
,
$index
);
}
}
foreach
(
$this
->
getForeignKeys
()
AS
$constraint
)
{
foreach
(
$this
->
getForeignKeys
()
as
$constraint
)
{
$visitor
->
acceptForeignKey
(
$this
,
$constraint
);
$visitor
->
acceptForeignKey
(
$this
,
$constraint
);
}
}
}
}
...
@@ -658,13 +658,13 @@ class Table extends AbstractAsset
...
@@ -658,13 +658,13 @@ class Table extends AbstractAsset
*/
*/
public
function
__clone
()
public
function
__clone
()
{
{
foreach
(
$this
->
_columns
AS
$k
=>
$column
)
{
foreach
(
$this
->
_columns
as
$k
=>
$column
)
{
$this
->
_columns
[
$k
]
=
clone
$column
;
$this
->
_columns
[
$k
]
=
clone
$column
;
}
}
foreach
(
$this
->
_indexes
AS
$k
=>
$index
)
{
foreach
(
$this
->
_indexes
as
$k
=>
$index
)
{
$this
->
_indexes
[
$k
]
=
clone
$index
;
$this
->
_indexes
[
$k
]
=
clone
$index
;
}
}
foreach
(
$this
->
_fkConstraints
AS
$k
=>
$fk
)
{
foreach
(
$this
->
_fkConstraints
as
$k
=>
$fk
)
{
$this
->
_fkConstraints
[
$k
]
=
clone
$fk
;
$this
->
_fkConstraints
[
$k
]
=
clone
$fk
;
$this
->
_fkConstraints
[
$k
]
->
setLocalTable
(
$this
);
$this
->
_fkConstraints
[
$k
]
->
setLocalTable
(
$this
);
}
}
...
...
lib/Doctrine/DBAL/Schema/Visitor/DropSchemaSqlCollector.php
View file @
72465c6f
...
@@ -141,16 +141,16 @@ class DropSchemaSqlCollector implements Visitor
...
@@ -141,16 +141,16 @@ class DropSchemaSqlCollector implements Visitor
public
function
getQueries
()
public
function
getQueries
()
{
{
$sql
=
array
();
$sql
=
array
();
foreach
(
$this
->
constraints
AS
$fkConstraint
)
{
foreach
(
$this
->
constraints
as
$fkConstraint
)
{
$localTable
=
$this
->
constraints
[
$fkConstraint
];
$localTable
=
$this
->
constraints
[
$fkConstraint
];
$sql
[]
=
$this
->
platform
->
getDropForeignKeySQL
(
$fkConstraint
,
$localTable
);
$sql
[]
=
$this
->
platform
->
getDropForeignKeySQL
(
$fkConstraint
,
$localTable
);
}
}
foreach
(
$this
->
sequences
AS
$sequence
)
{
foreach
(
$this
->
sequences
as
$sequence
)
{
$sql
[]
=
$this
->
platform
->
getDropSequenceSQL
(
$sequence
);
$sql
[]
=
$this
->
platform
->
getDropSequenceSQL
(
$sequence
);
}
}
foreach
(
$this
->
tables
AS
$table
)
{
foreach
(
$this
->
tables
as
$table
)
{
$sql
[]
=
$this
->
platform
->
getDropTableSQL
(
$table
);
$sql
[]
=
$this
->
platform
->
getDropTableSQL
(
$table
);
}
}
...
...
lib/Doctrine/DBAL/Tools/Console/Command/ReservedWordsCommand.php
View file @
72465c6f
...
@@ -102,7 +102,7 @@ EOT
...
@@ -102,7 +102,7 @@ EOT
}
}
$keywords
=
array
();
$keywords
=
array
();
foreach
(
$keywordLists
AS
$keywordList
)
{
foreach
(
$keywordLists
as
$keywordList
)
{
if
(
!
isset
(
$this
->
keywordListClasses
[
$keywordList
]))
{
if
(
!
isset
(
$this
->
keywordListClasses
[
$keywordList
]))
{
throw
new
\InvalidArgumentException
(
throw
new
\InvalidArgumentException
(
"There exists no keyword list with name '"
.
$keywordList
.
"'. "
.
"There exists no keyword list with name '"
.
$keywordList
.
"'. "
.
...
@@ -125,7 +125,7 @@ EOT
...
@@ -125,7 +125,7 @@ EOT
$output
->
write
(
"No reserved keywords violations have been found!"
,
true
);
$output
->
write
(
"No reserved keywords violations have been found!"
,
true
);
}
else
{
}
else
{
$output
->
write
(
'There are <error>'
.
count
(
$violations
)
.
'</error> reserved keyword violations in your database schema:'
,
true
);
$output
->
write
(
'There are <error>'
.
count
(
$violations
)
.
'</error> reserved keyword violations in your database schema:'
,
true
);
foreach
(
$violations
AS
$violation
)
{
foreach
(
$violations
as
$violation
)
{
$output
->
write
(
' - '
.
$violation
,
true
);
$output
->
write
(
' - '
.
$violation
,
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