Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

121 lines
2.8KB

  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. public function setImageFile(File $image = null)
  41. {
  42. $this->imageFile = $image;
  43. // VERY IMPORTANT:
  44. // It is required that at least one field changes if you are using Doctrine,
  45. // otherwise the event listeners won't be called and the file is lost
  46. if ($image) {
  47. // if 'updatedAt' is not defined in your entity, use another property
  48. $this->updatedAt = new \DateTime('now');
  49. }
  50. }
  51. public function getImageFile()
  52. {
  53. return $this->imageFile;
  54. }
  55. public function getTitle(): ?string
  56. {
  57. return $this->title;
  58. }
  59. public function setTitle(string $title): self
  60. {
  61. $this->title = $title;
  62. return $this;
  63. }
  64. public function getDescription(): ?string
  65. {
  66. return $this->description;
  67. }
  68. public function setDescription(?string $description): self
  69. {
  70. $this->description = $description;
  71. return $this;
  72. }
  73. public function getImage(): ?string
  74. {
  75. return $this->image;
  76. }
  77. public function setImage(?string $image): self
  78. {
  79. $this->image = $image;
  80. return $this;
  81. }
  82. public function getDevAlias(): ?string
  83. {
  84. return $this->devAlias;
  85. }
  86. public function setDevAlias(?string $devAlias): self
  87. {
  88. $this->devAlias = $devAlias;
  89. return $this;
  90. }
  91. }