src/Entity/ServicePro.php line 25

Open in your IDE?
  1. <?php
  2.     namespace App\Entity;
  3.     use App\Repository\ServiceProRepository;
  4.     use App\Traits\DateTrait;
  5.     use DateTimeImmutable;
  6.     use Doctrine\Common\Collections\ArrayCollection;
  7.     use Doctrine\Common\Collections\Collection;
  8.     use Doctrine\ORM\Mapping as ORM;
  9.     use JMS\Serializer\Annotation as Serializer;
  10.     use JMS\Serializer\Annotation\Expose;
  11.     use JMS\Serializer\Annotation\Groups;
  12.     use Symfony\Component\HttpFoundation\File\File;
  13.     use Symfony\Component\HttpFoundation\File\UploadedFile;
  14.     use Vich\UploaderBundle\Mapping\Annotation as Vich;
  15.     /**
  16.      * @ORM\Entity(repositoryClass=ServiceProRepository::class)
  17.      *
  18.      * @Serializer\ExclusionPolicy("ALL")
  19.      *
  20.      * @Vich\Uploadable
  21.      */
  22.     class ServicePro
  23.     {
  24.         /**
  25.          * @ORM\Id
  26.          * @ORM\GeneratedValue
  27.          * @ORM\Column(type="integer")
  28.          *
  29.          * @Expose
  30.          * @Groups({"service_pro"})
  31.          */
  32.         private $id;
  33.         /**
  34.          * @ORM\Column(type="string", length=255)
  35.          *
  36.          * @Expose
  37.          * @Groups({"service_pro"})
  38.          */
  39.         private $title;
  40.         /**
  41.          * @ORM\Column(type="text", nullable=true)
  42.          */
  43.         private $description;
  44.         /**
  45.          * @ORM\Column(type="string", length=12)
  46.          *
  47.          * @Expose
  48.          * @Groups({"service_pro"})
  49.          */
  50.         private $value;
  51.         /**
  52.          * @ORM\Column(type="boolean")
  53.          *
  54.          * @Expose
  55.          * @Groups({"service_pro"})
  56.          */
  57.         private $status;
  58.         use DateTrait;
  59.         /**
  60.          * @ORM\Column(type="string", length=255, nullable=true)
  61.          */
  62.         private $image;
  63.         // Vich Uploader
  64.         /**
  65.          * @Vich\UploadableField(mapping="service_pro_images", fileNameProperty="image")
  66.          * @var File
  67.          */
  68.         private $imageFile;
  69.         /**
  70.          * @ORM\OneToMany(targetEntity=ServiceProField::class, mappedBy="servicePro", orphanRemoval=true, cascade={"persist"})
  71.          */
  72.         private $serviceProFields;
  73.         /**
  74.          * @ORM\Column(type="array")
  75.          */
  76.         private array $contactEmails = [];
  77.         public function __construct()
  78.         {
  79.             $this->serviceProFields = new ArrayCollection();
  80.         }
  81.         public function getImageFile()
  82.         {
  83.             return $this->imageFile;
  84.         }
  85.         /**
  86.          * @param File|UploadedFile|null $imageFile
  87.          */
  88.         public function setImageFileFile $imageFile ): void
  89.         {
  90.             $this->imageFile $imageFile;
  91.             if ( NULL !== $imageFile ) {
  92.                 // It is required that at least one field changes if you are using doctrine
  93.                 // otherwise the event listeners won't be called and the file is lost
  94.                 $this->updatedAt = new DateTimeImmutable();
  95.             }
  96.         }
  97.         public function getImage(): ?string
  98.         {
  99.             return $this->image;
  100.         }
  101.         public function setImage( ?string $image ): self
  102.         {
  103.             $this->image $image;
  104.             return $this;
  105.         }
  106.         public function getId(): ?int
  107.         {
  108.             return $this->id;
  109.         }
  110.         public function getTitle(): ?string
  111.         {
  112.             return $this->title;
  113.         }
  114.         public function setTitlestring $title ): self
  115.         {
  116.             $this->title $title;
  117.             return $this;
  118.         }
  119.         public function getDescription(): ?string
  120.         {
  121.             return $this->description;
  122.         }
  123.         public function setDescription( ?string $description ): self
  124.         {
  125.             $this->description $description;
  126.             return $this;
  127.         }
  128.         public function getValue(): ?string
  129.         {
  130.             return $this->value;
  131.         }
  132.         public function setValuestring $value ): self
  133.         {
  134.             $this->value $value;
  135.             return $this;
  136.         }
  137.         public function isStatus(): ?bool
  138.         {
  139.             return $this->status;
  140.         }
  141.         public function setStatusbool $status ): self
  142.         {
  143.             $this->status $status;
  144.             return $this;
  145.         }
  146.         /**
  147.          * @return Collection<int, ServiceProField>
  148.          */
  149.         public function getServiceProFields(): Collection
  150.         {
  151.             return $this->serviceProFields;
  152.         }
  153.         public function addServiceProField(ServiceProField $serviceProField): self
  154.         {
  155.             if (!$this->serviceProFields->contains($serviceProField)) {
  156.                 $this->serviceProFields[] = $serviceProField;
  157.                 $serviceProField->setServicePro($this);
  158.             }
  159.             return $this;
  160.         }
  161.         public function removeServiceProField(ServiceProField $serviceProField): self
  162.         {
  163.             if ($this->serviceProFields->removeElement($serviceProField)) {
  164.                 // set the owning side to null (unless already changed)
  165.                 if ($serviceProField->getServicePro() === $this) {
  166.                     $serviceProField->setServicePro(NULL);
  167.                 }
  168.             }
  169.             return $this;
  170.         }
  171.         public function getContactEmails(): ?array
  172.         {
  173.             return $this->contactEmails;
  174.         }
  175.         public function setContactEmails(array $contactEmails): self
  176.         {
  177.             $this->contactEmails $contactEmails;
  178.             return $this;
  179.         }
  180.     }