Commit 0e1aac7e authored by Leo's avatar Leo

refactored class CreateSchemaSqlCollector

parent 3a698bd6
......@@ -66,10 +66,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
public function acceptNamespace($namespaceName)
{
if ($this->platform->supportsSchemas()) {
$this->createNamespaceQueries = array_merge(
$this->createNamespaceQueries,
(array) $this->platform->getCreateSchemaSQL($namespaceName)
);
$this->createNamespaceQueries[] = $this->platform->getCreateSchemaSQL($namespaceName);
}
}
......@@ -87,12 +84,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
{
if ($this->platform->supportsForeignKeyConstraints()) {
$this->createFkConstraintQueries = array_merge(
$this->createFkConstraintQueries,
(array) $this->platform->getCreateForeignKeySQL(
$fkConstraint, $localTable
)
);
$this->createFkConstraintQueries[] = $this->platform->getCreateForeignKeySQL($fkConstraint, $localTable);
}
}
......@@ -101,10 +93,7 @@ class CreateSchemaSqlCollector extends AbstractVisitor
*/
public function acceptSequence(Sequence $sequence)
{
$this->createSequenceQueries = array_merge(
$this->createSequenceQueries,
(array) $this->platform->getCreateSequenceSQL($sequence)
);
$this->createSequenceQueries[] = $this->platform->getCreateSequenceSQL($sequence);
}
/**
......@@ -125,24 +114,11 @@ class CreateSchemaSqlCollector extends AbstractVisitor
*/
public function getQueries()
{
$sql = array();
foreach ($this->createNamespaceQueries as $schemaSql) {
$sql = array_merge($sql, (array) $schemaSql);
}
foreach ($this->createTableQueries as $schemaSql) {
$sql = array_merge($sql, (array) $schemaSql);
}
foreach ($this->createSequenceQueries as $schemaSql) {
$sql = array_merge($sql, (array) $schemaSql);
}
foreach ($this->createFkConstraintQueries as $schemaSql) {
$sql = array_merge($sql, (array) $schemaSql);
}
return $sql;
return array_merge(
$this->createNamespaceQueries,
$this->createTableQueries,
$this->createSequenceQueries,
$this->createFkConstraintQueries
);
}
}
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