Example #1
0
 /**
  * @param Table $table
  */
 protected function _addTable(Table $table)
 {
     $tableName = strtolower($table->getName());
     if (isset($this->_tables[$tableName])) {
         throw SchemaException::tableAlreadyExists($tableName);
     }
     $this->_tables[$tableName] = $table;
     $table->setSchemaConfig($this->_schemaConfig);
 }
 public function testCompareNewTable()
 {
     $schemaConfig = new \Doctrine\DBAL\Schema\SchemaConfig();
     $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);
     $expected = new SchemaDiff(array('bugdb' => $table), array(), array());
     $this->assertEquals($expected, Comparator::compareSchemas($schema1, $schema2));
 }
Example #3
0
 /**
  * @param \Doctrine\DBAL\Schema\Table $table
  *
  * @return void
  *
  * @throws \Doctrine\DBAL\Schema\SchemaException
  */
 protected function _addTable(Table $table)
 {
     $namespaceName = $table->getNamespaceName();
     $tableName = $table->getFullQualifiedName($this->getName());
     if (isset($this->_tables[$tableName])) {
         throw SchemaException::tableAlreadyExists($tableName);
     }
     if (!$table->isInDefaultNamespace($this->getName()) && !$this->hasNamespace($namespaceName)) {
         $this->createNamespace($namespaceName);
     }
     $this->_tables[$tableName] = $table;
     $table->setSchemaConfig($this->_schemaConfig);
 }
Example #4
0
 protected function getTestCompositeTable($name)
 {
     $table = new Table($name, array(), array(), array(), false, array());
     $table->setSchemaConfig($this->_sm->createSchemaConfig());
     $table->addColumn('id', 'integer', array('notnull' => true));
     $table->addColumn('other_id', 'integer', array('notnull' => true));
     $table->setPrimaryKey(array('id', 'other_id'));
     $table->addColumn('test', 'string', array('length' => 255));
     $table->addColumn('test_other', 'string', array('length' => 255));
     return $table;
 }