src/Entity/Garages/GarageVehicleType.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\ImageInterface;
  6. use App\Entity\Interfaces\SiteInterface;
  7. use App\Entity\MiniAbstractBase;
  8. use App\Entity\Traits\HasImageTrait;
  9. use App\Entity\Traits\NameTrait;
  10. use App\Entity\Traits\SiteTrait;
  11. use App\Repository\Garages\GarageVehicleTypeRepository;
  12. use Doctrine\Common\Collections\ArrayCollection;
  13. use Doctrine\Common\Collections\Collection;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Gedmo\Mapping\Annotation as Gedmo;
  16. use Symfony\Component\HttpFoundation\File\File;
  17. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  18. /**
  19.  * @ORM\Table(name="vulco_garage_vehicle_type", indexes={@ORM\Index(name="garage_vehicle_type_site_idx", columns={"site"})}, uniqueConstraints={@ORM\UniqueConstraint(name="garage_vehicle_search_idx", columns={"site", "name"})})
  20.  *
  21.  * @ORM\Entity(repositoryClass=GarageVehicleTypeRepository::class)
  22.  *
  23.  * @Gedmo\SoftDeleteable(fieldName="removedAt", timeAware=false)
  24.  *
  25.  * @SiteAware(siteFieldName="site")
  26.  *
  27.  * @Vich\Uploadable
  28.  */
  29. class GarageVehicleType extends AbstractBase implements ImageInterfaceSiteInterface
  30. {
  31.     use HasImageTrait;
  32.     use NameTrait;
  33.     use SiteTrait;
  34.     /**
  35.      * @Vich\UploadableField(mapping="garage_vehicle_type_image", fileNameProperty="imageName")
  36.      */
  37.     private ?File $image null;
  38.     /**
  39.      * @ORM\Column(type="string", length=255)
  40.      */
  41.     private string $name;
  42.     /**
  43.      * @ORM\Column(type="string", length=255, nullable=true)
  44.      */
  45.     private ?string $nameCa null;
  46.     /**
  47.      * @ORM\Column(type="string", length=255, nullable=true)
  48.      */
  49.     private ?string $imageName null;
  50.     /**
  51.      * @ORM\ManyToMany(targetEntity="App\Entity\Garages\GarageGroup", mappedBy="vehicleTypes")
  52.      */
  53.     private ?Collection $garageGroups;
  54.     public function __construct()
  55.     {
  56.         $this->garageGroups = new ArrayCollection();
  57.     }
  58.     public function getNameCa(): ?string
  59.     {
  60.         return $this->nameCa;
  61.     }
  62.     public function setNameCa(?string $nameCa): self
  63.     {
  64.         $this->nameCa $nameCa;
  65.         return $this;
  66.     }
  67.     public function getImageName(): ?string
  68.     {
  69.         return $this->imageName;
  70.     }
  71.     public function setImageName(?string $imageName): self
  72.     {
  73.         $this->imageName $imageName;
  74.         return $this;
  75.     }
  76.     public function garageGroups(): ?Collection
  77.     {
  78.         return $this->garageGroups;
  79.     }
  80.     public function setGarageGroups(?Collection $garageGroups): self
  81.     {
  82.         $this->garageGroups $garageGroups;
  83.         return $this;
  84.     }
  85.     public function addGarageGroup(GarageGroup $garageGroup): self
  86.     {
  87.         if (!$this->garageGroups->contains($garageGroup)) {
  88.             $this->garageGroups->add($garageGroup);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeGarageGroup(GarageGroup $garageGroup): self
  93.     {
  94.         if ($this->garageGroups->contains($garageGroup)) {
  95.             $this->garageGroups->removeElement($garageGroup);
  96.         }
  97.         return $this;
  98.     }
  99.     public function __toString(): string
  100.     {
  101.         return $this->getId() ? $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  102.     }
  103. }