/**
  * @param Book $book
  * @return Book
  */
 public function clearPublishers(Book $book)
 {
     $book->clearPublishers();
     $this->em->persist($book);
     $this->em->flush();
     return $book;
 }
Exemple #2
0
 /**
  * @param $data
  * @param $book
  * @return voidf
  * @throws NotFoundException
  */
 private function syncPublishers($data, Book $book)
 {
     $book->clearPublishers();
     if (isset($data['publishers'])) {
         foreach ($data['publishers'] as $publisher) {
             $pub = $this->findOrCreatePublisher($publisher);
             $book->addPublisher($pub);
         }
     }
 }