src/Entity/Garages/GarageOffer2.php line 32

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Garages;
  3. use App\Annotation\SiteAware;
  4. use App\Entity\AbstractBase;
  5. use App\Entity\Interfaces\DocumentInterface;
  6. use App\Entity\Interfaces\ImageInterface;
  7. use App\Entity\Interfaces\SiteInterface;
  8. use App\Entity\MiniAbstractBase;
  9. use App\Entity\Traits\HasDocumentTrait;
  10. use App\Entity\Traits\HasImageTrait;
  11. use App\Entity\Traits\NameTrait;
  12. use App\Entity\Traits\PublishedTrait;
  13. use App\Entity\Traits\SiteTrait;
  14. use App\Enum\GarageOffer2TypeEnum;
  15. use App\Repository\Garages\GarageOffer2Repository;
  16. use Doctrine\Common\Collections\ArrayCollection;
  17. use Doctrine\Common\Collections\Collection;
  18. use Doctrine\ORM\Mapping as ORM;
  19. use Gedmo\Mapping\Annotation as Gedmo;
  20. use Symfony\Component\HttpFoundation\File\File;
  21. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  22. /**
  23.  * @ORM\Table(name="vulco_garage_offer_2", indexes={@ORM\Index(name="garage_offer_2_site_idx", columns={"site"})})
  24.  * @ORM\Entity(repositoryClass=GarageOffer2Repository::class)
  25.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  26.  * @SiteAware(siteFieldName="site")
  27.  * @Vich\Uploadable
  28.  */
  29. class GarageOffer2 extends AbstractBase implements SiteInterfaceDocumentInterfaceImageInterface
  30. {
  31.     use HasDocumentTrait;
  32.     use HasImageTrait;
  33.     use NameTrait;
  34.     use PublishedTrait;
  35.     use SiteTrait;
  36.     /**
  37.      * @Vich\UploadableField(mapping="garage_offer_2_document", fileNameProperty="documentName")
  38.      */
  39.     private ?File $document null;
  40.     /**
  41.      * @Vich\UploadableField(mapping="garage_offer_2_image", fileNameProperty="documentName")
  42.      */
  43.     private ?File $image null;
  44.     /**
  45.      * @ORM\Column(type="string", length=255, nullable=false)
  46.      */
  47.     private string $name;
  48.     /**
  49.      * @ORM\Column(type="integer", nullable=false)
  50.      */
  51.     private int $offerType;
  52.     /**
  53.      * @ORM\Column(type="date", nullable=true)
  54.      */
  55.     private ?\DateTimeInterface $startDate null;
  56.     /**
  57.      * @ORM\Column(type="date", nullable=true)
  58.      */
  59.     private ?\DateTimeInterface $endDate null;
  60.     /**
  61.      * @ORM\Column(type="text", length=10000, nullable=true)
  62.      */
  63.     private ?string $emailText null;
  64.     /**
  65.      * @ORM\ManyToMany(targetEntity="App\Entity\Garages\Garage", cascade={"persist"})
  66.      * @ORM\JoinTable(name="vulco_garage_offer_2_garage",
  67.      *     joinColumns={@ORM\JoinColumn(name="garage_offer_2_id", referencedColumnName="id")},
  68.      *     inverseJoinColumns={@ORM\JoinColumn(name="garage_id", referencedColumnName="id")}
  69.      * )
  70.      */
  71.     private ?Collection $garages;
  72.     /**
  73.      * TODO ORM\OneToMany(targetEntity="App\Entity\Garages\BudgetRequest", mappedBy="garageOffer2", orphanRemoval=false)
  74.      * TODO ORM\OrderBy({"createdAt": "DESC"}).
  75.      */
  76.     private ?Collection $budgetRequests;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity="App\Entity\Garages\GarageAppointment", mappedBy="garageOffer2", orphanRemoval=false)
  79.      * @ORM\OrderBy({"createdAt": "DESC"})
  80.      */
  81.     private ?Collection $garageAppointments;
  82.     public function __construct()
  83.     {
  84.         $this->garages = new ArrayCollection();
  85.         $this->budgetRequests = new ArrayCollection();
  86.         $this->garageAppointments = new ArrayCollection();
  87.     }
  88.     public function getOfferType(): int
  89.     {
  90.         return $this->offerType;
  91.     }
  92.     public function getOfferTypeString(): string
  93.     {
  94.         $result MiniAbstractBase::DEFAULT_EMPTY_STRING;
  95.         if (array_key_exists($this->getOfferType(), GarageOffer2TypeEnum::getTranslations())) {
  96.             $result GarageOffer2TypeEnum::getTranslations()[$this->getOfferType()];
  97.         }
  98.         return $result;
  99.     }
  100.     public function setOfferType(int $offerType): self
  101.     {
  102.         $this->offerType $offerType;
  103.         return $this;
  104.     }
  105.     public function getStartDate(): ?\DateTimeInterface
  106.     {
  107.         return $this->startDate;
  108.     }
  109.     public function setStartDate(?\DateTimeInterface $startDate): self
  110.     {
  111.         $this->startDate $startDate;
  112.         return $this;
  113.     }
  114.     public function getEndDate(): ?\DateTimeInterface
  115.     {
  116.         return $this->endDate;
  117.     }
  118.     public function setEndDate(?\DateTimeInterface $endDate): self
  119.     {
  120.         $this->endDate $endDate;
  121.         return $this;
  122.     }
  123.     public function getEmailText(): ?string
  124.     {
  125.         return $this->emailText;
  126.     }
  127.     public function setEmailText(?string $emailText): self
  128.     {
  129.         $this->emailText $emailText;
  130.         return $this;
  131.     }
  132.     public function getGarages(): ?Collection
  133.     {
  134.         return $this->garages;
  135.     }
  136.     public function addGarage(Garage $garage): self
  137.     {
  138.         if (!$this->garages->contains($garage)) {
  139.             $this->garages->add($garage);
  140.         }
  141.         return $this;
  142.     }
  143.     public function setGarages(?Collection $garages): self
  144.     {
  145.         $this->garages $garages;
  146.         return $this;
  147.     }
  148.     public function getBudgetRequests(): ?Collection
  149.     {
  150.         return $this->budgetRequests;
  151.     }
  152.     public function setBudgetRequests(?Collection $budgetRequests): self
  153.     {
  154.         $this->budgetRequests $budgetRequests;
  155.         return $this;
  156.     }
  157.     public function getGarageAppointments(): ?Collection
  158.     {
  159.         return $this->garageAppointments;
  160.     }
  161.     public function setGarageAppointments(?Collection $garageAppointments): self
  162.     {
  163.         $this->garageAppointments $garageAppointments;
  164.         return $this;
  165.     }
  166.     public function __toString(): string
  167.     {
  168.         return $this->id $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  169.     }
  170. }