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.

AbstractDocumentEntity.php 3.8KB

4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
4 vuotta sitten
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. use Lc\ShopBundle\Context\SluggableInterface;
  6. use Lc\ShopBundle\Context\SortableInterface;
  7. use Lc\ShopBundle\Context\StatusInterface;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11. * @ORM\MappedSuperclass
  12. * @Vich\Uploadable
  13. */
  14. abstract class AbstractDocumentEntity extends AbstractEntity implements StatusInterface, SortableInterface, SluggableInterface
  15. {
  16. use SortableTrait;
  17. use StatusTrait;
  18. use SluggableTrait;
  19. /**
  20. * @ORM\Column(type="string", length=255)
  21. */
  22. protected $title;
  23. /**
  24. * @ORM\Column(type="text", nullable=true)
  25. */
  26. protected $description;
  27. /**
  28. * @ORM\Column(type="string", length=255, nullable=true)
  29. */
  30. protected $image;
  31. /**
  32. * @Vich\UploadableField(mapping="images", fileNameProperty="image")
  33. * @var File
  34. */
  35. protected $imageFile;
  36. /**
  37. * @ORM\Column(type="string", length=255, nullable=true)
  38. */
  39. protected $devAlias;
  40. /**
  41. * @ORM\Column(type="text", nullable=true)
  42. */
  43. protected $metaDescription;
  44. /**
  45. * @var array
  46. * @ORM\Column(name="old_url", type="array", nullable=true)
  47. */
  48. private $oldUrl;
  49. public function setImageFile(File $image = null)
  50. {
  51. $this->imageFile = $image;
  52. // VERY IMPORTANT:
  53. // It is required that at least one field changes if you are using Doctrine,
  54. // otherwise the event listeners won't be called and the file is lost
  55. if ($image) {
  56. // if 'updatedAt' is not defined in your entity, use another property
  57. $this->updatedAt = new \DateTime('now');
  58. }
  59. }
  60. public function getImageFile()
  61. {
  62. return $this->imageFile;
  63. }
  64. public function getTitle(): ?string
  65. {
  66. return $this->title;
  67. }
  68. public function setTitle(string $title): self
  69. {
  70. $this->title = $title;
  71. return $this;
  72. }
  73. public function getDescription(): ?string
  74. {
  75. return $this->description;
  76. }
  77. public function setDescription(?string $description): self
  78. {
  79. $this->description = $description;
  80. return $this;
  81. }
  82. /**
  83. * Set oldUrl
  84. *
  85. * @param array $oldUrl
  86. *
  87. * @return AbstractEntity
  88. */
  89. public function setOldUrl($oldUrl)
  90. {
  91. $this->oldUrl = $oldUrl;
  92. return $this;
  93. }
  94. /**
  95. * Get oldUrl
  96. *
  97. * @return array
  98. */
  99. public function getOldUrl()
  100. {
  101. return $this->oldUrl;
  102. }
  103. public function getMetaDescription(): ?string
  104. {
  105. return $this->metaDescription;
  106. }
  107. public function setMetaDescription(?string $metaDescription): self
  108. {
  109. $this->metaDescription = $metaDescription;
  110. return $this;
  111. }
  112. public function getImage(): ?string
  113. {
  114. return $this->image;
  115. }
  116. public function setImage(?string $image): self
  117. {
  118. $this->image = $image;
  119. return $this;
  120. }
  121. public function getDevAlias(): ?string
  122. {
  123. return $this->devAlias;
  124. }
  125. public function setDevAlias(?string $devAlias): self
  126. {
  127. $this->devAlias = $devAlias;
  128. return $this;
  129. }
  130. }