Article.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <?php
  2. namespace Blameable\Fixture\Entity;
  3. use Gedmo\Blameable\Blameable;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7. * @ORM\Entity
  8. */
  9. class Article implements Blameable
  10. {
  11. /** @ORM\Id @ORM\GeneratedValue @ORM\Column(type="integer") */
  12. private $id;
  13. /**
  14. * @ORM\Column(name="title", type="string", length=128)
  15. */
  16. private $title;
  17. /**
  18. * @ORM\OneToMany(targetEntity="Blameable\Fixture\Entity\Comment", mappedBy="article")
  19. */
  20. private $comments;
  21. /**
  22. * @var string $created
  23. *
  24. * @Gedmo\Blameable(on="create")
  25. * @ORM\Column(name="created", type="string")
  26. */
  27. private $created;
  28. /**
  29. * @var string $updated
  30. *
  31. * @ORM\Column(name="updated", type="string")
  32. * @Gedmo\Blameable
  33. */
  34. private $updated;
  35. /**
  36. * @var string $published
  37. *
  38. * @ORM\Column(name="published", type="string", nullable=true)
  39. * @Gedmo\Blameable(on="change", field="type.title", value="Published")
  40. */
  41. private $published;
  42. /**
  43. * @ORM\ManyToOne(targetEntity="Type", inversedBy="articles")
  44. */
  45. private $type;
  46. public function setType($type)
  47. {
  48. $this->type = $type;
  49. }
  50. public function getId()
  51. {
  52. return $this->id;
  53. }
  54. public function setTitle($title)
  55. {
  56. $this->title = $title;
  57. }
  58. public function getTitle()
  59. {
  60. return $this->title;
  61. }
  62. public function addComment(Comment $comment)
  63. {
  64. $comment->setArticle($this);
  65. $this->comments[] = $comment;
  66. }
  67. public function getComments()
  68. {
  69. return $this->comments;
  70. }
  71. /**
  72. * Get created
  73. *
  74. * @return string $created
  75. */
  76. public function getCreated()
  77. {
  78. return $this->created;
  79. }
  80. public function setCreated($created)
  81. {
  82. $this->created = $created;
  83. }
  84. public function getPublished()
  85. {
  86. return $this->published;
  87. }
  88. public function setPublished($published)
  89. {
  90. $this->published = $published;
  91. }
  92. /**
  93. * Get updated
  94. *
  95. * @return string $updated
  96. */
  97. public function getUpdated()
  98. {
  99. return $this->updated;
  100. }
  101. public function setUpdated($updated)
  102. {
  103. $this->updated = $updated;
  104. }
  105. }