categories = new \Doctrine\Common\Collections\ArrayCollection(); } /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Set title. * * @param string $title * * @return Book */ public function setTitle($title) { $this->title = $title; return $this; } /** * Get title. * * @return string */ public function getTitle() { return $this->title; } /** * Set pages. * * @param int $pages * * @return Book */ public function setPages($pages) { $this->pages = $pages; return $this; } /** * Get pages. * * @return int */ public function getPages() { return $this->pages; } /** * Set publishedAt. * * @param \DateTime $publishedAt * * @return Book */ public function setPublishedAt($publishedAt) { $this->publishedAt = $publishedAt; return $this; } /** * Get publishedAt. * * @return \DateTime */ public function getPublishedAt() { return $this->publishedAt; } /** * Add category. * * @param \AppBundle\Entity\Category $category * * @return Book */ public function addCategory(\AppBundle\Entity\Category $category) { $this->categories[] = $category; return $this; } /** * Remove category. * * @param \AppBundle\Entity\Category $category */ public function removeCategory(\AppBundle\Entity\Category $category) { $this->categories->removeElement($category); } /** * Get categories. * * @return \Doctrine\Common\Collections\Collection */ public function getCategories() { return $this->categories; } /** * Set author. * * @param \AppBundle\Entity\Author $author * * @return Book */ public function setAuthor(\AppBundle\Entity\Author $author = null) { $this->author = $author; return $this; } /** * Get author. * * @return \AppBundle\Entity\Author */ public function getAuthor() { return $this->author; } /** * 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 title. * * @JMS\Serializer\Annotation\SerializedName("title") * @JMS\Serializer\Annotation\Groups({"all"}) * @JMS\Serializer\Annotation\VirtualProperty * * @return string */ public function getRestTitle() { return $this->getTitle(); } /** * Rest: get publishedAt. * * @JMS\Serializer\Annotation\SerializedName("publishedAt") * @JMS\Serializer\Annotation\Groups({"all"}) * @JMS\Serializer\Annotation\VirtualProperty * * @return string */ public function getRestPublishedAt() { if ($this->getPublishedAt()) { return $this->getPublishedAt()->format('Y-m-d'); } return null; } /** * Rest: get pages. * * @JMS\Serializer\Annotation\SerializedName("pages") * @JMS\Serializer\Annotation\Groups({"all"}) * @JMS\Serializer\Annotation\VirtualProperty * * @return int */ public function getRestPages() { return $this->getPages(); } /** * Rest: get categories. * * @JMS\Serializer\Annotation\SerializedName("categories") * @JMS\Serializer\Annotation\Groups({"all"}) * @JMS\Serializer\Annotation\VirtualProperty * * @return ArrayCollection */ public function getRestCategories() { return $this->getCategories(); } /** * Rest: get author. * * @JMS\Serializer\Annotation\SerializedName("author") * @JMS\Serializer\Annotation\Groups({"all"}) * @JMS\Serializer\Annotation\VirtualProperty * * @return Author */ public function getRestAuthor() { return $this->getAuthor(); } }