您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

92 行
1.9KB

  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
  14. {
  15. /**
  16. * @ORM\Column(type="datetime")
  17. * @Gedmo\Timestampable(on="create")
  18. */
  19. protected $date;
  20. /**
  21. * @ORM\Column(type="boolean", nullable=true)
  22. */
  23. protected $isSent;
  24. /**
  25. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface")
  26. */
  27. protected $newsletter;
  28. /**
  29. * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\File\FileInterface", cascade={"persist", "remove"})
  30. */
  31. protected $image;
  32. public function __toString()
  33. {
  34. return $this->getTitle();
  35. }
  36. public function getDate(): ?\DateTimeInterface
  37. {
  38. return $this->date;
  39. }
  40. public function setDate(\DateTimeInterface $date): self
  41. {
  42. $this->date = $date;
  43. return $this;
  44. }
  45. public function getIsSent(): ?bool
  46. {
  47. return $this->isSent;
  48. }
  49. public function setIsSent(?bool $isSent): self
  50. {
  51. $this->isSent = $isSent;
  52. return $this;
  53. }
  54. public function getImage(): ?FileInterface
  55. {
  56. return $this->image;
  57. }
  58. public function setImage(?FileInterface $image): self
  59. {
  60. $this->image = $image;
  61. return $this;
  62. }
  63. public function getNewsletter(): ?NewsletterInterface
  64. {
  65. return $this->newsletter;
  66. }
  67. public function setNewsletter(?NewsletterInterface $newsletter): self
  68. {
  69. $this->newsletter = $newsletter;
  70. return $this;
  71. }
  72. }