Commit 6abba72f authored by jsor's avatar jsor

Rename alter table events

parent b51762cd
...@@ -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 SchemaAlterTableAddedColumnEventArgs extends SchemaEventArgs class SchemaAlterTableAddColumnEventArgs extends SchemaEventArgs
{ {
/** /**
* @var Column * @var Column
......
...@@ -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 SchemaAlterTableChangedColumnEventArgs extends SchemaEventArgs class SchemaAlterTableChangeColumnEventArgs extends SchemaEventArgs
{ {
/** /**
* @var ColumnDiff * @var ColumnDiff
......
...@@ -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 SchemaAlterTableRemovedColumnEventArgs extends SchemaEventArgs class SchemaAlterTableRemoveColumnEventArgs extends SchemaEventArgs
{ {
/** /**
* @var Column * @var Column
......
...@@ -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 SchemaAlterTableRenamedColumnEventArgs extends SchemaEventArgs class SchemaAlterTableRenameColumnEventArgs extends SchemaEventArgs
{ {
/** /**
* @var string * @var string
......
...@@ -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 onSchemaAlterTableAddedColumn = 'onSchemaAlterTableAddedColumn'; const onSchemaAlterTableAddColumn = 'onSchemaAlterTableAddColumn';
const onSchemaAlterTableRemovedColumn = 'onSchemaAlterTableRemovedColumn'; const onSchemaAlterTableRemoveColumn = 'onSchemaAlterTableRemoveColumn';
const onSchemaAlterTableChangedColumn = 'onSchemaAlterTableChangedColumn'; const onSchemaAlterTableChangeColumn = 'onSchemaAlterTableChangeColumn';
const onSchemaAlterTableRenamedColumn = 'onSchemaAlterTableRenamedColumn'; const onSchemaAlterTableRenameColumn = 'onSchemaAlterTableRenameColumn';
const onSchemaColumnDefinition = 'onSchemaColumnDefinition'; const onSchemaColumnDefinition = 'onSchemaColumnDefinition';
} }
...@@ -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\SchemaAlterTableAddedColumnEventArgs, Doctrine\DBAL\Event\SchemaAlterTableAddColumnEventArgs,
Doctrine\DBAL\Event\SchemaAlterTableRemovedColumnEventArgs, Doctrine\DBAL\Event\SchemaAlterTableRemoveColumnEventArgs,
Doctrine\DBAL\Event\SchemaAlterTableChangedColumnEventArgs, Doctrine\DBAL\Event\SchemaAlterTableChangeColumnEventArgs,
Doctrine\DBAL\Event\SchemaAlterTableRenamedColumnEventArgs; 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::onSchemaAlterTableAddedColumn)) { if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaAlterTableAddColumn)) {
$eventArgs = new SchemaAlterTableAddedColumnEventArgs($column, $diff, $this); $eventArgs = new SchemaAlterTableAddColumnEventArgs($column, $diff, $this);
$this->_eventManager->dispatchEvent(Events::onSchemaAlterTableAddedColumn, $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::onSchemaAlterTableRemovedColumn)) { if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaAlterTableRemoveColumn)) {
$eventArgs = new SchemaAlterTableRemovedColumnEventArgs($column, $diff, $this); $eventArgs = new SchemaAlterTableRemoveColumnEventArgs($column, $diff, $this);
$this->_eventManager->dispatchEvent(Events::onSchemaAlterTableRemovedColumn, $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::onSchemaAlterTableChangedColumn)) { if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaAlterTableChangeColumn)) {
$eventArgs = new SchemaAlterTableChangedColumnEventArgs($columnDiff, $diff, $this); $eventArgs = new SchemaAlterTableChangeColumnEventArgs($columnDiff, $diff, $this);
$this->_eventManager->dispatchEvent(Events::onSchemaAlterTableChangedColumn, $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::onSchemaAlterTableRenamedColumn)) { if (null !== $this->_eventManager && $this->_eventManager->hasListeners(Events::onSchemaAlterTableRenameColumn)) {
$eventArgs = new SchemaAlterTableRenamedColumnEventArgs($oldColumnName, $column, $diff, $this); $eventArgs = new SchemaAlterTableRenameColumnEventArgs($oldColumnName, $column, $diff, $this);
$this->_eventManager->dispatchEvent(Events::onSchemaAlterTableRenamedColumn, $eventArgs); $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableRenameColumn, $eventArgs);
$columnSql = array_merge($columnSql, $eventArgs->getSql()); $columnSql = array_merge($columnSql, $eventArgs->getSql());
......
...@@ -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(
'onSchemaAlterTableAddedColumn', 'onSchemaAlterTableAddColumn',
'onSchemaAlterTableRemovedColumn', 'onSchemaAlterTableRemoveColumn',
'onSchemaAlterTableChangedColumn', 'onSchemaAlterTableChangeColumn',
'onSchemaAlterTableRenamedColumn' 'onSchemaAlterTableRenameColumn'
); );
$listenerMock = $this->getMock('GetAlterTableSqlDispatchEvenListener', $events); $listenerMock = $this->getMock('GetAlterTableSqlDispatchEvenListener', $events);
$listenerMock $listenerMock
->expects($this->once()) ->expects($this->once())
->method('onSchemaAlterTableAddedColumn'); ->method('onSchemaAlterTableAddColumn');
$listenerMock $listenerMock
->expects($this->once()) ->expects($this->once())
->method('onSchemaAlterTableRemovedColumn'); ->method('onSchemaAlterTableRemoveColumn');
$listenerMock $listenerMock
->expects($this->once()) ->expects($this->once())
->method('onSchemaAlterTableChangedColumn'); ->method('onSchemaAlterTableChangeColumn');
$listenerMock $listenerMock
->expects($this->once()) ->expects($this->once())
->method('onSchemaAlterTableRenamedColumn'); ->method('onSchemaAlterTableRenameColumn');
$eventManager = new EventManager(); $eventManager = new EventManager();
$events = array( $events = array(
Events::onSchemaAlterTableAddedColumn, Events::onSchemaAlterTableAddColumn,
Events::onSchemaAlterTableRemovedColumn, Events::onSchemaAlterTableRemoveColumn,
Events::onSchemaAlterTableChangedColumn, Events::onSchemaAlterTableChangeColumn,
Events::onSchemaAlterTableRenamedColumn Events::onSchemaAlterTableRenameColumn
); );
$eventManager->addEventListener($events, $listenerMock); $eventManager->addEventListener($events, $listenerMock);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment