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
76c0ac22
Unverified
Commit
76c0ac22
authored
Jun 21, 2017
by
Guilherme Blanco
Committed by
Sergei Morozov
Nov 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixing rebase with master
parent
64c15257
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
20 deletions
+13
-20
Table.php
lib/Doctrine/DBAL/Schema/Table.php
+12
-19
MysqliConnectionTest.php
...octrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php
+1
-1
No files found.
lib/Doctrine/DBAL/Schema/Table.php
View file @
76c0ac22
...
...
@@ -5,16 +5,16 @@ namespace Doctrine\DBAL\Schema;
use
Doctrine\DBAL\DBALException
;
use
Doctrine\DBAL\Schema\Visitor\Visitor
;
use
Doctrine\DBAL\Types\Type
;
use
const
ARRAY_FILTER_USE_KEY
;
use
function
array_filter
;
use
function
array_keys
;
use
function
array_merge
;
use
function
array_search
;
use
function
array_unique
;
use
function
in_array
;
use
function
is_string
;
use
function
preg_match
;
use
function
strlen
;
use
function
strtolower
;
use
function
uksort
;
/**
* Object Representation of a table.
...
...
@@ -559,13 +559,14 @@ class Table extends AbstractAsset
*/
public
function
getColumns
()
{
$pkCols
=
[];
$fkCols
=
[];
$columns
=
$this
->
_columns
;
$pkCols
=
[];
$fkCols
=
[];
$primaryKey
=
$this
->
getPrimaryKey
();
if
(
$primaryKey
!==
null
)
{
$pkCols
=
$
this
->
filterColumns
(
$primaryKey
->
getColumns
()
);
$pkCols
=
$
primaryKey
->
getColumns
(
);
}
foreach
(
$this
->
getForeignKeys
()
as
$fk
)
{
...
...
@@ -573,21 +574,13 @@ class Table extends AbstractAsset
$fkCols
=
array_merge
(
$fkCols
,
$fk
->
getColumns
());
}
return
array_unique
(
array_merge
(
$pkCols
,
$fkCols
,
array_keys
(
$this
->
_columns
)));
}
$colNames
=
array_unique
(
array_merge
(
$pkCols
,
$fkCols
,
array_keys
(
$columns
)));
/**
* Returns only columns that have specified names
*
* @param string[] $columnNames
*
* @return Column[]
*/
private
function
filterColumns
(
array
$columnNames
)
{
return
array_filter
(
$this
->
_columns
,
static
function
(
$columnName
)
use
(
$columnNames
)
{
return
in_array
(
$columnName
,
$columnNames
,
true
);
},
ARRAY_FILTER_USE_KEY
);
uksort
(
$columns
,
static
function
(
$a
,
$b
)
use
(
$colNames
)
{
return
array_search
(
$a
,
$colNames
)
>=
array_search
(
$b
,
$colNames
);
});
return
$columns
;
}
/**
...
...
tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php
View file @
76c0ac22
...
...
@@ -53,7 +53,7 @@ class MysqliConnectionTest extends DbalFunctionalTestCase
new
MysqliConnection
([
'host'
=>
'255.255.255.255'
],
'user'
,
'pass'
);
self
::
fail
(
'An exception was supposed to be raised'
);
}
catch
(
MysqliException
$e
)
{
self
::
assertSame
(
'Network is unreachable'
,
$e
->
getMessage
());
// Do nothing
}
self
::
assertSame
(
$handler
,
set_error_handler
(
$default_handler
),
'Restoring error handler failed.'
);
...
...
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