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.

122 líneas
2.9KB

  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 Lc\ShopBundle\Model\AbstractEntity;
  9. use Symfony\Component\HttpFoundation\File\File;
  10. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  11. /**
  12. * @ORM\MappedSuperclass
  13. * @Vich\Uploadable
  14. */
  15. abstract class AbstractDocumentEntity extends AbstractEntity implements StatusInterface, SortableInterface, SluggableInterface
  16. {
  17. use SortableTrait;
  18. use StatusTrait;
  19. use SluggableTrait;
  20. /**
  21. * @ORM\Column(type="string", length=255)
  22. */
  23. protected $title;
  24. /**
  25. * @ORM\Column(type="text", nullable=true)
  26. */
  27. protected $description;
  28. /**
  29. * @ORM\Column(type="string", length=255, nullable=true)
  30. */
  31. protected $image;
  32. /**
  33. * @Vich\UploadableField(mapping="images", fileNameProperty="image")
  34. * @var File
  35. */
  36. protected $imageFile;
  37. /**
  38. * @ORM\Column(type="string", length=255, nullable=true)
  39. */
  40. protected $devAlias;
  41. public function setImageFile(File $image = null)
  42. {
  43. $this->imageFile = $image;
  44. // VERY IMPORTANT:
  45. // It is required that at least one field changes if you are using Doctrine,
  46. // otherwise the event listeners won't be called and the file is lost
  47. if ($image) {
  48. // if 'updatedAt' is not defined in your entity, use another property
  49. $this->updatedAt = new \DateTime('now');
  50. }
  51. }
  52. public function getImageFile()
  53. {
  54. return $this->imageFile;
  55. }
  56. public function getTitle(): ?string
  57. {
  58. return $this->title;
  59. }
  60. public function setTitle(string $title): self
  61. {
  62. $this->title = $title;
  63. return $this;
  64. }
  65. public function getDescription(): ?string
  66. {
  67. return $this->description;
  68. }
  69. public function setDescription(?string $description): self
  70. {
  71. $this->description = $description;
  72. return $this;
  73. }
  74. public function getImage(): ?string
  75. {
  76. return $this->image;
  77. }
  78. public function setImage(?string $image): self
  79. {
  80. $this->image = $image;
  81. return $this;
  82. }
  83. public function getDevAlias(): ?string
  84. {
  85. return $this->devAlias;
  86. }
  87. public function setDevAlias(?string $devAlias): self
  88. {
  89. $this->devAlias = $devAlias;
  90. return $this;
  91. }
  92. }