You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
1.5KB

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