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
1a0226d2
Unverified
Commit
1a0226d2
authored
Jul 17, 2020
by
Sergei Morozov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace $thingyName arguments with $name where "thingy" is clear from the context
parent
c890d041
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
155 additions
and
155 deletions
+155
-155
AbstractSchemaManager.php
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
+13
-13
Column.php
lib/Doctrine/DBAL/Schema/Column.php
+3
-3
DB2SchemaManager.php
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
+3
-3
Index.php
lib/Doctrine/DBAL/Schema/Index.php
+7
-7
MySqlSchemaManager.php
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
+3
-3
OracleSchemaManager.php
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
+3
-3
PostgreSqlSchemaManager.php
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
+3
-3
SQLServerSchemaManager.php
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
+4
-4
Schema.php
lib/Doctrine/DBAL/Schema/Schema.php
+36
-36
SqliteSchemaManager.php
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
+5
-5
Table.php
lib/Doctrine/DBAL/Schema/Table.php
+75
-75
No files found.
lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
View file @
1a0226d2
...
@@ -192,15 +192,15 @@ abstract class AbstractSchemaManager
...
@@ -192,15 +192,15 @@ abstract class AbstractSchemaManager
*
*
* The usage of a string $tableNames is deprecated. Pass a one-element array instead.
* The usage of a string $tableNames is deprecated. Pass a one-element array instead.
*
*
* @param string|string[] $
tableN
ames
* @param string|string[] $
n
ames
*
*
* @return bool
* @return bool
*/
*/
public
function
tablesExist
(
$
tableN
ames
)
public
function
tablesExist
(
$
n
ames
)
{
{
$
tableNames
=
array_map
(
'strtolower'
,
(
array
)
$tableN
ames
);
$
names
=
array_map
(
'strtolower'
,
(
array
)
$n
ames
);
return
count
(
$
tableNames
)
===
count
(
array_intersect
(
$tableN
ames
,
array_map
(
'strtolower'
,
$this
->
listTableNames
())));
return
count
(
$
names
)
===
count
(
array_intersect
(
$n
ames
,
array_map
(
'strtolower'
,
$this
->
listTableNames
())));
}
}
/**
/**
...
@@ -264,21 +264,21 @@ abstract class AbstractSchemaManager
...
@@ -264,21 +264,21 @@ abstract class AbstractSchemaManager
}
}
/**
/**
* @param string $
tableN
ame
* @param string $
n
ame
*
*
* @return Table
* @return Table
*/
*/
public
function
listTableDetails
(
$
tableN
ame
)
public
function
listTableDetails
(
$
n
ame
)
{
{
$columns
=
$this
->
listTableColumns
(
$
tableN
ame
);
$columns
=
$this
->
listTableColumns
(
$
n
ame
);
$foreignKeys
=
[];
$foreignKeys
=
[];
if
(
$this
->
_platform
->
supportsForeignKeyConstraints
())
{
if
(
$this
->
_platform
->
supportsForeignKeyConstraints
())
{
$foreignKeys
=
$this
->
listTableForeignKeys
(
$
tableN
ame
);
$foreignKeys
=
$this
->
listTableForeignKeys
(
$
n
ame
);
}
}
$indexes
=
$this
->
listTableIndexes
(
$
tableN
ame
);
$indexes
=
$this
->
listTableIndexes
(
$
n
ame
);
return
new
Table
(
$
tableN
ame
,
$columns
,
$indexes
,
$foreignKeys
);
return
new
Table
(
$
n
ame
,
$columns
,
$indexes
,
$foreignKeys
);
}
}
/**
/**
...
@@ -334,13 +334,13 @@ abstract class AbstractSchemaManager
...
@@ -334,13 +334,13 @@ abstract class AbstractSchemaManager
/**
/**
* Drops the given table.
* Drops the given table.
*
*
* @param string $
tableN
ame The name of the table to drop.
* @param string $
n
ame The name of the table to drop.
*
*
* @return void
* @return void
*/
*/
public
function
dropTable
(
$
tableN
ame
)
public
function
dropTable
(
$
n
ame
)
{
{
$this
->
_execSql
(
$this
->
_platform
->
getDropTableSQL
(
$
tableN
ame
));
$this
->
_execSql
(
$this
->
_platform
->
getDropTableSQL
(
$
n
ame
));
}
}
/**
/**
...
...
lib/Doctrine/DBAL/Schema/Column.php
View file @
1a0226d2
...
@@ -59,12 +59,12 @@ class Column extends AbstractAsset
...
@@ -59,12 +59,12 @@ class Column extends AbstractAsset
/**
/**
* Creates a new Column.
* Creates a new Column.
*
*
* @param string $
columnN
ame
* @param string $
n
ame
* @param mixed[] $options
* @param mixed[] $options
*/
*/
public
function
__construct
(
$
columnN
ame
,
Type
$type
,
array
$options
=
[])
public
function
__construct
(
$
n
ame
,
Type
$type
,
array
$options
=
[])
{
{
$this
->
_setName
(
$
columnN
ame
);
$this
->
_setName
(
$
n
ame
);
$this
->
setType
(
$type
);
$this
->
setType
(
$type
);
$this
->
setOptions
(
$options
);
$this
->
setOptions
(
$options
);
}
}
...
...
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
View file @
1a0226d2
...
@@ -222,13 +222,13 @@ class DB2SchemaManager extends AbstractSchemaManager
...
@@ -222,13 +222,13 @@ class DB2SchemaManager extends AbstractSchemaManager
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
listTableDetails
(
$
tableN
ame
)
:
Table
public
function
listTableDetails
(
$
n
ame
)
:
Table
{
{
$table
=
parent
::
listTableDetails
(
$
tableN
ame
);
$table
=
parent
::
listTableDetails
(
$
n
ame
);
$platform
=
$this
->
_platform
;
$platform
=
$this
->
_platform
;
assert
(
$platform
instanceof
DB2Platform
);
assert
(
$platform
instanceof
DB2Platform
);
$sql
=
$platform
->
getListTableCommentsSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableCommentsSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/Index.php
View file @
1a0226d2
...
@@ -47,18 +47,18 @@ class Index extends AbstractAsset implements Constraint
...
@@ -47,18 +47,18 @@ class Index extends AbstractAsset implements Constraint
private
$options
=
[];
private
$options
=
[];
/**
/**
* @param string $
indexN
ame
* @param string $
n
ame
* @param string[] $columns
* @param string[] $columns
* @param bool $isUnique
* @param bool $isUnique
* @param bool $isPrimary
* @param bool $isPrimary
* @param string[] $flags
* @param string[] $flags
* @param mixed[] $options
* @param mixed[] $options
*/
*/
public
function
__construct
(
$
indexN
ame
,
array
$columns
,
$isUnique
=
false
,
$isPrimary
=
false
,
array
$flags
=
[],
array
$options
=
[])
public
function
__construct
(
$
n
ame
,
array
$columns
,
$isUnique
=
false
,
$isPrimary
=
false
,
array
$flags
=
[],
array
$options
=
[])
{
{
$isUnique
=
$isUnique
||
$isPrimary
;
$isUnique
=
$isUnique
||
$isPrimary
;
$this
->
_setName
(
$
indexN
ame
);
$this
->
_setName
(
$
n
ame
);
$this
->
_isUnique
=
$isUnique
;
$this
->
_isUnique
=
$isUnique
;
$this
->
_isPrimary
=
$isPrimary
;
$this
->
_isPrimary
=
$isPrimary
;
$this
->
options
=
$options
;
$this
->
options
=
$options
;
...
@@ -156,17 +156,17 @@ class Index extends AbstractAsset implements Constraint
...
@@ -156,17 +156,17 @@ class Index extends AbstractAsset implements Constraint
}
}
/**
/**
* @param string $
columnN
ame
* @param string $
n
ame
* @param int $pos
* @param int $pos
*
*
* @return bool
* @return bool
*/
*/
public
function
hasColumnAtPosition
(
$
columnN
ame
,
$pos
=
0
)
public
function
hasColumnAtPosition
(
$
n
ame
,
$pos
=
0
)
{
{
$
columnName
=
$this
->
trimQuotes
(
strtolower
(
$columnN
ame
));
$
name
=
$this
->
trimQuotes
(
strtolower
(
$n
ame
));
$indexColumns
=
array_map
(
'strtolower'
,
$this
->
getUnquotedColumns
());
$indexColumns
=
array_map
(
'strtolower'
,
$this
->
getUnquotedColumns
());
return
array_search
(
$
columnN
ame
,
$indexColumns
)
===
$pos
;
return
array_search
(
$
n
ame
,
$indexColumns
)
===
$pos
;
}
}
/**
/**
...
...
lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
View file @
1a0226d2
...
@@ -320,13 +320,13 @@ class MySqlSchemaManager extends AbstractSchemaManager
...
@@ -320,13 +320,13 @@ class MySqlSchemaManager extends AbstractSchemaManager
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
listTableDetails
(
$
tableN
ame
)
public
function
listTableDetails
(
$
n
ame
)
{
{
$table
=
parent
::
listTableDetails
(
$
tableN
ame
);
$table
=
parent
::
listTableDetails
(
$
n
ame
);
$platform
=
$this
->
_platform
;
$platform
=
$this
->
_platform
;
assert
(
$platform
instanceof
MySqlPlatform
);
assert
(
$platform
instanceof
MySqlPlatform
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
1a0226d2
...
@@ -400,13 +400,13 @@ SQL;
...
@@ -400,13 +400,13 @@ SQL;
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
listTableDetails
(
$
tableN
ame
)
:
Table
public
function
listTableDetails
(
$
n
ame
)
:
Table
{
{
$table
=
parent
::
listTableDetails
(
$
tableN
ame
);
$table
=
parent
::
listTableDetails
(
$
n
ame
);
$platform
=
$this
->
_platform
;
$platform
=
$this
->
_platform
;
assert
(
$platform
instanceof
OraclePlatform
);
assert
(
$platform
instanceof
OraclePlatform
);
$sql
=
$platform
->
getListTableCommentsSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableCommentsSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
1a0226d2
...
@@ -506,13 +506,13 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
...
@@ -506,13 +506,13 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
public
function
listTableDetails
(
$
tableN
ame
)
:
Table
public
function
listTableDetails
(
$
n
ame
)
:
Table
{
{
$table
=
parent
::
listTableDetails
(
$
tableN
ame
);
$table
=
parent
::
listTableDetails
(
$
n
ame
);
$platform
=
$this
->
_platform
;
$platform
=
$this
->
_platform
;
assert
(
$platform
instanceof
PostgreSqlPlatform
);
assert
(
$platform
instanceof
PostgreSqlPlatform
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
1a0226d2
...
@@ -331,15 +331,15 @@ class SQLServerSchemaManager extends AbstractSchemaManager
...
@@ -331,15 +331,15 @@ class SQLServerSchemaManager extends AbstractSchemaManager
}
}
/**
/**
* @param string $
tableN
ame
* @param string $
n
ame
*/
*/
public
function
listTableDetails
(
$
tableN
ame
)
:
Table
public
function
listTableDetails
(
$
n
ame
)
:
Table
{
{
$table
=
parent
::
listTableDetails
(
$
tableN
ame
);
$table
=
parent
::
listTableDetails
(
$
n
ame
);
$platform
=
$this
->
_platform
;
$platform
=
$this
->
_platform
;
assert
(
$platform
instanceof
SQLServerPlatform
);
assert
(
$platform
instanceof
SQLServerPlatform
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/Schema.php
View file @
1a0226d2
...
@@ -165,20 +165,20 @@ class Schema extends AbstractAsset
...
@@ -165,20 +165,20 @@ class Schema extends AbstractAsset
}
}
/**
/**
* @param string $
tableN
ame
* @param string $
n
ame
*
*
* @return Table
* @return Table
*
*
* @throws SchemaException
* @throws SchemaException
*/
*/
public
function
getTable
(
$
tableN
ame
)
public
function
getTable
(
$
n
ame
)
{
{
$
tableName
=
$this
->
getFullQualifiedAssetName
(
$tableN
ame
);
$
name
=
$this
->
getFullQualifiedAssetName
(
$n
ame
);
if
(
!
isset
(
$this
->
_tables
[
$
tableN
ame
]))
{
if
(
!
isset
(
$this
->
_tables
[
$
n
ame
]))
{
throw
SchemaException
::
tableDoesNotExist
(
$
tableN
ame
);
throw
SchemaException
::
tableDoesNotExist
(
$
n
ame
);
}
}
return
$this
->
_tables
[
$
tableN
ame
];
return
$this
->
_tables
[
$
n
ame
];
}
}
/**
/**
...
@@ -216,29 +216,29 @@ class Schema extends AbstractAsset
...
@@ -216,29 +216,29 @@ class Schema extends AbstractAsset
/**
/**
* Does this schema have a namespace with the given name?
* Does this schema have a namespace with the given name?
*
*
* @param string $name
spaceName
* @param string $name
*
*
* @return bool
* @return bool
*/
*/
public
function
hasNamespace
(
$name
spaceName
)
public
function
hasNamespace
(
$name
)
{
{
$name
spaceName
=
strtolower
(
$this
->
getUnquotedAssetName
(
$namespaceN
ame
));
$name
=
strtolower
(
$this
->
getUnquotedAssetName
(
$n
ame
));
return
isset
(
$this
->
namespaces
[
$name
spaceName
]);
return
isset
(
$this
->
namespaces
[
$name
]);
}
}
/**
/**
* Does this schema have a table with the given name?
* Does this schema have a table with the given name?
*
*
* @param string $
tableN
ame
* @param string $
n
ame
*
*
* @return bool
* @return bool
*/
*/
public
function
hasTable
(
$
tableN
ame
)
public
function
hasTable
(
$
n
ame
)
{
{
$
tableName
=
$this
->
getFullQualifiedAssetName
(
$tableN
ame
);
$
name
=
$this
->
getFullQualifiedAssetName
(
$n
ame
);
return
isset
(
$this
->
_tables
[
$
tableN
ame
]);
return
isset
(
$this
->
_tables
[
$
n
ame
]);
}
}
/**
/**
...
@@ -291,21 +291,21 @@ class Schema extends AbstractAsset
...
@@ -291,21 +291,21 @@ class Schema extends AbstractAsset
/**
/**
* Creates a new namespace.
* Creates a new namespace.
*
*
* @param string $name
spaceName
The name of the namespace to create.
* @param string $name The name of the namespace to create.
*
*
* @return Schema This schema instance.
* @return Schema This schema instance.
*
*
* @throws SchemaException
* @throws SchemaException
*/
*/
public
function
createNamespace
(
$name
spaceName
)
public
function
createNamespace
(
$name
)
{
{
$unquotedName
spaceName
=
strtolower
(
$this
->
getUnquotedAssetName
(
$namespaceN
ame
));
$unquotedName
=
strtolower
(
$this
->
getUnquotedAssetName
(
$n
ame
));
if
(
isset
(
$this
->
namespaces
[
$unquotedName
spaceName
]))
{
if
(
isset
(
$this
->
namespaces
[
$unquotedName
]))
{
throw
SchemaException
::
namespaceAlreadyExists
(
$unquotedName
spaceName
);
throw
SchemaException
::
namespaceAlreadyExists
(
$unquotedName
);
}
}
$this
->
namespaces
[
$unquotedName
spaceName
]
=
$namespaceN
ame
;
$this
->
namespaces
[
$unquotedName
]
=
$n
ame
;
return
$this
;
return
$this
;
}
}
...
@@ -313,17 +313,17 @@ class Schema extends AbstractAsset
...
@@ -313,17 +313,17 @@ class Schema extends AbstractAsset
/**
/**
* Creates a new table.
* Creates a new table.
*
*
* @param string $
tableN
ame
* @param string $
n
ame
*
*
* @return Table
* @return Table
*/
*/
public
function
createTable
(
$
tableN
ame
)
public
function
createTable
(
$
n
ame
)
{
{
$table
=
new
Table
(
$
tableN
ame
);
$table
=
new
Table
(
$
n
ame
);
$this
->
_addTable
(
$table
);
$this
->
_addTable
(
$table
);
foreach
(
$this
->
_schemaConfig
->
getDefaultTableOptions
()
as
$
name
=>
$value
)
{
foreach
(
$this
->
_schemaConfig
->
getDefaultTableOptions
()
as
$
option
=>
$value
)
{
$table
->
addOption
(
$
name
,
$value
);
$table
->
addOption
(
$
option
,
$value
);
}
}
return
$table
;
return
$table
;
...
@@ -332,17 +332,17 @@ class Schema extends AbstractAsset
...
@@ -332,17 +332,17 @@ class Schema extends AbstractAsset
/**
/**
* Renames a table.
* Renames a table.
*
*
* @param string $old
Table
Name
* @param string $oldName
* @param string $new
Table
Name
* @param string $newName
*
*
* @return Schema
* @return Schema
*/
*/
public
function
renameTable
(
$old
TableName
,
$newTable
Name
)
public
function
renameTable
(
$old
Name
,
$new
Name
)
{
{
$table
=
$this
->
getTable
(
$old
Table
Name
);
$table
=
$this
->
getTable
(
$oldName
);
$table
->
_setName
(
$new
Table
Name
);
$table
->
_setName
(
$newName
);
$this
->
dropTable
(
$old
Table
Name
);
$this
->
dropTable
(
$oldName
);
$this
->
_addTable
(
$table
);
$this
->
_addTable
(
$table
);
return
$this
;
return
$this
;
...
@@ -351,15 +351,15 @@ class Schema extends AbstractAsset
...
@@ -351,15 +351,15 @@ class Schema extends AbstractAsset
/**
/**
* Drops a table from the schema.
* Drops a table from the schema.
*
*
* @param string $
tableN
ame
* @param string $
n
ame
*
*
* @return Schema
* @return Schema
*/
*/
public
function
dropTable
(
$
tableN
ame
)
public
function
dropTable
(
$
n
ame
)
{
{
$
tableName
=
$this
->
getFullQualifiedAssetName
(
$tableN
ame
);
$
name
=
$this
->
getFullQualifiedAssetName
(
$n
ame
);
$this
->
getTable
(
$
tableN
ame
);
$this
->
getTable
(
$
n
ame
);
unset
(
$this
->
_tables
[
$
tableN
ame
]);
unset
(
$this
->
_tables
[
$
n
ame
]);
return
$this
;
return
$this
;
}
}
...
...
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
1a0226d2
...
@@ -537,15 +537,15 @@ SQL
...
@@ -537,15 +537,15 @@ SQL
}
}
/**
/**
* @param string $
tableN
ame
* @param string $
n
ame
*/
*/
public
function
listTableDetails
(
$
tableN
ame
)
:
Table
public
function
listTableDetails
(
$
n
ame
)
:
Table
{
{
$table
=
parent
::
listTableDetails
(
$
tableN
ame
);
$table
=
parent
::
listTableDetails
(
$
n
ame
);
$tableCreateSql
=
$this
->
getCreateTableSQL
(
$
tableN
ame
)
??
''
;
$tableCreateSql
=
$this
->
getCreateTableSQL
(
$
n
ame
)
??
''
;
$comment
=
$this
->
parseTableCommentFromSQL
(
$
tableN
ame
,
$tableCreateSql
);
$comment
=
$this
->
parseTableCommentFromSQL
(
$
n
ame
,
$tableCreateSql
);
if
(
$comment
!==
null
)
{
if
(
$comment
!==
null
)
{
$table
->
addOption
(
'comment'
,
$comment
);
$table
->
addOption
(
'comment'
,
$comment
);
...
...
lib/Doctrine/DBAL/Schema/Table.php
View file @
1a0226d2
This diff is collapsed.
Click to expand it.
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