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
e4b18a47
Unverified
Commit
e4b18a47
authored
Dec 10, 2018
by
Sergei Morozov
Committed by
GitHub
Dec 10, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3392 from LukasVitek/fix/Table_createIndex
fixed annotations of parameter $columns in Table
parents
2b8513dc
438b0525
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 @
e4b18a47
...
...
@@ -9,8 +9,6 @@ use const ARRAY_FILTER_USE_KEY;
use
function
array_filter
;
use
function
array_merge
;
use
function
in_array
;
use
function
is_numeric
;
use
function
is_string
;
use
function
preg_match
;
use
function
strlen
;
use
function
strtolower
;
...
...
@@ -100,16 +98,16 @@ class Table extends AbstractAsset
/**
* Sets the Primary Key.
*
* @param
mixed[][] $column
s
* @param
string[] $columnName
s
* @param string|bool $indexName
*
* @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
->
setNotnull
(
true
);
}
...
...
@@ -118,7 +116,7 @@ class Table extends AbstractAsset
}
/**
* @param
mixed[][]
$columnNames
* @param
string[]
$columnNames
* @param string|null $indexName
* @param string[] $flags
* @param mixed[] $options
...
...
@@ -168,7 +166,7 @@ class Table extends AbstractAsset
}
/**
* @param
mixed[][]
$columnNames
* @param
string[]
$columnNames
* @param string|null $indexName
* @param mixed[] $options
*
...
...
@@ -236,15 +234,15 @@ class Table extends AbstractAsset
/**
* Checks if an index begins in the order of the given columns.
*
* @param
mixed[][] $columns
Names
* @param
string[] $column
Names
*
* @return bool
*/
public
function
columnsAreIndexed
(
array
$column
s
Names
)
public
function
columnsAreIndexed
(
array
$columnNames
)
{
foreach
(
$this
->
getIndexes
()
as
$index
)
{
/** @var $index Index */
if
(
$index
->
spansColumns
(
$column
s
Names
))
{
if
(
$index
->
spansColumns
(
$columnNames
))
{
return
true
;
}
}
...
...
@@ -253,7 +251,7 @@ class Table extends AbstractAsset
}
/**
* @param
mixed[]
[] $columnNames
* @param
string
[] $columnNames
* @param string $indexName
* @param bool $isUnique
* @param bool $isPrimary
...
...
@@ -270,11 +268,7 @@ class Table extends AbstractAsset
throw
SchemaException
::
indexNameInvalid
(
$indexName
);
}
foreach
(
$columnNames
as
$columnName
=>
$indexColOptions
)
{
if
(
is_numeric
(
$columnName
)
&&
is_string
(
$indexColOptions
))
{
$columnName
=
$indexColOptions
;
}
foreach
(
$columnNames
as
$columnName
)
{
if
(
!
$this
->
hasColumn
(
$columnName
))
{
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