예제 #1
0
 /**
  * @param EntityInterface $entity
  */
 protected function unregisterEntity(EntityInterface $entity)
 {
     if (array_key_exists($entity->getIdentifier(), $this->entities) === FALSE) {
         throw new \InvalidArgumentException('The entity with identifier "' . $entity->getIdentifier() . '" is not registered.', 1426251309);
     }
     unset($this->entities[$entity->getIdentifier()]);
 }
예제 #2
0
 /**
  * @param EntityInterface $entity
  */
 protected function registerEntity(EntityInterface $entity)
 {
     $entityIdentifier = $entity->getIdentifier();
     if (array_key_exists($entityIdentifier, $this->entities) === TRUE) {
         throw new \InvalidArgumentException('The entity with identifier "' . $entityIdentifier . '" is already registered.', 1426251092);
     }
     $entity->setAggregateRoot($this->aggregateRoot);
     $entity->setVersionGenerator($this->versionGenerator);
     $this->entities[$entityIdentifier] = $entity;
 }