Пример #1
0
 /**
  * @param Book $book
  * @return Book
  */
 public function clearTags(Book $book)
 {
     $book->clearTags();
     $this->em->persist($book);
     $this->em->flush();
     return $book;
 }
Пример #2
0
 /**
  * @param $data
  * @param $book
  */
 private function syncTags($data, Book $book)
 {
     $book->clearTags();
     if (isset($data['tags'])) {
         foreach ($data['tags'] as $tag) {
             $t = $this->tagRepository->tagOfNameOrCreate(new TagName($tag['name']));
             $book->addTag($t);
         }
         return $data;
     }
     return $data;
 }