public function testCreateNewColumn() { $column = new Column('title'); $this->assertSame('title', $column->getName()); $this->assertEmpty($column->getAutoIncrementString()); $this->assertSame('COL_TITLE', $column->getConstantName()); $this->assertSame('public', $column->getMutatorVisibility()); $this->assertSame('public', $column->getAccessorVisibility()); $this->assertFalse($column->getSize()); $this->assertFalse($column->hasPlatform()); $this->assertFalse($column->hasReferrers()); $this->assertFalse($column->isAutoIncrement()); $this->assertFalse($column->isEnumeratedClasses()); $this->assertFalse($column->isLazyLoad()); $this->assertFalse($column->isNamePlural()); $this->assertFalse($column->isNestedSetLeftKey()); $this->assertFalse($column->isNestedSetRightKey()); $this->assertFalse($column->isNotNull()); $this->assertFalse($column->isNodeKey()); $this->assertFalse($column->isPrimaryKey()); $this->assertFalse($column->isPrimaryString()); $this->assertFalse($column->isTreeScopeKey()); $this->assertFalse($column->isUnique()); $this->assertFalse($column->requiresTransactionInPostgres()); }
/** * Adds a new column to the table. * * @param Column|array $col * @throws EngineException * @return Column */ public function addColumn($col) { if ($col instanceof Column) { if (isset($this->columnsByName[$col->getName()])) { throw new EngineException(sprintf('Column "%s" declared twice in table "%s"', $col->getName(), $this->getName())); } $col->setTable($this); if ($col->isInheritance()) { $this->inheritanceColumn = $col; } $this->columns[] = $col; $this->columnsByName[$col->getName()] = $col; $this->columnsByLowercaseName[strtolower($col->getName())] = $col; $this->columnsByPhpName[$col->getPhpName()] = $col; $col->setPosition(count($this->columns)); if ($col->requiresTransactionInPostgres()) { $this->needsTransactionInPostgres = true; } return $col; } $column = new Column(); $column->setTable($this); $column->loadMapping($col); return $this->addColumn($column); // call self w/ different param }