Article.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. namespace Translatable\Fixture\Document\Personal;
  3. use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoODM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. /**
  6. * @Gedmo\TranslationEntity(class="Translatable\Fixture\Document\Personal\ArticleTranslation")
  7. * @MongoODM\Document(collection="articles")
  8. */
  9. class Article
  10. {
  11. /** @MongoODM\Id */
  12. private $id;
  13. /**
  14. * @Gedmo\Translatable
  15. * @MongoODM\String
  16. */
  17. private $title;
  18. /**
  19. * @MongoODM\ReferenceMany(targetDocument="ArticleTranslation", mappedBy="object")
  20. */
  21. private $translations;
  22. public function getTranslations()
  23. {
  24. return $this->translations;
  25. }
  26. public function addTranslation(PersonalArticleTranslation $t)
  27. {
  28. if (!$this->translations->contains($t)) {
  29. $this->translations[] = $t;
  30. $t->setObject($this);
  31. }
  32. }
  33. public function getId()
  34. {
  35. return $this->id;
  36. }
  37. public function setTitle($title)
  38. {
  39. $this->title = $title;
  40. }
  41. public function getTitle()
  42. {
  43. return $this->title;
  44. }
  45. public function setCode($code)
  46. {
  47. $this->code = $code;
  48. }
  49. public function getCode()
  50. {
  51. return $this->code;
  52. }
  53. public function getSlug()
  54. {
  55. return $this->slug;
  56. }
  57. }