Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

97 lines
2.0KB

  1. <?php
  2. namespace Lc\SovBundle\Model\Site;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Lc\SovBundle\Doctrine\Extension\OpenGraphInterface;
  6. use Lc\SovBundle\Doctrine\Extension\OpenGraphTrait;
  7. use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity;
  8. use Lc\SovBundle\Model\File\FileInterface;
  9. use Lc\SovBundle\Model\Newsletter\NewsletterInterface;
  10. /**
  11. * @ORM\MappedSuperclass()
  12. */
  13. abstract class NewsModel extends AbstractFullEntity implements NewsInterface, OpenGraphInterface
  14. {
  15. use OpenGraphTrait;
  16. /**
  17. * @ORM\Column(type="datetime")
  18. * @Gedmo\Timestampable(on="create")
  19. */
  20. protected $date;
  21. /**
  22. * @ORM\Column(type="boolean", nullable=true)
  23. */
  24. protected $isSent;
  25. /**
  26. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface", inversedBy="news")
  27. */
  28. protected $newsletter;
  29. /**
  30. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\File\FileInterface", cascade={"persist", "remove"})
  31. */
  32. protected $image;
  33. public function __toString()
  34. {
  35. return $this->getTitle();
  36. }
  37. public function getDate(): ?\DateTimeInterface
  38. {
  39. return $this->date;
  40. }
  41. public function setDate(\DateTimeInterface $date): self
  42. {
  43. $this->date = $date;
  44. return $this;
  45. }
  46. public function getIsSent(): ?bool
  47. {
  48. return $this->isSent;
  49. }
  50. public function setIsSent(?bool $isSent): self
  51. {
  52. $this->isSent = $isSent;
  53. return $this;
  54. }
  55. public function getImage(): ?FileInterface
  56. {
  57. return $this->image;
  58. }
  59. public function setImage(?FileInterface $image): self
  60. {
  61. $this->image = $image;
  62. return $this;
  63. }
  64. public function getNewsletter(): ?NewsletterInterface
  65. {
  66. return $this->newsletter;
  67. }
  68. public function setNewsletter(?NewsletterInterface $newsletter): self
  69. {
  70. $this->newsletter = $newsletter;
  71. return $this;
  72. }
  73. }