Exemplo n.º 1
0
 /**
  * @see Psc\Doctrine\Entity
  * @inheritdoc
  */
 public function equals(Entity $otherEntity = NULL)
 {
     if ($otherEntity === NULL) {
         return FALSE;
     }
     if ($this->getEntityName() !== $otherEntity->getEntityName()) {
         return FALSE;
     }
     return $this->getIdentifier() === $otherEntity->getIdentifier();
 }
Exemplo n.º 2
0
 public function getAllSubclasses(Entity $entity)
 {
     $all_subclasses = array();
     $all_entities = array();
     $to_traverse = array();
     $entityName = $entity->getEntityName();
     foreach ($this->entityFactory->listEntities() as $entity_name) {
         $all_entities[$entity_name] = $this->entityFactory->getEntity($entity_name);
         if (in_array($entityName, $all_entities[$entity_name]->superclasses())) {
             $to_traverse[] = $entity_name;
         }
     }
     while (!empty($to_traverse)) {
         $this_traverse = array_shift($to_traverse);
         $all_subclasses[$this_traverse] = $this_traverse;
         foreach ($all_entities as $entity_name => $list_entity) {
             if (in_array($this_traverse, $list_entity->superclasses()) && !in_array($entity_name, $all_subclasses)) {
                 $to_traverse[] = $entity_name;
             }
         }
     }
     return array_unique(array_values($all_subclasses));
 }
Exemplo n.º 3
0
 public function removeEntity(Entity $entity, array $options = array())
 {
     $entityName = $entity->getEntityName();
     return $this->getRepository($entityName)->remove($entity, $options);
 }
Exemplo n.º 4
0
 public function removeEntity(Entity $entity)
 {
     $entityName = $entity->getEntityName();
     return $this->getRepository($entityName)->remove($entity);
 }