/**
  * @throws WrongArgumentException
  * @return DBTable
  **/
 public function addColumn(DBColumn $column)
 {
     $name = $column->getName();
     Assert::isFalse(isset($this->columns[$name]), "column '{$name}' already exist");
     $this->order[] = $this->columns[$name] = $column;
     $column->setTable($this);
     return $this;
 }
示例#2
0
 /**
  * Adds a named DBColumn object to the table
  *
  * @param DBColumn $column a column to add to the table
  * @throws DuplicationException thrown when another column with the same name already added
  * @return DBTable itself
  */
 function addColumn(DBColumn $column)
 {
     $name = $column->getName();
     if (isset($this->columns[$name])) {
         throw new DuplicationException('column', $name);
     }
     $this->columns[$name] = $column;
     return $this;
 }
 protected function makeSequenceName(DBColumn $column)
 {
     return $column->getTable()->getName() . '_' . $column->getName();
 }
 function toDialectString(IDialect $dialect)
 {
     return $this->getHead($dialect) . ' FOREIGN KEY (' . $this->fields->toDialectString($dialect) . ')' . ' REFERENCES ' . $dialect->quoteIdentifier($this->referencedTable->getName()) . '(' . $this->pkFields->toDialectString($dialect) . ')' . ' ON DELETE ' . $this->associationBreakAction->toDialectString($dialect) . ' ON UPDATE ' . AssociationBreakAction::cascade()->toDialectString($dialect);
 }