Comment.php 776 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace JMS\Serializer\Tests\Fixtures\DoctrinePHPCR;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCRODM;
  5. /** @PHPCRODM\Document */
  6. class Comment
  7. {
  8. /**
  9. * @PHPCRODM\Id()
  10. */
  11. protected $id;
  12. /**
  13. * @PHPCRODM\ReferenceOne(targetDocument="Author")
  14. */
  15. private $author;
  16. /** @PHPCRODM\ReferenceOne(targetDocument="BlogPost") */
  17. private $blogPost;
  18. /**
  19. * @PHPCRODM\Field(type="string")
  20. */
  21. private $text;
  22. public function __construct(Author $author, $text)
  23. {
  24. $this->author = $author;
  25. $this->text = $text;
  26. $this->blogPost = new ArrayCollection();
  27. }
  28. public function getAuthor()
  29. {
  30. return $this->author;
  31. }
  32. }