/**
  * Initialisiert den Synchronizer mit dem $entity in dem $this->collectionName vorhanden ist
  *
  * dies er gibt dann die fromCollection
  */
 public function init(Entity $entity)
 {
     // check entity
     if ($entity->getEntityName() !== ($class = $this->entityMeta->getClass())) {
         throw new \InvalidArgumentException('Das übergebene Entity für diesen Synchronizer kann nur vom Typ: ' . $class . ' sein. Ein Entity des Typs ' . $entity->getEntityName() . ' wurde übergeben');
     }
     // check relation
     $collectionMeta = $this->getCollectionPropertyMeta();
     if (!$collectionMeta->isRelation()) {
         throw new \InvalidArgumentException(sprintf('Das Property %s von %s ist keine Collection. Das Property muss ManyToMany oder OneToMany sein', $this->collectionName, $this->entityMeta->getClass()));
     }
 }
Exemplo n.º 2
0
 public static function construct(\Psc\Doctrine\Entity $entity, \Doctrine\ORM\EntityManager $em)
 {
     $ref = new static($entity->getEntityName(), $entity->getIdentifier(), $em);
     $ref->setEntity($entity);
     return $ref;
 }