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
Hide 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
*
* 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
*/
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
}
/**
* @param string $
tableN
ame
* @param string $
n
ame
*
* @return Table
*/
public
function
listTableDetails
(
$
tableN
ame
)
public
function
listTableDetails
(
$
n
ame
)
{
$columns
=
$this
->
listTableColumns
(
$
tableN
ame
);
$columns
=
$this
->
listTableColumns
(
$
n
ame
);
$foreignKeys
=
[];
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
/**
* 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
*/
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
/**
* Creates a new Column.
*
* @param string $
columnN
ame
* @param string $
n
ame
* @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
->
setOptions
(
$options
);
}
...
...
lib/Doctrine/DBAL/Schema/DB2SchemaManager.php
View file @
1a0226d2
...
...
@@ -222,13 +222,13 @@ class DB2SchemaManager extends AbstractSchemaManager
/**
* {@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
;
assert
(
$platform
instanceof
DB2Platform
);
$sql
=
$platform
->
getListTableCommentsSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableCommentsSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/Index.php
View file @
1a0226d2
...
...
@@ -47,18 +47,18 @@ class Index extends AbstractAsset implements Constraint
private
$options
=
[];
/**
* @param string $
indexN
ame
* @param string $
n
ame
* @param string[] $columns
* @param bool $isUnique
* @param bool $isPrimary
* @param string[] $flags
* @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
;
$this
->
_setName
(
$
indexN
ame
);
$this
->
_setName
(
$
n
ame
);
$this
->
_isUnique
=
$isUnique
;
$this
->
_isPrimary
=
$isPrimary
;
$this
->
options
=
$options
;
...
...
@@ -156,17 +156,17 @@ class Index extends AbstractAsset implements Constraint
}
/**
* @param string $
columnN
ame
* @param string $
n
ame
* @param int $pos
*
* @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
());
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
/**
* {@inheritdoc}
*/
public
function
listTableDetails
(
$
tableN
ame
)
public
function
listTableDetails
(
$
n
ame
)
{
$table
=
parent
::
listTableDetails
(
$
tableN
ame
);
$table
=
parent
::
listTableDetails
(
$
n
ame
);
$platform
=
$this
->
_platform
;
assert
(
$platform
instanceof
MySqlPlatform
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
View file @
1a0226d2
...
...
@@ -400,13 +400,13 @@ SQL;
/**
* {@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
;
assert
(
$platform
instanceof
OraclePlatform
);
$sql
=
$platform
->
getListTableCommentsSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableCommentsSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/PostgreSqlSchemaManager.php
View file @
1a0226d2
...
...
@@ -506,13 +506,13 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
/**
* {@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
;
assert
(
$platform
instanceof
PostgreSqlPlatform
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/SQLServerSchemaManager.php
View file @
1a0226d2
...
...
@@ -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
;
assert
(
$platform
instanceof
SQLServerPlatform
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
tableN
ame
);
$sql
=
$platform
->
getListTableMetadataSQL
(
$
n
ame
);
$tableOptions
=
$this
->
_conn
->
fetchAssoc
(
$sql
);
...
...
lib/Doctrine/DBAL/Schema/Schema.php
View file @
1a0226d2
...
...
@@ -165,20 +165,20 @@ class Schema extends AbstractAsset
}
/**
* @param string $
tableN
ame
* @param string $
n
ame
*
* @return Table
*
* @throws SchemaException
*/
public
function
getTable
(
$
tableN
ame
)
public
function
getTable
(
$
n
ame
)
{
$
tableName
=
$this
->
getFullQualifiedAssetName
(
$tableN
ame
);
if
(
!
isset
(
$this
->
_tables
[
$
tableN
ame
]))
{
throw
SchemaException
::
tableDoesNotExist
(
$
tableN
ame
);
$
name
=
$this
->
getFullQualifiedAssetName
(
$n
ame
);
if
(
!
isset
(
$this
->
_tables
[
$
n
ame
]))
{
throw
SchemaException
::
tableDoesNotExist
(
$
n
ame
);
}
return
$this
->
_tables
[
$
tableN
ame
];
return
$this
->
_tables
[
$
n
ame
];
}
/**
...
...
@@ -216,29 +216,29 @@ class Schema extends AbstractAsset
/**
* Does this schema have a namespace with the given name?
*
* @param string $name
spaceName
* @param string $name
*
* @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?
*
* @param string $
tableN
ame
* @param string $
n
ame
*
* @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
/**
* 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.
*
* @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
]))
{
throw
SchemaException
::
namespaceAlreadyExists
(
$unquotedName
spaceName
);
if
(
isset
(
$this
->
namespaces
[
$unquotedName
]))
{
throw
SchemaException
::
namespaceAlreadyExists
(
$unquotedName
);
}
$this
->
namespaces
[
$unquotedName
spaceName
]
=
$namespaceN
ame
;
$this
->
namespaces
[
$unquotedName
]
=
$n
ame
;
return
$this
;
}
...
...
@@ -313,17 +313,17 @@ class Schema extends AbstractAsset
/**
* Creates a new table.
*
* @param string $
tableN
ame
* @param string $
n
ame
*
* @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
);
foreach
(
$this
->
_schemaConfig
->
getDefaultTableOptions
()
as
$
name
=>
$value
)
{
$table
->
addOption
(
$
name
,
$value
);
foreach
(
$this
->
_schemaConfig
->
getDefaultTableOptions
()
as
$
option
=>
$value
)
{
$table
->
addOption
(
$
option
,
$value
);
}
return
$table
;
...
...
@@ -332,17 +332,17 @@ class Schema extends AbstractAsset
/**
* Renames a table.
*
* @param string $old
Table
Name
* @param string $new
Table
Name
* @param string $oldName
* @param string $newName
*
* @return Schema
*/
public
function
renameTable
(
$old
TableName
,
$newTable
Name
)
public
function
renameTable
(
$old
Name
,
$new
Name
)
{
$table
=
$this
->
getTable
(
$old
Table
Name
);
$table
->
_setName
(
$new
Table
Name
);
$table
=
$this
->
getTable
(
$oldName
);
$table
->
_setName
(
$newName
);
$this
->
dropTable
(
$old
Table
Name
);
$this
->
dropTable
(
$oldName
);
$this
->
_addTable
(
$table
);
return
$this
;
...
...
@@ -351,15 +351,15 @@ class Schema extends AbstractAsset
/**
* Drops a table from the schema.
*
* @param string $
tableN
ame
* @param string $
n
ame
*
* @return Schema
*/
public
function
dropTable
(
$
tableN
ame
)
public
function
dropTable
(
$
n
ame
)
{
$
tableName
=
$this
->
getFullQualifiedAssetName
(
$tableN
ame
);
$this
->
getTable
(
$
tableN
ame
);
unset
(
$this
->
_tables
[
$
tableN
ame
]);
$
name
=
$this
->
getFullQualifiedAssetName
(
$n
ame
);
$this
->
getTable
(
$
n
ame
);
unset
(
$this
->
_tables
[
$
n
ame
]);
return
$this
;
}
...
...
lib/Doctrine/DBAL/Schema/SqliteSchemaManager.php
View file @
1a0226d2
...
...
@@ -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
)
{
$table
->
addOption
(
'comment'
,
$comment
);
...
...
lib/Doctrine/DBAL/Schema/Table.php
View file @
1a0226d2
...
...
@@ -44,7 +44,7 @@ class Table extends AbstractAsset
protected
$_schemaConfig
=
null
;
/**
* @param string $
tableN
ame
* @param string $
n
ame
* @param Column[] $columns
* @param Index[] $indexes
* @param ForeignKeyConstraint[] $fkConstraints
...
...
@@ -53,13 +53,13 @@ class Table extends AbstractAsset
*
* @throws DBALException
*/
public
function
__construct
(
$
tableN
ame
,
array
$columns
=
[],
array
$indexes
=
[],
array
$fkConstraints
=
[],
$idGeneratorType
=
0
,
array
$options
=
[])
public
function
__construct
(
$
n
ame
,
array
$columns
=
[],
array
$indexes
=
[],
array
$fkConstraints
=
[],
$idGeneratorType
=
0
,
array
$options
=
[])
{
if
(
strlen
(
$
tableN
ame
)
===
0
)
{
throw
DBALException
::
invalidTableName
(
$
tableN
ame
);
if
(
strlen
(
$
n
ame
)
===
0
)
{
throw
DBALException
::
invalidTableName
(
$
n
ame
);
}
$this
->
_setName
(
$
tableN
ame
);
$this
->
_setName
(
$
n
ame
);
foreach
(
$columns
as
$column
)
{
$this
->
_addColumn
(
$column
);
...
...
@@ -151,20 +151,20 @@ class Table extends AbstractAsset
/**
* Drops an index from this table.
*
* @param string $
indexN
ame The index name.
* @param string $
n
ame The index name.
*
* @return void
*
* @throws SchemaException If the index does not exist.
*/
public
function
dropIndex
(
$
indexN
ame
)
public
function
dropIndex
(
$
n
ame
)
{
$
indexName
=
$this
->
normalizeIdentifier
(
$indexN
ame
);
if
(
!
$this
->
hasIndex
(
$
indexN
ame
))
{
throw
SchemaException
::
indexDoesNotExist
(
$
indexN
ame
,
$this
->
_name
);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
if
(
!
$this
->
hasIndex
(
$
n
ame
))
{
throw
SchemaException
::
indexDoesNotExist
(
$
n
ame
,
$this
->
_name
);
}
unset
(
$this
->
_indexes
[
$
indexN
ame
]);
unset
(
$this
->
_indexes
[
$
n
ame
]);
}
/**
...
...
@@ -190,8 +190,8 @@ class Table extends AbstractAsset
/**
* Renames an index.
*
* @param string $old
Index
Name The name of the index to rename from.
* @param string|null $new
Index
Name The name of the index to rename to.
* @param string $oldName The name of the index to rename from.
* @param string|null $newName The name of the index to rename to.
* If null is given, the index name will be auto-generated.
*
* @return self This table instance.
...
...
@@ -199,38 +199,38 @@ class Table extends AbstractAsset
* @throws SchemaException If no index exists for the given current name
* or if an index with the given new name already exists on this table.
*/
public
function
renameIndex
(
$old
IndexName
,
$newIndex
Name
=
null
)
public
function
renameIndex
(
$old
Name
,
$new
Name
=
null
)
{
$old
IndexName
=
$this
->
normalizeIdentifier
(
$oldIndex
Name
);
$normalizedNew
IndexName
=
$this
->
normalizeIdentifier
(
$newIndex
Name
);
$old
Name
=
$this
->
normalizeIdentifier
(
$old
Name
);
$normalizedNew
Name
=
$this
->
normalizeIdentifier
(
$new
Name
);
if
(
$old
IndexName
===
$normalizedNewIndex
Name
)
{
if
(
$old
Name
===
$normalizedNew
Name
)
{
return
$this
;
}
if
(
!
$this
->
hasIndex
(
$old
Index
Name
))
{
throw
SchemaException
::
indexDoesNotExist
(
$old
Index
Name
,
$this
->
_name
);
if
(
!
$this
->
hasIndex
(
$oldName
))
{
throw
SchemaException
::
indexDoesNotExist
(
$oldName
,
$this
->
_name
);
}
if
(
$this
->
hasIndex
(
$normalizedNew
Index
Name
))
{
throw
SchemaException
::
indexAlreadyExists
(
$normalizedNew
Index
Name
,
$this
->
_name
);
if
(
$this
->
hasIndex
(
$normalizedNewName
))
{
throw
SchemaException
::
indexAlreadyExists
(
$normalizedNewName
,
$this
->
_name
);
}
$oldIndex
=
$this
->
_indexes
[
$old
Index
Name
];
$oldIndex
=
$this
->
_indexes
[
$oldName
];
if
(
$oldIndex
->
isPrimary
())
{
$this
->
dropPrimaryKey
();
return
$this
->
setPrimaryKey
(
$oldIndex
->
getColumns
(),
$new
Index
Name
??
false
);
return
$this
->
setPrimaryKey
(
$oldIndex
->
getColumns
(),
$newName
??
false
);
}
unset
(
$this
->
_indexes
[
$old
Index
Name
]);
unset
(
$this
->
_indexes
[
$oldName
]);
if
(
$oldIndex
->
isUnique
())
{
return
$this
->
addUniqueIndex
(
$oldIndex
->
getColumns
(),
$new
Index
Name
,
$oldIndex
->
getOptions
());
return
$this
->
addUniqueIndex
(
$oldIndex
->
getColumns
(),
$newName
,
$oldIndex
->
getOptions
());
}
return
$this
->
addIndex
(
$oldIndex
->
getColumns
(),
$new
Index
Name
,
$oldIndex
->
getFlags
(),
$oldIndex
->
getOptions
());
return
$this
->
addIndex
(
$oldIndex
->
getColumns
(),
$newName
,
$oldIndex
->
getFlags
(),
$oldIndex
->
getOptions
());
}
/**
...
...
@@ -279,15 +279,15 @@ class Table extends AbstractAsset
}
/**
* @param string $
columnN
ame
* @param string $
n
ame
* @param string $typeName
* @param mixed[] $options
*
* @return Column
*/
public
function
addColumn
(
$
columnN
ame
,
$typeName
,
array
$options
=
[])
public
function
addColumn
(
$
n
ame
,
$typeName
,
array
$options
=
[])
{
$column
=
new
Column
(
$
columnN
ame
,
Type
::
getType
(
$typeName
),
$options
);
$column
=
new
Column
(
$
n
ame
,
Type
::
getType
(
$typeName
),
$options
);
$this
->
_addColumn
(
$column
);
...
...
@@ -299,14 +299,14 @@ class Table extends AbstractAsset
*
* @deprecated
*
* @param string $old
Column
Name
* @param string $n
ewColumnN
ame
* @param string $oldName
* @param string $name
*
* @return void
*
* @throws DBALException
*/
public
function
renameColumn
(
$old
ColumnName
,
$newColumnN
ame
)
public
function
renameColumn
(
$old
Name
,
$n
ame
)
{
throw
new
DBALException
(
'Table#renameColumn() was removed, because it drops and recreates '
.
'the column instead. There is no fix available, because a schema diff cannot reliably detect if a '
.
...
...
@@ -316,14 +316,14 @@ class Table extends AbstractAsset
/**
* Change Column Details.
*
* @param string $
columnN
ame
* @param string $
n
ame
* @param mixed[] $options
*
* @return self
*/
public
function
changeColumn
(
$
columnN
ame
,
array
$options
)
public
function
changeColumn
(
$
n
ame
,
array
$options
)
{
$column
=
$this
->
getColumn
(
$
columnN
ame
);
$column
=
$this
->
getColumn
(
$
n
ame
);
$column
->
setOptions
(
$options
);
return
$this
;
...
...
@@ -332,14 +332,14 @@ class Table extends AbstractAsset
/**
* Drops a Column from the Table.
*
* @param string $
columnN
ame
* @param string $
n
ame
*
* @return self
*/
public
function
dropColumn
(
$
columnN
ame
)
public
function
dropColumn
(
$
n
ame
)
{
$
columnName
=
$this
->
normalizeIdentifier
(
$columnN
ame
);
unset
(
$this
->
_columns
[
$
columnN
ame
]);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
unset
(
$this
->
_columns
[
$
n
ame
]);
return
$this
;
}
...
...
@@ -541,53 +541,53 @@ class Table extends AbstractAsset
/**
* Returns whether this table has a foreign key constraint with the given name.
*
* @param string $
constraintN
ame
* @param string $
n
ame
*
* @return bool
*/
public
function
hasForeignKey
(
$
constraintN
ame
)
public
function
hasForeignKey
(
$
n
ame
)
{
$
constraintName
=
$this
->
normalizeIdentifier
(
$constraintN
ame
);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
return
isset
(
$this
->
_fkConstraints
[
$
constraintN
ame
]);
return
isset
(
$this
->
_fkConstraints
[
$
n
ame
]);
}
/**
* Returns the foreign key constraint with the given name.
*
* @param string $
constraintN
ame The constraint name.
* @param string $
n
ame The constraint name.
*
* @return ForeignKeyConstraint
*
* @throws SchemaException If the foreign key does not exist.
*/
public
function
getForeignKey
(
$
constraintN
ame
)
public
function
getForeignKey
(
$
n
ame
)
{
$
constraintName
=
$this
->
normalizeIdentifier
(
$constraintN
ame
);
if
(
!
$this
->
hasForeignKey
(
$
constraintN
ame
))
{
throw
SchemaException
::
foreignKeyDoesNotExist
(
$
constraintN
ame
,
$this
->
_name
);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
if
(
!
$this
->
hasForeignKey
(
$
n
ame
))
{
throw
SchemaException
::
foreignKeyDoesNotExist
(
$
n
ame
,
$this
->
_name
);
}
return
$this
->
_fkConstraints
[
$
constraintN
ame
];
return
$this
->
_fkConstraints
[
$
n
ame
];
}
/**
* Removes the foreign key constraint with the given name.
*
* @param string $
constraintN
ame The constraint name.
* @param string $
n
ame The constraint name.
*
* @return void
*
* @throws SchemaException
*/
public
function
removeForeignKey
(
$
constraintN
ame
)
public
function
removeForeignKey
(
$
n
ame
)
{
$
constraintName
=
$this
->
normalizeIdentifier
(
$constraintN
ame
);
if
(
!
$this
->
hasForeignKey
(
$
constraintN
ame
))
{
throw
SchemaException
::
foreignKeyDoesNotExist
(
$
constraintN
ame
,
$this
->
_name
);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
if
(
!
$this
->
hasForeignKey
(
$
n
ame
))
{
throw
SchemaException
::
foreignKeyDoesNotExist
(
$
n
ame
,
$this
->
_name
);
}
unset
(
$this
->
_fkConstraints
[
$
constraintN
ame
]);
unset
(
$this
->
_fkConstraints
[
$
n
ame
]);
}
/**
...
...
@@ -639,34 +639,34 @@ class Table extends AbstractAsset
/**
* Returns whether this table has a Column with the given name.
*
* @param string $
columnN
ame The column name.
* @param string $
n
ame The column name.
*
* @return bool
*/
public
function
hasColumn
(
$
columnN
ame
)
public
function
hasColumn
(
$
n
ame
)
{
$
columnName
=
$this
->
normalizeIdentifier
(
$columnN
ame
);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
return
isset
(
$this
->
_columns
[
$
columnN
ame
]);
return
isset
(
$this
->
_columns
[
$
n
ame
]);
}
/**
* Returns the Column with the given name.
*
* @param string $
columnN
ame The column name.
* @param string $
n
ame The column name.
*
* @return Column
*
* @throws SchemaException If the column does not exist.
*/
public
function
getColumn
(
$
columnN
ame
)
public
function
getColumn
(
$
n
ame
)
{
$
columnName
=
$this
->
normalizeIdentifier
(
$columnN
ame
);
if
(
!
$this
->
hasColumn
(
$
columnN
ame
))
{
throw
SchemaException
::
columnDoesNotExist
(
$
columnN
ame
,
$this
->
_name
);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
if
(
!
$this
->
hasColumn
(
$
n
ame
))
{
throw
SchemaException
::
columnDoesNotExist
(
$
n
ame
,
$this
->
_name
);
}
return
$this
->
_columns
[
$
columnN
ame
];
return
$this
->
_columns
[
$
n
ame
];
}
/**
...
...
@@ -714,34 +714,34 @@ class Table extends AbstractAsset
/**
* Returns whether this table has an Index with the given name.
*
* @param string $
indexN
ame The index name.
* @param string $
n
ame The index name.
*
* @return bool
*/
public
function
hasIndex
(
$
indexN
ame
)
public
function
hasIndex
(
$
n
ame
)
{
$
indexName
=
$this
->
normalizeIdentifier
(
$indexN
ame
);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
return
isset
(
$this
->
_indexes
[
$
indexN
ame
]);
return
isset
(
$this
->
_indexes
[
$
n
ame
]);
}
/**
* Returns the Index with the given name.
*
* @param string $
indexN
ame The index name.
* @param string $
n
ame The index name.
*
* @return Index
*
* @throws SchemaException If the index does not exist.
*/
public
function
getIndex
(
$
indexN
ame
)
public
function
getIndex
(
$
n
ame
)
{
$
indexName
=
$this
->
normalizeIdentifier
(
$indexN
ame
);
if
(
!
$this
->
hasIndex
(
$
indexN
ame
))
{
throw
SchemaException
::
indexDoesNotExist
(
$
indexN
ame
,
$this
->
_name
);
$
name
=
$this
->
normalizeIdentifier
(
$n
ame
);
if
(
!
$this
->
hasIndex
(
$
n
ame
))
{
throw
SchemaException
::
indexDoesNotExist
(
$
n
ame
,
$this
->
_name
);
}
return
$this
->
_indexes
[
$
indexN
ame
];
return
$this
->
_indexes
[
$
n
ame
];
}
/**
...
...
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