/** * Attaches entity * * @param int $id * @throws InvalidStateException */ public function attach($id) { if ($this->mapper === null) { throw new InvalidStateException('Missing mapper in ' . get_called_class() . '.'); } $this->row->attach($id, $this->mapper->getTable(get_called_class())); }