Commit 5eea9913 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Started refactoring Schema and SchemaDiff Visitors.

parent 65806f59
...@@ -24,12 +24,10 @@ use \Doctrine\DBAL\Platforms\AbstractPlatform; ...@@ -24,12 +24,10 @@ use \Doctrine\DBAL\Platforms\AbstractPlatform;
/** /**
* Schema Diff * Schema Diff
* *
*
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved. * @copyright Copyright (C) 2005-2009 eZ Systems AS. All rights reserved.
* @license http://ez.no/licenses/new_bsd New BSD License * @license http://ez.no/licenses/new_bsd New BSD License
* @since 2.0 * @since 2.0
* @version $Revision$
* @author Benjamin Eberlei <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
*/ */
class SchemaDiff class SchemaDiff
......
<?php
/*
* 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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\DBAL\Schema\Visitor;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Column;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Constraint;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Index;
/**
* Abstract Visitor with empty methods for easy extension.
*/
class AbstractVisitor implements Visitor
{
/**
* @param Schema $schema
*/
public function acceptSchema(Schema $schema)
{
}
/**
* @param Table $table
*/
public function acceptTable(Table $table)
{
}
/**
* @param Column $column
*/
public function acceptColumn(Table $table, Column $column)
{
}
/**
* @param Table $localTable
* @param ForeignKeyConstraint $fkConstraint
*/
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
}
/**
* @param Table $table
* @param Index $index
*/
public function acceptIndex(Table $table, Index $index)
{
}
/**
* @param Sequence $sequence
*/
public function acceptSequence(Sequence $sequence)
{
}
}
<?php <?php
/* /*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...@@ -24,49 +22,39 @@ namespace Doctrine\DBAL\Schema\Visitor; ...@@ -24,49 +22,39 @@ namespace Doctrine\DBAL\Schema\Visitor;
use Doctrine\DBAL\Platforms\AbstractPlatform, use Doctrine\DBAL\Platforms\AbstractPlatform,
Doctrine\DBAL\Schema\Table, Doctrine\DBAL\Schema\Table,
Doctrine\DBAL\Schema\Schema, Doctrine\DBAL\Schema\Schema,
Doctrine\DBAL\Schema\Column,
Doctrine\DBAL\Schema\ForeignKeyConstraint, Doctrine\DBAL\Schema\ForeignKeyConstraint,
Doctrine\DBAL\Schema\Constraint, Doctrine\DBAL\Schema\Constraint,
Doctrine\DBAL\Schema\Sequence, Doctrine\DBAL\Schema\Sequence;
Doctrine\DBAL\Schema\Index;
class CreateSchemaSqlCollector implements Visitor class CreateSchemaSqlCollector extends AbstractVisitor
{ {
/** /**
* @var array * @var array
*/ */
private $_createTableQueries = array(); private $createTableQueries = array();
/** /**
* @var array * @var array
*/ */
private $_createSequenceQueries = array(); private $createSequenceQueries = array();
/** /**
* @var array * @var array
*/ */
private $_createFkConstraintQueries = array(); private $createFkConstraintQueries = array();
/** /**
* *
* @var \Doctrine\DBAL\Platforms\AbstractPlatform * @var \Doctrine\DBAL\Platforms\AbstractPlatform
*/ */
private $_platform = null; private $platform = null;
/** /**
* @param AbstractPlatform $platform * @param AbstractPlatform $platform
*/ */
public function __construct(AbstractPlatform $platform) public function __construct(AbstractPlatform $platform)
{ {
$this->_platform = $platform; $this->platform = $platform;
}
/**
* @param Schema $schema
*/
public function acceptSchema(Schema $schema)
{
} }
/** /**
...@@ -78,17 +66,12 @@ class CreateSchemaSqlCollector implements Visitor ...@@ -78,17 +66,12 @@ class CreateSchemaSqlCollector implements Visitor
{ {
$namespace = $this->getNamespace($table); $namespace = $this->getNamespace($table);
$this->_createTableQueries[$namespace] = array_merge( $this->createTableQueries[$namespace] = array_merge(
$this->_createTableQueries[$namespace], $this->createTableQueries[$namespace],
$this->_platform->getCreateTableSQL($table) $this->platform->getCreateTableSQL($table)
); );
} }
public function acceptColumn(Table $table, Column $column)
{
}
/** /**
* @param Table $localTable * @param Table $localTable
* @param ForeignKeyConstraint $fkConstraint * @param ForeignKeyConstraint $fkConstraint
...@@ -97,25 +80,16 @@ class CreateSchemaSqlCollector implements Visitor ...@@ -97,25 +80,16 @@ class CreateSchemaSqlCollector implements Visitor
{ {
$namespace = $this->getNamespace($localTable); $namespace = $this->getNamespace($localTable);
if ($this->_platform->supportsForeignKeyConstraints()) { if ($this->platform->supportsForeignKeyConstraints()) {
$this->_createFkConstraintQueries[$namespace] = array_merge( $this->createFkConstraintQueries[$namespace] = array_merge(
$this->_createFkConstraintQueries[$namespace], $this->createFkConstraintQueries[$namespace],
(array) $this->_platform->getCreateForeignKeySQL( (array) $this->platform->getCreateForeignKeySQL(
$fkConstraint, $localTable $fkConstraint, $localTable
) )
); );
} }
} }
/**
* @param Table $table
* @param Index $index
*/
public function acceptIndex(Table $table, Index $index)
{
}
/** /**
* @param Sequence $sequence * @param Sequence $sequence
*/ */
...@@ -123,19 +97,19 @@ class CreateSchemaSqlCollector implements Visitor ...@@ -123,19 +97,19 @@ class CreateSchemaSqlCollector implements Visitor
{ {
$namespace = $this->getNamespace($sequence); $namespace = $this->getNamespace($sequence);
$this->_createSequenceQueries[$namespace] = array_merge( $this->createSequenceQueries[$namespace] = array_merge(
$this->_createSequenceQueries[$namespace], $this->createSequenceQueries[$namespace],
(array)$this->_platform->getCreateSequenceSQL($sequence) (array)$this->platform->getCreateSequenceSQL($sequence)
); );
} }
private function getNamespace($asset) private function getNamespace($asset)
{ {
$namespace = $asset->getNamespaceName() ?: 'default'; $namespace = $asset->getNamespaceName() ?: 'default';
if ( !isset($this->_createTableQueries[$namespace])) { if ( !isset($this->createTableQueries[$namespace])) {
$this->_createTableQueries[$namespace] = array(); $this->createTableQueries[$namespace] = array();
$this->_createSequenceQueries[$namespace] = array(); $this->createSequenceQueries[$namespace] = array();
$this->_createFkConstraintQueries[$namespace] = array(); $this->createFkConstraintQueries[$namespace] = array();
} }
return $namespace; return $namespace;
...@@ -146,9 +120,9 @@ class CreateSchemaSqlCollector implements Visitor ...@@ -146,9 +120,9 @@ class CreateSchemaSqlCollector implements Visitor
*/ */
public function resetQueries() public function resetQueries()
{ {
$this->_createTableQueries = array(); $this->createTableQueries = array();
$this->_createSequenceQueries = array(); $this->createSequenceQueries = array();
$this->_createFkConstraintQueries = array(); $this->createFkConstraintQueries = array();
} }
/** /**
...@@ -159,20 +133,25 @@ class CreateSchemaSqlCollector implements Visitor ...@@ -159,20 +133,25 @@ class CreateSchemaSqlCollector implements Visitor
public function getQueries() public function getQueries()
{ {
$sql = array(); $sql = array();
foreach (array_keys($this->_createTableQueries) as $namespace) {
if ($this->_platform->supportsSchemas()) { foreach (array_keys($this->createTableQueries) as $namespace) {
if ($this->platform->supportsSchemas()) {
// TODO: Create Schema here // TODO: Create Schema here
} }
} }
foreach ($this->_createTableQueries as $schemaSql) {
foreach ($this->createTableQueries as $schemaSql) {
$sql = array_merge($sql, $schemaSql); $sql = array_merge($sql, $schemaSql);
} }
foreach ($this->_createSequenceQueries as $schemaSql) {
foreach ($this->createSequenceQueries as $schemaSql) {
$sql = array_merge($sql, $schemaSql); $sql = array_merge($sql, $schemaSql);
} }
foreach ($this->_createFkConstraintQueries as $schemaSql) {
foreach ($this->createFkConstraintQueries as $schemaSql) {
$sql = array_merge($sql, $schemaSql); $sql = array_merge($sql, $schemaSql);
} }
return $sql; return $sql;
} }
} }
<?php
/*
* 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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
<?php <?php
/* /*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
...@@ -24,7 +22,6 @@ namespace Doctrine\DBAL\Schema\Visitor; ...@@ -24,7 +22,6 @@ namespace Doctrine\DBAL\Schema\Visitor;
use Doctrine\DBAL\Platforms\AbstractPlatform, use Doctrine\DBAL\Platforms\AbstractPlatform,
Doctrine\DBAL\Schema\Table, Doctrine\DBAL\Schema\Table,
Doctrine\DBAL\Schema\Schema, Doctrine\DBAL\Schema\Schema,
Doctrine\DBAL\Schema\Column,
Doctrine\DBAL\Schema\ForeignKeyConstraint, Doctrine\DBAL\Schema\ForeignKeyConstraint,
Doctrine\DBAL\Schema\Constraint, Doctrine\DBAL\Schema\Constraint,
Doctrine\DBAL\Schema\Sequence, Doctrine\DBAL\Schema\Sequence,
...@@ -34,12 +31,11 @@ use Doctrine\DBAL\Platforms\AbstractPlatform, ...@@ -34,12 +31,11 @@ use Doctrine\DBAL\Platforms\AbstractPlatform,
/** /**
* Gather SQL statements that allow to completely drop the current schema. * Gather SQL statements that allow to completely drop the current schema.
* *
*
* @link www.doctrine-project.org * @link www.doctrine-project.org
* @since 2.0 * @since 2.0
* @author Benjamin Eberlei <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
*/ */
class DropSchemaSqlCollector implements Visitor class DropSchemaSqlCollector extends AbstractVisitor
{ {
/** /**
* @var \SplObjectStorage * @var \SplObjectStorage
...@@ -71,14 +67,6 @@ class DropSchemaSqlCollector implements Visitor ...@@ -71,14 +67,6 @@ class DropSchemaSqlCollector implements Visitor
$this->clearQueries(); $this->clearQueries();
} }
/**
* @param Schema $schema
*/
public function acceptSchema(Schema $schema)
{
}
/** /**
* @param Table $table * @param Table $table
*/ */
...@@ -87,14 +75,6 @@ class DropSchemaSqlCollector implements Visitor ...@@ -87,14 +75,6 @@ class DropSchemaSqlCollector implements Visitor
$this->tables->attach($table); $this->tables->attach($table);
} }
/**
* @param Column $column
*/
public function acceptColumn(Table $table, Column $column)
{
}
/** /**
* @param Table $localTable * @param Table $localTable
* @param ForeignKeyConstraint $fkConstraint * @param ForeignKeyConstraint $fkConstraint
...@@ -109,15 +89,6 @@ class DropSchemaSqlCollector implements Visitor ...@@ -109,15 +89,6 @@ class DropSchemaSqlCollector implements Visitor
$this->constraints[$fkConstraint] = $localTable; $this->constraints[$fkConstraint] = $localTable;
} }
/**
* @param Table $table
* @param Index $index
*/
public function acceptIndex(Table $table, Index $index)
{
}
/** /**
* @param Sequence $sequence * @param Sequence $sequence
*/ */
...@@ -142,6 +113,7 @@ class DropSchemaSqlCollector implements Visitor ...@@ -142,6 +113,7 @@ class DropSchemaSqlCollector implements Visitor
public function getQueries() public function getQueries()
{ {
$sql = array(); $sql = array();
foreach ($this->constraints as $fkConstraint) { foreach ($this->constraints as $fkConstraint) {
$localTable = $this->constraints[$fkConstraint]; $localTable = $this->constraints[$fkConstraint];
$sql[] = $this->platform->getDropForeignKeySQL($fkConstraint, $localTable); $sql[] = $this->platform->getDropForeignKeySQL($fkConstraint, $localTable);
......
<?php <?php
/* /*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
...@@ -23,21 +22,19 @@ namespace Doctrine\DBAL\Schema\Visitor; ...@@ -23,21 +22,19 @@ namespace Doctrine\DBAL\Schema\Visitor;
use Doctrine\DBAL\Platforms\AbstractPlatform, use Doctrine\DBAL\Platforms\AbstractPlatform,
Doctrine\DBAL\Schema\Table, Doctrine\DBAL\Schema\Table,
Doctrine\DBAL\Schema\Schema, Doctrine\DBAL\Schema\Schema,
Doctrine\DBAL\Schema\Column,
Doctrine\DBAL\Schema\ForeignKeyConstraint, Doctrine\DBAL\Schema\ForeignKeyConstraint,
Doctrine\DBAL\Schema\Constraint, Doctrine\DBAL\Schema\Constraint;
Doctrine\DBAL\Schema\Sequence,
Doctrine\DBAL\Schema\Index;
class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor /**
* Create a Graphviz output of a Schema.
*/
class Graphviz extends AbstractVisitor
{ {
/**
* @var string
*/
private $output = ''; private $output = '';
public function acceptColumn(Table $table, Column $column)
{
}
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint) public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{ {
$this->output .= $this->createNodeRelation( $this->output .= $this->createNodeRelation(
...@@ -51,11 +48,6 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor ...@@ -51,11 +48,6 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
); );
} }
public function acceptIndex(Table $table, Index $index)
{
}
public function acceptSchema(Schema $schema) public function acceptSchema(Schema $schema)
{ {
$this->output = 'digraph "' . sha1( mt_rand() ) . '" {' . "\n"; $this->output = 'digraph "' . sha1( mt_rand() ) . '" {' . "\n";
...@@ -66,11 +58,6 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor ...@@ -66,11 +58,6 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
$this->output .= 'sep = .2;' . "\n"; $this->output .= 'sep = .2;' . "\n";
} }
public function acceptSequence(Sequence $sequence)
{
}
public function acceptTable(Table $table) public function acceptTable(Table $table)
{ {
$this->output .= $this->createNode( $this->output .= $this->createNode(
...@@ -133,6 +120,16 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor ...@@ -133,6 +120,16 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
return $relation; return $relation;
} }
/**
* Get Graphviz Output
*
* @return string
*/
public function getOutput()
{
return $this->output . "}";
}
/** /**
* Write dot language output to a file. This should usually be a *.dot file. * Write dot language output to a file. This should usually be a *.dot file.
* *
...@@ -146,6 +143,6 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor ...@@ -146,6 +143,6 @@ class Graphviz implements \Doctrine\DBAL\Schema\Visitor\Visitor
*/ */
public function write($filename) public function write($filename)
{ {
file_put_contents($filename, $this->output . "}"); file_put_contents($filename, $this->getOutput());
} }
} }
...@@ -22,11 +22,9 @@ namespace Doctrine\DBAL\Schema\Visitor; ...@@ -22,11 +22,9 @@ namespace Doctrine\DBAL\Schema\Visitor;
use Doctrine\DBAL\Platforms\AbstractPlatform, use Doctrine\DBAL\Platforms\AbstractPlatform,
Doctrine\DBAL\Schema\Table, Doctrine\DBAL\Schema\Table,
Doctrine\DBAL\Schema\Schema, Doctrine\DBAL\Schema\Schema,
Doctrine\DBAL\Schema\Column,
Doctrine\DBAL\Schema\ForeignKeyConstraint, Doctrine\DBAL\Schema\ForeignKeyConstraint,
Doctrine\DBAL\Schema\Constraint, Doctrine\DBAL\Schema\Constraint,
Doctrine\DBAL\Schema\Sequence, Doctrine\DBAL\Schema\Sequence;
Doctrine\DBAL\Schema\Index;
/** /**
* Remove assets from a schema that are not in the default namespace. * Remove assets from a schema that are not in the default namespace.
...@@ -42,7 +40,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform, ...@@ -42,7 +40,7 @@ use Doctrine\DBAL\Platforms\AbstractPlatform,
* @author Benjamin Eberlei <kontakt@beberlei.de> * @author Benjamin Eberlei <kontakt@beberlei.de>
* @since 2.2 * @since 2.2
*/ */
class RemoveNamespacedAssets implements Visitor class RemoveNamespacedAssets extends AbstractVisitor
{ {
/** /**
* @var Schema * @var Schema
...@@ -76,13 +74,6 @@ class RemoveNamespacedAssets implements Visitor ...@@ -76,13 +74,6 @@ class RemoveNamespacedAssets implements Visitor
} }
} }
/**
* @param Column $column
*/
public function acceptColumn(Table $table, Column $column)
{
}
/** /**
* @param Table $localTable * @param Table $localTable
* @param ForeignKeyConstraint $fkConstraint * @param ForeignKeyConstraint $fkConstraint
...@@ -102,12 +93,4 @@ class RemoveNamespacedAssets implements Visitor ...@@ -102,12 +93,4 @@ class RemoveNamespacedAssets implements Visitor
$localTable->removeForeignKey($fkConstraint->getName()); $localTable->removeForeignKey($fkConstraint->getName());
} }
} }
/**
* @param Table $table
* @param Index $index
*/
public function acceptIndex(Table $table, Index $index)
{
}
} }
<?php
/*
* 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
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* This software consists of voluntary contributions made by many individuals
* and is licensed under the MIT license. For more information, see
* <http://www.doctrine-project.org>.
*/
namespace Doctrine\DBAL\Schema\Visitor;
use Doctrine\DBAL\Platforms\AbstractPlatform,
Doctrine\DBAL\Schema\Table,
Doctrine\DBAL\Schema\TableDiff,
Doctrine\DBAL\Schema\Schema,
Doctrine\DBAL\Schema\ForeignKeyConstraint,
Doctrine\DBAL\Schema\Constraint,
Doctrine\DBAL\Schema\Sequence,
Doctrine\DBAL\Schema\SchemaException,
Doctrine\DBAL\Schema\Index;
/**
* Visit a SchemaDiff.
*
* @link www.doctrine-project.org
* @since 2.4
* @author Benjamin Eberlei <kontakt@beberlei.de>
*/
interface SchemaDiffVisitor
{
/**
* Visit an orphaned foreign key whose table was deleted.
*
* @param ForeignKeyConstraint $foreignKey
*/
function visitOrphanedForeignKey(ForeignKeyConstraint $foreignKey);
/**
* Visit a sequence that has changed.
*
* @param Sequence $sequence
*/
function visitChangedSequence(Sequence $sequence);
/**
* Visit a sequence that has been removed.
*
* @param Sequence $sequence
*/
function visitRemovedSequence(Sequence $sequence);
function visitNewSequence(Sequence $sequence);
function visitNewTable(Table $table);
function visitNewTableForeignKey(Table $table, ForeignKeyConstraint $foreignKey);
function visitRemovedTable(Table $table);
function visitChangedTable(TableDiff $tableDiff);
}
...@@ -21,14 +21,14 @@ ...@@ -21,14 +21,14 @@
namespace Doctrine\DBAL\Schema\Visitor; namespace Doctrine\DBAL\Schema\Visitor;
use Doctrine\DBAL\Platforms\AbstractPlatform, use Doctrine\DBAL\Platforms\AbstractPlatform;
Doctrine\DBAL\Schema\Table, use Doctrine\DBAL\Schema\Table;
Doctrine\DBAL\Schema\Schema, use Doctrine\DBAL\Schema\Schema;
Doctrine\DBAL\Schema\Column, use Doctrine\DBAL\Schema\Column;
Doctrine\DBAL\Schema\ForeignKeyConstraint, use Doctrine\DBAL\Schema\ForeignKeyConstraint;
Doctrine\DBAL\Schema\Constraint, use Doctrine\DBAL\Schema\Constraint;
Doctrine\DBAL\Schema\Sequence, use Doctrine\DBAL\Schema\Sequence;
Doctrine\DBAL\Schema\Index; use Doctrine\DBAL\Schema\Index;
/** /**
* Schema Visitor used for Validation or Generation purposes. * Schema Visitor used for Validation or Generation purposes.
......
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