|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- <?php
-
- namespace Lc\ShopBundle\Model;
-
- use Doctrine\ORM\Mapping as ORM;
- use Symfony\Component\HttpFoundation\File\File;
- use Vich\UploaderBundle\Mapping\Annotation as Vich;
-
-
- trait OpenGraphTrait
- {
- /**
- * @ORM\Column(type="string", nullable=true)
- */
- protected $openGraphTitle;
-
- /**
- * @ORM\Column(type="text", nullable=true)
- */
- protected $openGraphDescription;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $openGraphImage;
-
- /**
- * @Vich\UploadableField(mapping="images", fileNameProperty="openGraphImage")
- * @var File
- */
- protected $openGraphImageFile;
-
-
- public function getOpenGraphTitle(): ?string
- {
- return $this->openGraphTitle;
- }
-
- public function setOpenGraphTitle(string $openGraphTitle): self
- {
- $this->openGraphTitle = $openGraphTitle;
-
- return $this;
- }
-
- public function getOpenGraphDescription(): ?string
- {
- return $this->openGraphDescription;
- }
-
- public function setOpenGraphDescription(?string $openGraphDescription): self
- {
- $this->openGraphDescription = $openGraphDescription;
-
- return $this;
- }
-
- public function getOpenGraphImage(): ?string
- {
- return $this->openGraphImage;
- }
-
- public function setOpenGraphImage(?string $openGraphImage): self
- {
- $this->openGraphImage = $openGraphImage;
-
- return $this;
- }
-
- public function setOpenGraphImageFile(File $openGraphImageFile = null)
- {
- $this->openGraphImageFile = $openGraphImageFile;
-
- // VERY IMPORTANT:
- // It is required that at least one field changes if you are using Doctrine,
- // otherwise the event listeners won't be called and the file is lost
- if ($openGraphImageFile) {
- // if 'updatedAt' is not defined in your entity, use another property
- $this->updatedAt = new \DateTime('now');
- }
- }
-
- public function getOpenGraphImageFile()
- {
- return $this->openGraphImageFile ;
- }
-
- }
|