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
c752fc01
Commit
c752fc01
authored
Jan 12, 2016
by
Bill Schaller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2288 from deeky666/DBAL-1255
Preserve quotation of old column name in ColumnDiff
parents
68558492
d6317d35
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
2 deletions
+37
-2
ColumnDiff.php
lib/Doctrine/DBAL/Schema/ColumnDiff.php
+3
-1
Identifier.php
lib/Doctrine/DBAL/Schema/Identifier.php
+6
-1
ColumnDiffTest.php
tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php
+28
-0
No files found.
lib/Doctrine/DBAL/Schema/ColumnDiff.php
View file @
c752fc01
...
...
@@ -77,6 +77,8 @@ class ColumnDiff
*/
public
function
getOldColumnName
()
{
return
new
Identifier
(
$this
->
oldColumnName
);
$quote
=
$this
->
fromColumn
&&
$this
->
fromColumn
->
isQuoted
();
return
new
Identifier
(
$this
->
oldColumnName
,
$quote
);
}
}
lib/Doctrine/DBAL/Schema/Identifier.php
View file @
c752fc01
...
...
@@ -35,9 +35,14 @@ class Identifier extends AbstractAsset
* Constructor.
*
* @param string $identifier Identifier name to wrap.
* @param bool $quote Whether to force quoting the given identifier.
*/
public
function
__construct
(
$identifier
)
public
function
__construct
(
$identifier
,
$quote
=
false
)
{
$this
->
_setName
(
$identifier
);
if
(
$quote
&&
!
$this
->
_quoted
)
{
$this
->
_setName
(
'"'
.
$this
->
getName
()
.
'"'
);
}
}
}
tests/Doctrine/Tests/DBAL/Schema/ColumnDiffTest.php
0 → 100644
View file @
c752fc01
<?php
namespace
Doctrine\Tests\DBAL\Schema
;
use
Doctrine\DBAL\Schema\Column
;
use
Doctrine\DBAL\Schema\ColumnDiff
;
use
Doctrine\DBAL\Types\Type
;
class
ColumnDiffTest
extends
\PHPUnit_Framework_TestCase
{
/**
* @group DBAL-1255
*/
public
function
testPreservesOldColumnNameQuotation
()
{
$fromColumn
=
new
Column
(
'"foo"'
,
Type
::
getType
(
Type
::
INTEGER
));
$toColumn
=
new
Column
(
'bar'
,
Type
::
getType
(
Type
::
INTEGER
));
$columnDiff
=
new
ColumnDiff
(
'"foo"'
,
$toColumn
,
array
());
$this
->
assertTrue
(
$columnDiff
->
getOldColumnName
()
->
isQuoted
());
$columnDiff
=
new
ColumnDiff
(
'"foo"'
,
$toColumn
,
array
(),
$fromColumn
);
$this
->
assertTrue
(
$columnDiff
->
getOldColumnName
()
->
isQuoted
());
$columnDiff
=
new
ColumnDiff
(
'foo'
,
$toColumn
,
array
(),
$fromColumn
);
$this
->
assertTrue
(
$columnDiff
->
getOldColumnName
()
->
isQuoted
());
}
}
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