/** * @param KVDdom_DomainObject $domainObject * @return void */ public function addDomainObject(KVDdom_DomainObject $domainObject) { $type = $domainObject->getClass(); $id = $domainObject->getId(); /* if (!array_key_exists($type, $this->maps)) { $this->maps[$type] = array($id => $domainObject ); } else { if (!array_key_exists($id, $this->maps[$type])) { $this->maps[$type][$id] = $domainObject; } } Werkt dit niet evengoed? */ $this->maps[$type][$id] = $domainObject; }
/** * __construct * * @param KVDdom_DomainObject $domainObject * @param PDOException $exception * @return void */ public function __construct($domainObject, PDOException $exception) { $this->domainObject = $domainObject; $this->exception = $exception; $this->message = 'U hebt geprobeerd een ' . $domainObject->getClass() . ' met id ' . $domainObject->getId() . ' te bewerken of verwijderen maar dit is niet mogelijk omdat uw bewerking tot ongeldige referenties met andere objecten zou leiden.'; }
/** * checkType * * @param KVDdom_DomainObject $object * @throws KVDdom_OngeldigTypeException Indien het object een ongeldig type heeft. * @return void */ protected function checkType(KVDdom_DomainObject $object) { if (!$object instanceof $this->type) { throw new KVDdom_OngeldigTypeException($object->getClass(), $this->type); } }