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
b84603b9
Unverified
Commit
b84603b9
authored
Dec 06, 2018
by
Lukas Vitek
Committed by
Sergei Morozov
Dec 10, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed annotation and name of parameter $columnsNames in Table
parent
5d4f9335
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
22 deletions
+16
-22
Table.php
lib/Doctrine/DBAL/Schema/Table.php
+16
-22
No files found.
lib/Doctrine/DBAL/Schema/Table.php
View file @
b84603b9
...
@@ -9,8 +9,6 @@ use const ARRAY_FILTER_USE_KEY;
...
@@ -9,8 +9,6 @@ use const ARRAY_FILTER_USE_KEY;
use
function
array_filter
;
use
function
array_filter
;
use
function
array_merge
;
use
function
array_merge
;
use
function
in_array
;
use
function
in_array
;
use
function
is_numeric
;
use
function
is_string
;
use
function
preg_match
;
use
function
preg_match
;
use
function
strlen
;
use
function
strlen
;
use
function
strtolower
;
use
function
strtolower
;
...
@@ -100,16 +98,16 @@ class Table extends AbstractAsset
...
@@ -100,16 +98,16 @@ class Table extends AbstractAsset
/**
/**
* Sets the Primary Key.
* Sets the Primary Key.
*
*
* @param
mixed[][] $column
s
* @param
string[] $columnName
s
* @param string|bool $indexName
* @param string|bool $indexName
*
*
* @return self
* @return self
*/
*/
public
function
setPrimaryKey
(
array
$columns
,
$indexName
=
false
)
public
function
setPrimaryKey
(
array
$column
Name
s
,
$indexName
=
false
)
{
{
$this
->
_addIndex
(
$this
->
_createIndex
(
$columns
,
$indexName
?:
'primary'
,
true
,
true
));
$this
->
_addIndex
(
$this
->
_createIndex
(
$column
Name
s
,
$indexName
?:
'primary'
,
true
,
true
));
foreach
(
$columns
as
$columnName
)
{
foreach
(
$column
Name
s
as
$columnName
)
{
$column
=
$this
->
getColumn
(
$columnName
);
$column
=
$this
->
getColumn
(
$columnName
);
$column
->
setNotnull
(
true
);
$column
->
setNotnull
(
true
);
}
}
...
@@ -118,7 +116,7 @@ class Table extends AbstractAsset
...
@@ -118,7 +116,7 @@ class Table extends AbstractAsset
}
}
/**
/**
* @param
mixed[][]
$columnNames
* @param
string[]
$columnNames
* @param string|null $indexName
* @param string|null $indexName
* @param string[] $flags
* @param string[] $flags
* @param mixed[] $options
* @param mixed[] $options
...
@@ -168,7 +166,7 @@ class Table extends AbstractAsset
...
@@ -168,7 +166,7 @@ class Table extends AbstractAsset
}
}
/**
/**
* @param
mixed[][]
$columnNames
* @param
string[]
$columnNames
* @param string|null $indexName
* @param string|null $indexName
* @param mixed[] $options
* @param mixed[] $options
*
*
...
@@ -236,15 +234,15 @@ class Table extends AbstractAsset
...
@@ -236,15 +234,15 @@ class Table extends AbstractAsset
/**
/**
* Checks if an index begins in the order of the given columns.
* Checks if an index begins in the order of the given columns.
*
*
* @param
mixed[][] $columns
Names
* @param
string[] $column
Names
*
*
* @return bool
* @return bool
*/
*/
public
function
columnsAreIndexed
(
array
$column
s
Names
)
public
function
columnsAreIndexed
(
array
$columnNames
)
{
{
foreach
(
$this
->
getIndexes
()
as
$index
)
{
foreach
(
$this
->
getIndexes
()
as
$index
)
{
/** @var $index Index */
/** @var $index Index */
if
(
$index
->
spansColumns
(
$column
s
Names
))
{
if
(
$index
->
spansColumns
(
$columnNames
))
{
return
true
;
return
true
;
}
}
}
}
...
@@ -253,7 +251,7 @@ class Table extends AbstractAsset
...
@@ -253,7 +251,7 @@ class Table extends AbstractAsset
}
}
/**
/**
* @param
mixed[]
[] $columnNames
* @param
string
[] $columnNames
* @param string $indexName
* @param string $indexName
* @param bool $isUnique
* @param bool $isUnique
* @param bool $isPrimary
* @param bool $isPrimary
...
@@ -270,11 +268,7 @@ class Table extends AbstractAsset
...
@@ -270,11 +268,7 @@ class Table extends AbstractAsset
throw
SchemaException
::
indexNameInvalid
(
$indexName
);
throw
SchemaException
::
indexNameInvalid
(
$indexName
);
}
}
foreach
(
$columnNames
as
$columnName
=>
$indexColOptions
)
{
foreach
(
$columnNames
as
$columnName
)
{
if
(
is_numeric
(
$columnName
)
&&
is_string
(
$indexColOptions
))
{
$columnName
=
$indexColOptions
;
}
if
(
!
$this
->
hasColumn
(
$columnName
))
{
if
(
!
$this
->
hasColumn
(
$columnName
))
{
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$this
->
_name
);
throw
SchemaException
::
columnDoesNotExist
(
$columnName
,
$this
->
_name
);
}
}
...
...
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