src/Entity/Dealer.php line 28

  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\GetCollection;
  5. use ApiPlatform\Metadata\Tests\Fixtures\Metadata\Get;
  6. use App\Entity\Enum\ImportVehicleType;
  7. use App\Repository\DealerRepository;
  8. use App\Repository\VehicleRepository;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\DBAL\Types\Types;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Component\String\Slugger\AsciiSlugger;
  14. use Symfony\Component\Validator\Constraints\Email;
  15. use Symfony\Component\Validator\Constraints\NotBlank;
  16. #[ApiResource(
  17.     operations: [
  18.         new GetCollection(),
  19.         new Get(),
  20.     ],
  21. )]
  22. #[ORM\Entity(repositoryClassDealerRepository::class)]
  23. class Dealer
  24. {
  25.     #[ORM\Id]
  26.     #[ORM\GeneratedValue]
  27.     #[ORM\Column]
  28.     private ?int $id null;
  29.     #[NotBlank]
  30.     #[ORM\Column(length255)]
  31.     private ?string $name null;
  32.     #[ORM\Column(options: ['default' => false])]
  33.     private bool $authSeller false;
  34.     #[ORM\Column(length255nullabletrue)]
  35.     private ?string $city null;
  36.     #[ORM\Column(length255nullabletrue)]
  37.     private ?string $street null;
  38.     #[ORM\Column]
  39.     private ?bool $checkVin null;
  40.     #[ORM\Column(nullabletrue)]
  41.     private ?bool $visible null;
  42.     #[ORM\Column(nullabletrue)]
  43.     private ?bool $basicAdvertising null;
  44.     #[Email]
  45.     #[ORM\Column(length255nullabletrue)]
  46.     private ?string $email null;
  47.     #[ORM\Column(length255nullabletrue)]
  48.     private ?string $www null;
  49.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  50.     private ?string $description null;
  51.     #[ORM\Column(nullabletrue)]
  52.     private ?float $lng null;
  53.     #[ORM\Column(nullabletrue)]
  54.     private ?float $lat null;
  55.     #[ORM\Column(nullabletrue)]
  56.     private ?int $rank null;
  57.     #[ORM\OrderBy(['main' => 'DESC'])]
  58.     #[ORM\OneToMany(mappedBy'dealer'targetEntityDealerImage::class, cascade: ['persist''remove'])]
  59.     private Collection $dealerImages;
  60.     #[ORM\OneToMany(mappedBy'dealer'targetEntityDealerPhone::class, cascade: ['persist''remove'])]
  61.     private Collection $dealerPhones;
  62.     #[ORM\OneToMany(mappedBy'dealer'targetEntityDealerOpenHour::class, cascade: ['persist''remove'])]
  63.     private Collection $dealerOpenHours;
  64.     #[ORM\Column(nullabletrue)]
  65.     private ?string $logo null;
  66.     #[ORM\Column(nullabletrue)]
  67.     private ?int $importId null;
  68.     #[ORM\ManyToOne(inversedBy'dealers')]
  69.     private ?District $district null;
  70.     #[ORM\Column(length255nullabletrueenumTypeImportVehicleType::class)]
  71.     private ?ImportVehicleType $nameImportVehicle null;
  72.     #[ORM\Column(length255nullabletrue)]
  73.     private ?string $idImportVehicle null;
  74.     #[ORM\Column(length255nullabletrue)]
  75.     private ?string $idExportCars null;
  76.     #[ORM\OneToMany(mappedBy'dealer'targetEntityDealerImport::class)]
  77.     private Collection $dealerImports;
  78.     #[ORM\OneToMany(mappedBy'dealer'targetEntityVehicle::class)]
  79.     private Collection $vehicles;
  80.     #[ORM\Column(length255)]
  81.     private ?string $url null;
  82.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  83.     private ?string $openingHoursNote null;
  84.     public function __construct()
  85.     {
  86.         $this->dealerImages = new ArrayCollection();
  87.         $this->dealerPhones = new ArrayCollection();
  88.         $this->dealerOpenHours = new ArrayCollection();
  89.         $this->dealerImports = new ArrayCollection();
  90.         $this->vehicles = new ArrayCollection();
  91.     }
  92.     public function getId(): ?int
  93.     {
  94.         return $this->id;
  95.     }
  96.     /**
  97.      * @return string|null
  98.      */
  99.     public function getLogo(): ?string
  100.     {
  101.         return $this->logo;
  102.     }
  103.     /**
  104.      * @param string|null $logo
  105.      */
  106.     public function setLogo(?string $logo): void
  107.     {
  108.         $this->logo $logo;
  109.     }
  110.     public function getName(): ?string
  111.     {
  112.         return $this->name;
  113.     }
  114.     public function setName(string $name): self
  115.     {
  116.         $this->name $name;
  117.         return $this;
  118.     }
  119.     public function isAuthSeller(): bool
  120.     {
  121.         return $this->authSeller;
  122.     }
  123.     public function setAuthSeller(bool $authSeller): self
  124.     {
  125.         $this->authSeller $authSeller;
  126.         return $this;
  127.     }
  128.     public function getCity(): ?string
  129.     {
  130.         return $this->city;
  131.     }
  132.     public function setCity(string $city): self
  133.     {
  134.         $this->city $city;
  135.         return $this;
  136.     }
  137.     public function isCheckVin(): ?bool
  138.     {
  139.         return $this->checkVin;
  140.     }
  141.     public function setCheckVin(bool $checkVin): self
  142.     {
  143.         $this->checkVin $checkVin;
  144.         return $this;
  145.     }
  146.     public function isVisible(): ?bool
  147.     {
  148.         return $this->visible;
  149.     }
  150.     public function setVisible(bool $visible): self
  151.     {
  152.         $this->visible $visible;
  153.         return $this;
  154.     }
  155.     public function isBasicAdvertising(): ?bool
  156.     {
  157.         return $this->basicAdvertising;
  158.     }
  159.     public function setBasicAdvertising(?bool $basicAdvertising): self
  160.     {
  161.         $this->basicAdvertising $basicAdvertising;
  162.         return $this;
  163.     }
  164.     public function getEmail(): ?string
  165.     {
  166.         return $this->email;
  167.     }
  168.     public function setEmail(string $email): self
  169.     {
  170.         $this->email $email;
  171.         return $this;
  172.     }
  173.     public function getWww(): ?string
  174.     {
  175.         return $this->www;
  176.     }
  177.     public function setWww(?string $www): self
  178.     {
  179.         $this->www $www;
  180.         return $this;
  181.     }
  182.     public function getDescription(): ?string
  183.     {
  184.         return $this->description;
  185.     }
  186.     public function setDescription(?string $description): self
  187.     {
  188.         $this->description $description;
  189.         return $this;
  190.     }
  191.     public function getLng(): ?float
  192.     {
  193.         return $this->lng;
  194.     }
  195.     public function setLng(float $lng): self
  196.     {
  197.         $this->lng $lng;
  198.         return $this;
  199.     }
  200.     public function getLat(): ?float
  201.     {
  202.         return $this->lat;
  203.     }
  204.     public function setLat(float $lat): self
  205.     {
  206.         $this->lat $lat;
  207.         return $this;
  208.     }
  209.     public function getRank(): ?int
  210.     {
  211.         return $this->rank;
  212.     }
  213.     public function setRank(?int $rank): self
  214.     {
  215.         $this->rank $rank;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection<int, DealerImage>
  220.      */
  221.     public function getDealerImages(): Collection
  222.     {
  223.         return $this->dealerImages;
  224.     }
  225.     public function addDealerImage(DealerImage $dealerImage): self
  226.     {
  227.         if (!$this->dealerImages->contains($dealerImage)) {
  228.             $this->dealerImages->add($dealerImage);
  229.             $dealerImage->setDealer($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeDealerImage(DealerImage $dealerImage): self
  234.     {
  235.         if ($this->dealerImages->removeElement($dealerImage)) {
  236.             // set the owning side to null (unless already changed)
  237.             if ($dealerImage->getDealer() === $this) {
  238.                 $dealerImage->setDealer(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     /**
  244.      * @return Collection<int, DealerPhone>
  245.      */
  246.     public function getDealerPhones(): Collection
  247.     {
  248.         return $this->dealerPhones;
  249.     }
  250.     public function addDealerPhone(DealerPhone $dealerPhone): self
  251.     {
  252.         if (!$this->dealerPhones->contains($dealerPhone)) {
  253.             $this->dealerPhones->add($dealerPhone);
  254.             $dealerPhone->setDealer($this);
  255.         }
  256.         return $this;
  257.     }
  258.     public function removeDealerPhone(DealerPhone $dealerPhone): self
  259.     {
  260.         if ($this->dealerPhones->removeElement($dealerPhone)) {
  261.             // set the owning side to null (unless already changed)
  262.             if ($dealerPhone->getDealer() === $this) {
  263.                 $dealerPhone->setDealer(null);
  264.             }
  265.         }
  266.         return $this;
  267.     }
  268.     /**
  269.      * @return Collection<int, DealerOpenHour>
  270.      */
  271.     public function getDealerOpenHours(): Collection
  272.     {
  273.         return $this->dealerOpenHours;
  274.     }
  275.     public function addDealerOpenHour(DealerOpenHour $dealerOpenHour): self
  276.     {
  277.         if (!$this->dealerOpenHours->contains($dealerOpenHour)) {
  278.             $this->dealerOpenHours->add($dealerOpenHour);
  279.             $dealerOpenHour->setDealer($this);
  280.         }
  281.         return $this;
  282.     }
  283.     public function removeDealerOpenHour(DealerOpenHour $dealerOpenHour): self
  284.     {
  285.         if ($this->dealerOpenHours->removeElement($dealerOpenHour)) {
  286.             // set the owning side to null (unless already changed)
  287.             if ($dealerOpenHour->getDealer() === $this) {
  288.                 $dealerOpenHour->setDealer(null);
  289.             }
  290.         }
  291.         return $this;
  292.     }
  293.     public function getImportId(): ?int
  294.     {
  295.         return $this->importId;
  296.     }
  297.     public function setImportId(?int $importId): self
  298.     {
  299.         $this->importId $importId;
  300.         return $this;
  301.     }
  302.     public function getStreet(): ?string
  303.     {
  304.         return $this->street;
  305.     }
  306.     public function setStreet(string $street): self
  307.     {
  308.         $this->street $street;
  309.         return $this;
  310.     }
  311.     public function getDistrict(): ?District
  312.     {
  313.         return $this->district;
  314.     }
  315.     public function setDistrict(?District $district): self
  316.     {
  317.         $this->district $district;
  318.         return $this;
  319.     }
  320.     public function getNameImportVehicle(): ?ImportVehicleType
  321.     {
  322.         return $this->nameImportVehicle;
  323.     }
  324.     public function setNameImportVehicle(?ImportVehicleType $nameImportVehicle): self
  325.     {
  326.         $this->nameImportVehicle $nameImportVehicle;
  327.         return $this;
  328.     }
  329.     public function getIdImportVehicle(): ?string
  330.     {
  331.         return $this->idImportVehicle;
  332.     }
  333.     public function setIdImportVehicle(?string $idImportVehicle): self
  334.     {
  335.         $this->idImportVehicle $idImportVehicle;
  336.         return $this;
  337.     }
  338.     public function getIdExportCars(): ?string
  339.     {
  340.         return $this->idExportCars;
  341.     }
  342.     public function setIdExportCars(?string $idExportCars): self
  343.     {
  344.         $this->idExportCars $idExportCars;
  345.         return $this;
  346.     }
  347.     /**
  348.      * @return Collection<int, DealerImport>
  349.      */
  350.     public function getDealerImports(): Collection
  351.     {
  352.         return $this->dealerImports;
  353.     }
  354.     public function addDealerImport(DealerImport $dealerImport): self
  355.     {
  356.         if (!$this->dealerImports->contains($dealerImport)) {
  357.             $this->dealerImports->add($dealerImport);
  358.             $dealerImport->setDealer($this);
  359.         }
  360.         return $this;
  361.     }
  362.     public function removeDealerImport(DealerImport $dealerImport): self
  363.     {
  364.         if ($this->dealerImports->removeElement($dealerImport)) {
  365.             // set the owning side to null (unless already changed)
  366.             if ($dealerImport->getDealer() === $this) {
  367.                 $dealerImport->setDealer(null);
  368.             }
  369.         }
  370.         return $this;
  371.     }
  372.     /**
  373.      * @return Collection<int, Vehicle>
  374.      */
  375.     public function getVehicles(): Collection
  376.     {
  377.         return $this->vehicles;
  378.     }
  379.     public function addVehicle(Vehicle $vehicle): self
  380.     {
  381.         if (!$this->vehicles->contains($vehicle)) {
  382.             $this->vehicles->add($vehicle);
  383.             $vehicle->setDealer($this);
  384.         }
  385.         return $this;
  386.     }
  387.     public function removeVehicle(Vehicle $vehicle): self
  388.     {
  389.         if ($this->vehicles->removeElement($vehicle)) {
  390.             // set the owning side to null (unless already changed)
  391.             if ($vehicle->getDealer() === $this) {
  392.                 $vehicle->setDealer(null);
  393.             }
  394.         }
  395.         return $this;
  396.     }
  397.     public function getUrl(): ?string
  398.     {
  399.         return $this->url;
  400.     }
  401.     public function setUrl(string $url): self
  402.     {
  403.         if($url) {
  404.             $slugger = new AsciiSlugger('cs');
  405.             $slug =   $slugger->slug($url'-')->lower();
  406.             $this->url $slug->toString();
  407.         } else {
  408.             $this->url null;
  409.         }
  410.         return $this;
  411.     }
  412.     public function getOpeningHoursNote(): ?string
  413.     {
  414.         return $this->openingHoursNote;
  415.     }
  416.     public function setOpeningHoursNote(?string $openingHoursNote): self
  417.     {
  418.         $this->openingHoursNote $openingHoursNote;
  419.         return $this;
  420.     }
  421. }