books = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Set name. * * @param string $name * * @return Category */ public function setName($name) { $this->name = $name; return $this; } /** * Get name. * * @return string */ public function getName() { return $this->name; } /** * Add book. * * @param \AppBundle\Entity\Book $book * * @return Category */ public function addBook(\AppBundle\Entity\Book $book) { $this->books[] = $book; return $this; } /** * Get books. * * @return \Doctrine\Common\Collections\Collection */ public function getBooks() { return $this->books; } /** * Remove book. * * @param \AppBundle\Entity\Book $book */ public function removeBook(\AppBundle\Entity\Book $book) { $this->books->removeElement($book); } /** * Rest: get id. * * @JMS\Serializer\Annotation\SerializedName("id") * @JMS\Serializer\Annotation\Groups({"all"}) * @JMS\Serializer\Annotation\VirtualProperty * * @return int */ public function getRestId() { return $this->getId(); } /** * Rest: get name. * * @JMS\Serializer\Annotation\SerializedName("name") * @JMS\Serializer\Annotation\Groups({"all"}) * @JMS\Serializer\Annotation\VirtualProperty * * @return string */ public function getRestName() { return $this->getName(); } /** * Rest: get books. * * @JMS\Serializer\Annotation\SerializedName("books") * @JMS\Serializer\Annotation\Groups({"all"}) * @JMS\Serializer\Annotation\VirtualProperty * * @return ArrayCollection */ public function getRestBooks() { return $this->getBooks(); } }