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
07de0dd8
Commit
07de0dd8
authored
Jun 11, 2010
by
beberlei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added additional Autoincrement state variable, preparing to remove it from platformOptions
parent
ce5b0569
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
Column.php
lib/Doctrine/DBAL/Schema/Column.php
+17
-2
Comparator.php
lib/Doctrine/DBAL/Schema/Comparator.php
+4
-0
ColumnTest.php
tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
+1
-0
ComparatorTest.php
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
+11
-0
No files found.
lib/Doctrine/DBAL/Schema/Column.php
View file @
07de0dd8
<?php
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...
...
@@ -75,6 +73,11 @@ class Column extends AbstractAsset
*/
protected
$_default
=
null
;
/**
* @var bool
*/
protected
$_autoincrement
=
false
;
/**
* @var array
*/
...
...
@@ -302,6 +305,17 @@ class Column extends AbstractAsset
return
$this
->
_columnDefinition
;
}
public
function
getAutoincrement
()
{
return
$this
->
_autoincrement
;
}
public
function
setAutoincrement
(
$flag
)
{
$this
->
_autoincrement
=
(
bool
)
$flag
;
return
$this
;
}
/**
* @param Visitor $visitor
*/
...
...
@@ -325,6 +339,7 @@ class Column extends AbstractAsset
'scale'
=>
$this
->
_scale
,
'fixed'
=>
$this
->
_fixed
,
'unsigned'
=>
$this
->
_unsigned
,
'autoincrement'
=>
$this
->
_autoincrement
,
'columnDefinition'
=>
$this
->
_columnDefinition
,
),
$this
->
_platformOptions
);
}
...
...
lib/Doctrine/DBAL/Schema/Comparator.php
View file @
07de0dd8
...
...
@@ -325,6 +325,10 @@ class Comparator
}
}
if
(
$column1
->
getAutoincrement
()
!=
$column2
->
getAutoincrement
())
{
$changedProperties
[]
=
'autoincrement'
;
}
foreach
(
$column1
->
getPlatformOptions
()
AS
$optionName
=>
$optionValue
)
{
if
(
!
$column2
->
hasPlatformOption
(
$optionName
)
||
$optionValue
!=
$column2
->
getPlatformOption
(
$optionName
))
{
$changedProperties
[]
=
$optionName
;
...
...
tests/Doctrine/Tests/DBAL/Schema/ColumnTest.php
View file @
07de0dd8
...
...
@@ -44,6 +44,7 @@ class ColumnTest extends \PHPUnit_Framework_TestCase
'scale'
=>
2
,
'fixed'
=>
true
,
'unsigned'
=>
true
,
'autoincrement'
=>
false
,
'columnDefinition'
=>
null
,
'foo'
=>
'bar'
,
);
...
...
tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
View file @
07de0dd8
...
...
@@ -111,6 +111,17 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$this
->
assertEquals
(
$expected
,
Comparator
::
compareSchemas
(
$schema1
,
$schema2
)
);
}
public
function
testCompareOnlyAutoincrementChanged
()
{
$column1
=
new
Column
(
'foo'
,
Type
::
getType
(
'integer'
),
array
(
'autoincrement'
=>
true
));
$column2
=
new
Column
(
'foo'
,
Type
::
getType
(
'integer'
),
array
(
'autoincrement'
=>
false
));
$comparator
=
new
Comparator
();
$changedProperties
=
$comparator
->
diffColumn
(
$column1
,
$column2
);
$this
->
assertEquals
(
array
(
'autoincrement'
),
$changedProperties
);
}
public
function
testCompareMissingField
()
{
$missingColumn
=
new
Column
(
'integerfield1'
,
Type
::
getType
(
'integer'
));
...
...
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