src/Entity/Garages/GarageOwner.php line 33

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Garages;
  3. use App\Annotation\SiteAware;
  4. use App\Doctrine\Generator\GarageOwnerIdGenerator;
  5. use App\Entity\Interfaces\ImageInterface;
  6. use App\Entity\Interfaces\SiteInterface;
  7. use App\Entity\MiniAbstractBase;
  8. use App\Entity\Traits\CreatedAtTrait;
  9. use App\Entity\Traits\GarageTrait;
  10. use App\Entity\Traits\HasImageTrait;
  11. use App\Entity\Traits\NameTrait;
  12. use App\Entity\Traits\PhoneTrait;
  13. use App\Entity\Traits\SiteTrait;
  14. use App\Entity\Traits\UpdatedAtTrait;
  15. use App\Repository\Garages\GarageOwnerRepository;
  16. use Doctrine\Common\Collections\ArrayCollection;
  17. use Doctrine\Common\Collections\Collection;
  18. use Doctrine\ORM\Mapping as ORM;
  19. use Symfony\Component\HttpFoundation\File\File;
  20. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  21. /**
  22.  * @ORM\Table(name="vulco_garage_owner", indexes={@ORM\Index(name="garage_owner_site_idx", columns={"site"})})
  23.  *
  24.  * @ORM\Entity(repositoryClass=GarageOwnerRepository::class)
  25.  *
  26.  * @SiteAware(siteFieldName="site")
  27.  *
  28.  * @Vich\Uploadable
  29.  */
  30. class GarageOwner implements SiteInterfaceImageInterface
  31. {
  32.     use CreatedAtTrait;
  33.     use GarageTrait;
  34.     use HasImageTrait;
  35.     use NameTrait;
  36.     use PhoneTrait;
  37.     use SiteTrait;
  38.     use UpdatedAtTrait;
  39.     /**
  40.      * @ORM\Id
  41.      *
  42.      * @ORM\Column(type="garage_owner_id", length=255, nullable=false)
  43.      *
  44.      * @ORM\GeneratedValue(strategy="CUSTOM")
  45.      *
  46.      * @ORM\CustomIdGenerator(class=GarageOwnerIdGenerator::class)
  47.      */
  48.     private string $id;
  49.     /**
  50.      * @Vich\UploadableField(mapping="garage_owner_image", fileNameProperty="imageName")
  51.      */
  52.     private ?File $image null;
  53.     /**
  54.      * @ORM\Column(type="string", length=255, nullable=false)
  55.      */
  56.     private string $name;
  57.     /**
  58.      * @ORM\Column(type="string", length=255, nullable=false)
  59.      */
  60.     private string $surnames;
  61.     /**
  62.      * @ORM\Column(type="string", length=255, nullable=false)
  63.      */
  64.     private string $mail;
  65.     /**
  66.      * @ORM\Column(type="string", length=255, nullable=true)
  67.      */
  68.     private ?string $phoneService null;
  69.     /**
  70.      * @ORM\Column(type="boolean", nullable=true, options={"default": 0})
  71.      */
  72.     private ?bool $isRepresentative false;
  73.     /**
  74.      * @ORM\OneToOne(targetEntity="App\Entity\Garages\Garage", inversedBy="garageOwner")
  75.      *
  76.      * @ORM\JoinColumn(name="garage_id", referencedColumnName="id")
  77.      */
  78.     private Garage $garage;
  79.     /**
  80.      * @ORM\ManyToMany(targetEntity="App\Entity\Province")
  81.      *
  82.      * @ORM\JoinTable(name="vulco_garage_owner_provinces_assigned_as_a_representative",
  83.      *     joinColumns={@ORM\JoinColumn(name="garage_owner_id", referencedColumnName="id")},
  84.      *     inverseJoinColumns={@ORM\JoinColumn(name="province_id", referencedColumnName="id")}
  85.      * )
  86.      */
  87.     private ?Collection $provincesAssignedAsARepresentative;
  88.     public function __construct()
  89.     {
  90.         $this->provincesAssignedAsARepresentative = new ArrayCollection();
  91.     }
  92.     public function getId(): string
  93.     {
  94.         return $this->id;
  95.     }
  96.     public function setFakeId(string $fakeId): self
  97.     {
  98.         $this->id $fakeId;
  99.         return $this;
  100.     }
  101.     public function getFullname(): string
  102.     {
  103.         return $this->getName().' '.$this->getSurnames();
  104.     }
  105.     public function getSurnames(): string
  106.     {
  107.         return $this->surnames;
  108.     }
  109.     public function setSurnames(string $surnames): self
  110.     {
  111.         $this->surnames $surnames;
  112.         return $this;
  113.     }
  114.     public function getMail(): string
  115.     {
  116.         return $this->mail;
  117.     }
  118.     public function setMail(string $mail): self
  119.     {
  120.         $this->mail $mail;
  121.         return $this;
  122.     }
  123.     public function getPhoneService(): ?string
  124.     {
  125.         return $this->phoneService;
  126.     }
  127.     public function setPhoneService(?string $phoneService): self
  128.     {
  129.         $this->phoneService $phoneService;
  130.         return $this;
  131.     }
  132.     public function isRepresentative(): ?bool
  133.     {
  134.         return $this->isRepresentative;
  135.     }
  136.     public function getIsRepresentative(): ?bool
  137.     {
  138.         return $this->isRepresentative();
  139.     }
  140.     public function setIsRepresentative(?bool $isRepresentative): self
  141.     {
  142.         $this->isRepresentative $isRepresentative;
  143.         return $this;
  144.     }
  145.     public function getProvincesAssignedAsARepresentative(): ?Collection
  146.     {
  147.         return $this->provincesAssignedAsARepresentative;
  148.     }
  149.     public function setProvincesAssignedAsARepresentative(?Collection $provincesAssignedAsARepresentative): self
  150.     {
  151.         $this->provincesAssignedAsARepresentative $provincesAssignedAsARepresentative;
  152.         return $this;
  153.     }
  154.     public function __toString(): string
  155.     {
  156.         return $this->id $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  157.     }
  158. }