From 962ecab75e2334539593b51f521bd144e77c207d Mon Sep 17 00:00:00 2001 From: beberlei Date: Wed, 10 Feb 2010 23:53:07 +0000 Subject: [PATCH] [2.0] DDC-312 - Prepared View and Trigger support in DBAL\Schema --- lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php | 2 +- lib/Doctrine/DBAL/Schema/Schema.php | 4 +++- lib/Doctrine/ORM/Tools/SchemaTool.php | 2 +- .../DBAL/Functional/Schema/OracleSchemaManagerTest.php | 10 ---------- tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php | 8 ++++---- tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php | 4 ++-- 6 files changed, 11 insertions(+), 19 deletions(-) diff --git a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php index 083dfaf22..02808c65e 100644 --- a/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php +++ b/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php @@ -806,7 +806,7 @@ abstract class AbstractSchemaManager } $tables = $this->listTables(); - return new Schema($tables, $sequences, $this->createSchemaConfig()); + return new Schema($tables, $sequences, array(), array(), $this->createSchemaConfig()); } /** diff --git a/lib/Doctrine/DBAL/Schema/Schema.php b/lib/Doctrine/DBAL/Schema/Schema.php index 8d0f6e6a1..510d55a84 100644 --- a/lib/Doctrine/DBAL/Schema/Schema.php +++ b/lib/Doctrine/DBAL/Schema/Schema.php @@ -54,9 +54,11 @@ class Schema extends AbstractAsset /** * @param array $tables * @param array $sequences + * @param array $views + * @param array $triggers * @param SchemaConfig $schemaConfig */ - public function __construct(array $tables=array(), array $sequences=array(), SchemaConfig $schemaConfig=null) + public function __construct(array $tables=array(), array $sequences=array(), array $views = array(), array $triggers = array(), SchemaConfig $schemaConfig=null) { if ($schemaConfig == null) { $schemaConfig = new SchemaConfig(); diff --git a/lib/Doctrine/ORM/Tools/SchemaTool.php b/lib/Doctrine/ORM/Tools/SchemaTool.php index 91c5a12ff..22633ac3e 100644 --- a/lib/Doctrine/ORM/Tools/SchemaTool.php +++ b/lib/Doctrine/ORM/Tools/SchemaTool.php @@ -114,7 +114,7 @@ class SchemaTool $metadataSchemaConfig->setMaxIdentifierLength(63); $sm = $this->_em->getConnection()->getSchemaManager(); - $schema = new \Doctrine\DBAL\Schema\Schema(array(), array(), $metadataSchemaConfig); + $schema = new \Doctrine\DBAL\Schema\Schema(array(), array(), array(), array(), $metadataSchemaConfig); foreach ($classes as $class) { if (isset($processedClasses[$class->name]) || $class->isMappedSuperclass) { diff --git a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php index 1858e33cb..1ef5f2063 100644 --- a/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php +++ b/tests/Doctrine/Tests/DBAL/Functional/Schema/OracleSchemaManagerTest.php @@ -47,16 +47,6 @@ class OracleSchemaManagerTest extends SchemaManagerFunctionalTestCase $this->assertEquals(true, $found); } - public function testListViews() - { - $this->_sm->dropAndCreateView('test_create_view', 'SELECT * FROM sys.user_tables'); - - $views = $this->_sm->listViews(); - $view = end($views); - - $this->assertEquals('TEST_CREATE_VIEW', $view['name']); - } - public function testRenameTable() { $this->_sm->tryMethod('DropTable', 'list_tables_test'); diff --git a/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php b/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php index ba64da0cb..f4c274531 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php @@ -91,8 +91,8 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase $table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer')))); $table->setSchemaConfig($schemaConfig); - $schema1 = new Schema( array($table), array(), $schemaConfig ); - $schema2 = new Schema( array(), array(), $schemaConfig ); + $schema1 = new Schema( array($table), array(), array(), array(), $schemaConfig ); + $schema2 = new Schema( array(), array(), array(), array(), $schemaConfig ); $expected = new SchemaDiff( array(), array(), array('bugdb' => $table) ); @@ -105,8 +105,8 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase $table = new Table('bugdb', array ('integerfield1' => new Column('integerfield1', Type::getType('integer')))); $table->setSchemaConfig($schemaConfig); - $schema1 = new Schema( array(), array(), $schemaConfig ); - $schema2 = new Schema( array($table), array(), $schemaConfig ); + $schema1 = new Schema( array(), array(), array(), array(), $schemaConfig ); + $schema2 = new Schema( array($table), array(), array(), array(), $schemaConfig ); $expected = new SchemaDiff( array('bugdb' => $table), array(), array() ); $this->assertEquals($expected, Comparator::compareSchemas( $schema1, $schema2 ) ); diff --git a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php index f004e487e..4a424dad8 100644 --- a/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php +++ b/tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php @@ -193,7 +193,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase $schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig(); $schemaConfig->setExplicitForeignKeyIndexes(false); - $schema = new Schema(array(), array(), $schemaConfig); + $schema = new Schema(array(), array(), array(), array(), $schemaConfig); $this->assertFalse($schema->hasExplicitForeignKeyIndexes()); $schemaConfig->setExplicitForeignKeyIndexes(true); @@ -205,7 +205,7 @@ class SchemaTest extends \PHPUnit_Framework_TestCase $schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig(); $schemaConfig->setMaxIdentifierLength(10); - $schema = new Schema(array(), array(), $schemaConfig); + $schema = new Schema(array(), array(), array(), array(), $schemaConfig); $table = $schema->createTable("smalltable"); $table->createColumn('long_id', 'integer'); $table->addIndex(array('long_id'));