Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function findAll()
 {
     $entities = $this->getRepository()->findAll();
     $posts = [];
     foreach ($entities as $entity) {
         $posts[] = $this->converter->from($entity);
     }
     return $posts;
 }
Beispiel #2
0
 /**
  * {@inheritdoc}
  */
 public function save(array $posts)
 {
     $postsByIdentifier = [];
     $identifiers = [];
     foreach ($posts as $post) {
         $identifier = $post->getIdentifier();
         $identifiers[] = $identifier;
         $postsByIdentifier[$identifier] = $post;
     }
     $entities = $this->getRepository()->findCollection($identifiers);
     foreach ($entities as $entity) {
         $this->converter->computeTo($postsByIdentifier[$entity->getIdentifier()], $entity);
     }
     $this->entityManager->flush();
 }