title = $title; $this->author = $author; $this->published = false; $this->comments = new ArrayCollection(); $this->createdAt = $createdAt; } public function setPublished() { $this->published = true; } public function addComment(Comment $comment) { $this->comments->add($comment); } /** * @Serializer\VirtualProperty() */ public function getRef() { return $this->ref; } }