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.

89 líneas
2.3KB

  1. <?php
  2. namespace Lc\ShopBundle\Model;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  6. trait OpenGraphTrait
  7. {
  8. /**
  9. * @ORM\Column(type="string", nullable=true)
  10. */
  11. protected $openGraphTitle;
  12. /**
  13. * @ORM\Column(type="text", nullable=true)
  14. */
  15. protected $openGraphDescription;
  16. /**
  17. * @ORM\Column(type="string", length=255, nullable=true)
  18. */
  19. protected $openGraphImage;
  20. /**
  21. * @Vich\UploadableField(mapping="images", fileNameProperty="openGraphImage")
  22. * @var File
  23. */
  24. protected $openGraphImageFile;
  25. public function getOpenGraphTitle(): ?string
  26. {
  27. return $this->openGraphTitle;
  28. }
  29. public function setOpenGraphTitle(string $openGraphTitle): self
  30. {
  31. $this->openGraphTitle = $openGraphTitle;
  32. return $this;
  33. }
  34. public function getOpenGraphDescription(): ?string
  35. {
  36. return $this->openGraphDescription;
  37. }
  38. public function setOpenGraphDescription(?string $openGraphDescription): self
  39. {
  40. $this->openGraphDescription = $openGraphDescription;
  41. return $this;
  42. }
  43. public function getOpenGraphImage(): ?string
  44. {
  45. return $this->openGraphImage;
  46. }
  47. public function setOpenGraphImage(?string $openGraphImage): self
  48. {
  49. $this->openGraphImage = $openGraphImage;
  50. return $this;
  51. }
  52. public function setOpenGraphImageFile(File $openGraphImageFile = null)
  53. {
  54. $this->openGraphImageFile = $openGraphImageFile;
  55. // VERY IMPORTANT:
  56. // It is required that at least one field changes if you are using Doctrine,
  57. // otherwise the event listeners won't be called and the file is lost
  58. if ($openGraphImageFile) {
  59. // if 'updatedAt' is not defined in your entity, use another property
  60. $this->updatedAt = new \DateTime('now');
  61. }
  62. }
  63. public function getOpenGraphImageFile()
  64. {
  65. return $this->openGraphImageFile ;
  66. }
  67. }