No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

93 líneas
1.7KB

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