Article.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. namespace Timestampable\Fixture;
  3. use DoctrineExtensions\Timestampable\Timestampable;
  4. /**
  5. * @Entity
  6. */
  7. class Article implements Timestampable
  8. {
  9. /** @Id @GeneratedValue @Column(type="integer") */
  10. private $id;
  11. /**
  12. * @Column(name="title", type="string", length=128)
  13. */
  14. private $title;
  15. /**
  16. * @OneToMany(targetEntity="Timestampable\Fixture\Comment", mappedBy="article")
  17. */
  18. private $comments;
  19. /**
  20. * @var datetime $created
  21. *
  22. * @Column(name="created", type="date")
  23. */
  24. private $created;
  25. /**
  26. * @var datetime $updated
  27. *
  28. * @Column(name="updated", type="datetime")
  29. */
  30. private $updated;
  31. public function getId()
  32. {
  33. return $this->id;
  34. }
  35. public function setTitle($title)
  36. {
  37. $this->title = $title;
  38. }
  39. public function getTitle()
  40. {
  41. return $this->title;
  42. }
  43. public function addComment(Comment $comment)
  44. {
  45. $comment->setArticle($this);
  46. $this->comments[] = $comment;
  47. }
  48. public function getComments()
  49. {
  50. return $this->comments;
  51. }
  52. /**
  53. * Get created
  54. *
  55. * @return datetime $created
  56. */
  57. public function getCreated()
  58. {
  59. return $this->created;
  60. }
  61. /**
  62. * Get updated
  63. *
  64. * @return datetime $updated
  65. */
  66. public function getUpdated()
  67. {
  68. return $this->updated;
  69. }
  70. }