Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

92 lines
1.6KB

  1. <?php
  2. namespace Lc\SovBundle\Model\Setting;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Lc\SovBundle\Model\File\FileInterface;
  5. /**
  6. * @ORM\MappedSuperclass()
  7. */
  8. abstract class SettingModel
  9. {
  10. /**
  11. * @ORM\Column(type="string", length=63)
  12. */
  13. protected $name;
  14. /**
  15. * @ORM\Column(type="text", nullable=true)
  16. */
  17. protected $text;
  18. /**
  19. * @ORM\Column(type="datetime", nullable=true)
  20. */
  21. protected $date;
  22. /**
  23. * @ORM\ManyToOne(targetEntity=FileInterface::class, cascade={"persist", "remove"})
  24. */
  25. protected $file;
  26. public function getValue()
  27. {
  28. if ($this->getText()) {
  29. return $this->getText();
  30. } elseif ($this->getDate()) {
  31. return $this->getDate();
  32. } elseif ($this->getFile()) {
  33. return $this->getFile();
  34. }
  35. }
  36. public function getName(): ?string
  37. {
  38. return $this->name;
  39. }
  40. public function setName(string $name): self
  41. {
  42. $this->name = $name;
  43. return $this;
  44. }
  45. public function getText(): ?string
  46. {
  47. return $this->text;
  48. }
  49. public function setText($text): self
  50. {
  51. $this->text = $text;
  52. return $this;
  53. }
  54. public function getDate(): ?\DateTimeInterface
  55. {
  56. return $this->date;
  57. }
  58. public function setDate(?\DateTimeInterface $date): self
  59. {
  60. $this->date = $date;
  61. return $this;
  62. }
  63. public function getFile(): ?FileInterface
  64. {
  65. return $this->file;
  66. }
  67. public function setFile(?FileInterface $file): self
  68. {
  69. $this->file = $file;
  70. return $this;
  71. }
  72. }