Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function load(ClassMetadata $meta, Component $component, $entity)
 {
     if (!$component instanceof ToManyContainer) {
         return FALSE;
     }
     if (!($collection = $this->getCollection($meta, $entity, $name = $component->getName()))) {
         return FALSE;
     }
     $em = $this->mapper->getEntityManager();
     $UoW = $em->getUnitOfWork();
     $component->bindCollection($entity, $collection);
     foreach ($collection as $relation) {
         if ($id = $UoW->getSingleIdentifierValue($entity)) {
             $this->mapper->load($relation, $component[$id]);
             continue;
         }
         $this->mapper->load($relation, $component[ToManyContainer::NEW_PREFIX . $collection->indexOf($relation)]);
     }
     return TRUE;
 }