/** * TODO: use special object PersonaRow (ext. * RowGateway?) instead of $rowData, * that can be using as prototype for ResultSet in TableGateway. * * * (non-PHPdoc) * @see \Phamily\Framework\Repository\PersonaIdentityMapInterface::add($persona, $rowData) * */ public function add(PersonaInterface $persona, $rowData, $options = 0) { $this->items[$persona->getId()] = ['object' => $persona, 'data' => $rowData, 'options' => $options]; }
/** * * (non-PHPdoc) * @see \Phamily\Framework\Repository\PersonaRepositoryInterface::delete() * */ public function delete(PersonaInterface $persona) { /* * inlink with spouse */ $spouseTableGateway = $this->createTableGateway('spouse_relationship'); $spouseTableGateway->delete(['husband_id' => $persona->getId()]); $spouseTableGateway->delete(['wife_id' => $persona->getId()]); /* * unlink parent for existing childs */ $table = $this->createTableGateway($this->tableName); $table->update(['father_id' => null], ['father_id' => $persona->getId()]); $table->update(['mother_id' => null], ['mother_id' => $persona->getId()]); /* * delete persona row */ $row = $this->getRowGatewayInstance(); $row->populate($this->extractData($persona), true); $row->delete(); }