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
6abba72f
Commit
6abba72f
authored
Dec 09, 2011
by
jsor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename alter table events
parent
b51762cd
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
36 deletions
+36
-36
SchemaAlterTableAddColumnEventArgs.php
...octrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
+1
-1
SchemaAlterTableChangeColumnEventArgs.php
...rine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php
+1
-1
SchemaAlterTableRemoveColumnEventArgs.php
...rine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php
+1
-1
SchemaAlterTableRenameColumnEventArgs.php
...rine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php
+1
-1
Events.php
lib/Doctrine/DBAL/Events.php
+4
-4
PostgreSqlPlatform.php
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
+16
-16
AbstractPlatformTestCase.php
...octrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
+12
-12
No files found.
lib/Doctrine/DBAL/Event/SchemaAlterTableAdd
ed
ColumnEventArgs.php
→
lib/Doctrine/DBAL/Event/SchemaAlterTableAddColumnEventArgs.php
View file @
6abba72f
...
@@ -35,7 +35,7 @@ use Doctrine\Common\EventArgs,
...
@@ -35,7 +35,7 @@ use Doctrine\Common\EventArgs,
* @version $Revision$
* @version $Revision$
* @author Jan Sorgalla <jsorgalla@googlemail.com>
* @author Jan Sorgalla <jsorgalla@googlemail.com>
*/
*/
class
SchemaAlterTableAdd
ed
ColumnEventArgs
extends
SchemaEventArgs
class
SchemaAlterTableAddColumnEventArgs
extends
SchemaEventArgs
{
{
/**
/**
* @var Column
* @var Column
...
...
lib/Doctrine/DBAL/Event/SchemaAlterTableChange
d
ColumnEventArgs.php
→
lib/Doctrine/DBAL/Event/SchemaAlterTableChangeColumnEventArgs.php
View file @
6abba72f
...
@@ -35,7 +35,7 @@ use Doctrine\Common\EventArgs,
...
@@ -35,7 +35,7 @@ use Doctrine\Common\EventArgs,
* @version $Revision$
* @version $Revision$
* @author Jan Sorgalla <jsorgalla@googlemail.com>
* @author Jan Sorgalla <jsorgalla@googlemail.com>
*/
*/
class
SchemaAlterTableChange
d
ColumnEventArgs
extends
SchemaEventArgs
class
SchemaAlterTableChangeColumnEventArgs
extends
SchemaEventArgs
{
{
/**
/**
* @var ColumnDiff
* @var ColumnDiff
...
...
lib/Doctrine/DBAL/Event/SchemaAlterTableRemove
d
ColumnEventArgs.php
→
lib/Doctrine/DBAL/Event/SchemaAlterTableRemoveColumnEventArgs.php
View file @
6abba72f
...
@@ -35,7 +35,7 @@ use Doctrine\Common\EventArgs,
...
@@ -35,7 +35,7 @@ use Doctrine\Common\EventArgs,
* @version $Revision$
* @version $Revision$
* @author Jan Sorgalla <jsorgalla@googlemail.com>
* @author Jan Sorgalla <jsorgalla@googlemail.com>
*/
*/
class
SchemaAlterTableRemove
d
ColumnEventArgs
extends
SchemaEventArgs
class
SchemaAlterTableRemoveColumnEventArgs
extends
SchemaEventArgs
{
{
/**
/**
* @var Column
* @var Column
...
...
lib/Doctrine/DBAL/Event/SchemaAlterTableRename
d
ColumnEventArgs.php
→
lib/Doctrine/DBAL/Event/SchemaAlterTableRenameColumnEventArgs.php
View file @
6abba72f
...
@@ -35,7 +35,7 @@ use Doctrine\Common\EventArgs,
...
@@ -35,7 +35,7 @@ use Doctrine\Common\EventArgs,
* @version $Revision$
* @version $Revision$
* @author Jan Sorgalla <jsorgalla@googlemail.com>
* @author Jan Sorgalla <jsorgalla@googlemail.com>
*/
*/
class
SchemaAlterTableRename
d
ColumnEventArgs
extends
SchemaEventArgs
class
SchemaAlterTableRenameColumnEventArgs
extends
SchemaEventArgs
{
{
/**
/**
* @var string
* @var string
...
...
lib/Doctrine/DBAL/Events.php
View file @
6abba72f
...
@@ -38,9 +38,9 @@ final class Events
...
@@ -38,9 +38,9 @@ final class Events
const
onSchemaCreateTable
=
'onSchemaCreateTable'
;
const
onSchemaCreateTable
=
'onSchemaCreateTable'
;
const
onSchemaCreateTableColumn
=
'onSchemaCreateTableColumn'
;
const
onSchemaCreateTableColumn
=
'onSchemaCreateTableColumn'
;
const
onSchemaDropTable
=
'onSchemaDropTable'
;
const
onSchemaDropTable
=
'onSchemaDropTable'
;
const
onSchemaAlterTableAdd
edColumn
=
'onSchemaAlterTableAdde
dColumn'
;
const
onSchemaAlterTableAdd
Column
=
'onSchemaAlterTableAd
dColumn'
;
const
onSchemaAlterTableRemove
dColumn
=
'onSchemaAlterTableRemoved
Column'
;
const
onSchemaAlterTableRemove
Column
=
'onSchemaAlterTableRemove
Column'
;
const
onSchemaAlterTableChange
dColumn
=
'onSchemaAlterTableChanged
Column'
;
const
onSchemaAlterTableChange
Column
=
'onSchemaAlterTableChange
Column'
;
const
onSchemaAlterTableRename
dColumn
=
'onSchemaAlterTableRenamed
Column'
;
const
onSchemaAlterTableRename
Column
=
'onSchemaAlterTableRename
Column'
;
const
onSchemaColumnDefinition
=
'onSchemaColumnDefinition'
;
const
onSchemaColumnDefinition
=
'onSchemaColumnDefinition'
;
}
}
lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
View file @
6abba72f
...
@@ -22,10 +22,10 @@ namespace Doctrine\DBAL\Platforms;
...
@@ -22,10 +22,10 @@ namespace Doctrine\DBAL\Platforms;
use
Doctrine\DBAL\Schema\TableDiff
,
use
Doctrine\DBAL\Schema\TableDiff
,
Doctrine\DBAL\Schema\Table
,
Doctrine\DBAL\Schema\Table
,
Doctrine\DBAL\Events
,
Doctrine\DBAL\Events
,
Doctrine\DBAL\Event\SchemaAlterTableAdd
ed
ColumnEventArgs
,
Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs
,
Doctrine\DBAL\Event\SchemaAlterTableRemove
d
ColumnEventArgs
,
Doctrine\DBAL\Event\SchemaAlterTableRemoveColumnEventArgs
,
Doctrine\DBAL\Event\SchemaAlterTableChange
d
ColumnEventArgs
,
Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs
,
Doctrine\DBAL\Event\SchemaAlterTableRename
d
ColumnEventArgs
;
Doctrine\DBAL\Event\SchemaAlterTableRenameColumnEventArgs
;
/**
/**
* PostgreSqlPlatform.
* PostgreSqlPlatform.
...
@@ -388,9 +388,9 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -388,9 +388,9 @@ class PostgreSqlPlatform extends AbstractPlatform
$columnSql
=
array
();
$columnSql
=
array
();
foreach
(
$diff
->
addedColumns
as
$column
)
{
foreach
(
$diff
->
addedColumns
as
$column
)
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaAlterTableAdd
ed
Column
))
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaAlterTableAddColumn
))
{
$eventArgs
=
new
SchemaAlterTableAdd
ed
ColumnEventArgs
(
$column
,
$diff
,
$this
);
$eventArgs
=
new
SchemaAlterTableAddColumnEventArgs
(
$column
,
$diff
,
$this
);
$this
->
_eventManager
->
dispatchEvent
(
Events
::
onSchemaAlterTableAdd
ed
Column
,
$eventArgs
);
$this
->
_eventManager
->
dispatchEvent
(
Events
::
onSchemaAlterTableAddColumn
,
$eventArgs
);
$columnSql
=
array_merge
(
$columnSql
,
$eventArgs
->
getSql
());
$columnSql
=
array_merge
(
$columnSql
,
$eventArgs
->
getSql
());
...
@@ -407,9 +407,9 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -407,9 +407,9 @@ class PostgreSqlPlatform extends AbstractPlatform
}
}
foreach
(
$diff
->
removedColumns
as
$column
)
{
foreach
(
$diff
->
removedColumns
as
$column
)
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaAlterTableRemove
d
Column
))
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaAlterTableRemoveColumn
))
{
$eventArgs
=
new
SchemaAlterTableRemove
d
ColumnEventArgs
(
$column
,
$diff
,
$this
);
$eventArgs
=
new
SchemaAlterTableRemoveColumnEventArgs
(
$column
,
$diff
,
$this
);
$this
->
_eventManager
->
dispatchEvent
(
Events
::
onSchemaAlterTableRemove
d
Column
,
$eventArgs
);
$this
->
_eventManager
->
dispatchEvent
(
Events
::
onSchemaAlterTableRemoveColumn
,
$eventArgs
);
$columnSql
=
array_merge
(
$columnSql
,
$eventArgs
->
getSql
());
$columnSql
=
array_merge
(
$columnSql
,
$eventArgs
->
getSql
());
...
@@ -423,9 +423,9 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -423,9 +423,9 @@ class PostgreSqlPlatform extends AbstractPlatform
}
}
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
foreach
(
$diff
->
changedColumns
AS
$columnDiff
)
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaAlterTableChange
d
Column
))
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaAlterTableChangeColumn
))
{
$eventArgs
=
new
SchemaAlterTableChange
d
ColumnEventArgs
(
$columnDiff
,
$diff
,
$this
);
$eventArgs
=
new
SchemaAlterTableChangeColumnEventArgs
(
$columnDiff
,
$diff
,
$this
);
$this
->
_eventManager
->
dispatchEvent
(
Events
::
onSchemaAlterTableChange
d
Column
,
$eventArgs
);
$this
->
_eventManager
->
dispatchEvent
(
Events
::
onSchemaAlterTableChangeColumn
,
$eventArgs
);
$columnSql
=
array_merge
(
$columnSql
,
$eventArgs
->
getSql
());
$columnSql
=
array_merge
(
$columnSql
,
$eventArgs
->
getSql
());
...
@@ -473,9 +473,9 @@ class PostgreSqlPlatform extends AbstractPlatform
...
@@ -473,9 +473,9 @@ class PostgreSqlPlatform extends AbstractPlatform
}
}
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
foreach
(
$diff
->
renamedColumns
as
$oldColumnName
=>
$column
)
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaAlterTableRename
d
Column
))
{
if
(
null
!==
$this
->
_eventManager
&&
$this
->
_eventManager
->
hasListeners
(
Events
::
onSchemaAlterTableRenameColumn
))
{
$eventArgs
=
new
SchemaAlterTableRename
d
ColumnEventArgs
(
$oldColumnName
,
$column
,
$diff
,
$this
);
$eventArgs
=
new
SchemaAlterTableRenameColumnEventArgs
(
$oldColumnName
,
$column
,
$diff
,
$this
);
$this
->
_eventManager
->
dispatchEvent
(
Events
::
onSchemaAlterTableRename
d
Column
,
$eventArgs
);
$this
->
_eventManager
->
dispatchEvent
(
Events
::
onSchemaAlterTableRenameColumn
,
$eventArgs
);
$columnSql
=
array_merge
(
$columnSql
,
$eventArgs
->
getSql
());
$columnSql
=
array_merge
(
$columnSql
,
$eventArgs
->
getSql
());
...
...
tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php
View file @
6abba72f
...
@@ -219,32 +219,32 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
...
@@ -219,32 +219,32 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
public
function
testGetAlterTableSqlDispatchEvent
()
public
function
testGetAlterTableSqlDispatchEvent
()
{
{
$events
=
array
(
$events
=
array
(
'onSchemaAlterTableAdd
ed
Column'
,
'onSchemaAlterTableAddColumn'
,
'onSchemaAlterTableRemove
d
Column'
,
'onSchemaAlterTableRemoveColumn'
,
'onSchemaAlterTableChange
d
Column'
,
'onSchemaAlterTableChangeColumn'
,
'onSchemaAlterTableRename
d
Column'
'onSchemaAlterTableRenameColumn'
);
);
$listenerMock
=
$this
->
getMock
(
'GetAlterTableSqlDispatchEvenListener'
,
$events
);
$listenerMock
=
$this
->
getMock
(
'GetAlterTableSqlDispatchEvenListener'
,
$events
);
$listenerMock
$listenerMock
->
expects
(
$this
->
once
())
->
expects
(
$this
->
once
())
->
method
(
'onSchemaAlterTableAdd
ed
Column'
);
->
method
(
'onSchemaAlterTableAddColumn'
);
$listenerMock
$listenerMock
->
expects
(
$this
->
once
())
->
expects
(
$this
->
once
())
->
method
(
'onSchemaAlterTableRemove
d
Column'
);
->
method
(
'onSchemaAlterTableRemoveColumn'
);
$listenerMock
$listenerMock
->
expects
(
$this
->
once
())
->
expects
(
$this
->
once
())
->
method
(
'onSchemaAlterTableChange
d
Column'
);
->
method
(
'onSchemaAlterTableChangeColumn'
);
$listenerMock
$listenerMock
->
expects
(
$this
->
once
())
->
expects
(
$this
->
once
())
->
method
(
'onSchemaAlterTableRename
d
Column'
);
->
method
(
'onSchemaAlterTableRenameColumn'
);
$eventManager
=
new
EventManager
();
$eventManager
=
new
EventManager
();
$events
=
array
(
$events
=
array
(
Events
::
onSchemaAlterTableAdd
ed
Column
,
Events
::
onSchemaAlterTableAddColumn
,
Events
::
onSchemaAlterTableRemove
d
Column
,
Events
::
onSchemaAlterTableRemoveColumn
,
Events
::
onSchemaAlterTableChange
d
Column
,
Events
::
onSchemaAlterTableChangeColumn
,
Events
::
onSchemaAlterTableRename
d
Column
Events
::
onSchemaAlterTableRenameColumn
);
);
$eventManager
->
addEventListener
(
$events
,
$listenerMock
);
$eventManager
->
addEventListener
(
$events
,
$listenerMock
);
...
...
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