/** * @param int $index The position of the column in the index (0 indexed) * @param Column $column * * @return Index * @throws Exception\Manager */ public function addColumn($index, Column $column) { if ($this->columns->offsetExists($index) === true) { throw Exception\Index::columnAlreadyExists($index, $this->getName()); } $this->columns->offsetSet($index, $column); return $this; }
/** * Add a foreign column for the relation * * @param Column $column * * @return $this * @throws Exception\Manager */ public function addForeignForeignColumn(Column $column) { $alias = $this->normalizeName($column->getName()); if ($this->foreignForeignColumns->offsetExists($alias) === true) { throw Exception\Relation::foreignForeignColumnAlreadyExists($alias, $this->getName()); } $this->foreignForeignColumns->offsetSet($alias, $column); return $this; }