src/Entity/Dealer.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="fs_dealer")
  9.  * @ORM\Entity(repositoryClass="App\Repository\DealerRepository")
  10.  */
  11. class Dealer
  12. {
  13.     public function __toString(){
  14.         return $this->name;
  15.     }
  16.     
  17.     public function canDelete(){
  18.         if(sizeof($this->agencies) > 0)
  19.             return false;
  20.         return true;
  21.     }
  22.     
  23.     /**
  24.      * @ORM\Column(name="id", type="bigint")
  25.      * @ORM\Id
  26.      * @ORM\GeneratedValue(strategy="AUTO")
  27.      */
  28.     protected $id;
  29.         
  30.     /**
  31.      * @ORM\Column(name="name", type="string", length=191)
  32.      */
  33.     protected $name;
  34.     
  35.     /**
  36.      * @ORM\Column(name="fiscal_code", type="string", length=191)
  37.      */
  38.     protected $fiscalCode;
  39.     /**
  40.      * @ORM\Column(name="vat", type="string", length=191)
  41.      */
  42.     protected $vat;
  43.     
  44.     /**
  45.      * @ORM\Column(name="vat_country", type="string", length=191)
  46.      */
  47.     protected $vatCountry;
  48.     /**
  49.      * @ORM\Column(name="address", type="string", length=191, nullable=true)
  50.      */
  51.     protected $address;
  52.     /**
  53.      * @ORM\Column(name="manager", type="string", length=191, nullable=true)
  54.      */
  55.     protected $manager;
  56.     
  57.     /**
  58.      * @ORM\Column(name="directory_path", type="string", length=191)
  59.      */
  60.     protected $directoryPath;
  61.     /**
  62.      * @ORM\Column(name="logo_path", type="string", length=191, nullable=true)
  63.      */
  64.     protected $logoPath;
  65.     
  66.     /**
  67.      * @ORM\Column(name="admin_access", type="boolean")
  68.      */
  69.     protected $adminAccess false;
  70.     
  71.     /**
  72.      * @ORM\Column(name="admin_active", type="boolean")
  73.      */
  74.     protected $adminActive true;
  75.     // ONE TO MANY
  76.         /**
  77.          * @ORM\OneToMany(targetEntity="App\Entity\JoinTableDealerUser", mappedBy="dealer")
  78.          */
  79.         private $users;
  80.         /**
  81.          * @ORM\OneToMany(targetEntity="App\Entity\JoinTableDealerAgency", mappedBy="dealer")
  82.          */
  83.         private $agencies;
  84.         
  85.         /**
  86.          * @ORM\OneToMany(targetEntity="App\Entity\Boat", mappedBy="dealer")
  87.          */
  88.         private $boats;
  89.     //
  90.     
  91.     // MANY TO MANY
  92.         /**
  93.          * @ORM\ManyToMany(targetEntity="Language", inversedBy="dealers")
  94.          * @ORM\JoinTable(name="fs_join_table_dealer_language")
  95.          */
  96.         private $languages;
  97.         public function __construct()
  98.         {
  99.             $this->users = new ArrayCollection();
  100.             $this->agencies = new ArrayCollection();
  101.             $this->boats = new ArrayCollection();
  102.             $this->languages = new ArrayCollection();
  103.         }
  104.     //
  105.     public function getId(): ?string
  106.     {
  107.         return $this->id;
  108.     }
  109.     public function getName(): ?string
  110.     {
  111.         return $this->name;
  112.     }
  113.     public function setName(string $name): self
  114.     {
  115.         $this->name $name;
  116.         return $this;
  117.     }
  118.     public function getFiscalCode(): ?string
  119.     {
  120.         return $this->fiscalCode;
  121.     }
  122.     public function setFiscalCode(string $fiscalCode): self
  123.     {
  124.         $this->fiscalCode $fiscalCode;
  125.         return $this;
  126.     }
  127.     public function getVat(): ?string
  128.     {
  129.         return $this->vat;
  130.     }
  131.     public function setVat(string $vat): self
  132.     {
  133.         $this->vat $vat;
  134.         return $this;
  135.     }
  136.     public function getVatCountry(): ?string
  137.     {
  138.         return $this->vatCountry;
  139.     }
  140.     public function setVatCountry(string $vatCountry): self
  141.     {
  142.         $this->vatCountry $vatCountry;
  143.         return $this;
  144.     }
  145.     public function getAddress(): ?string
  146.     {
  147.         return $this->address;
  148.     }
  149.     public function setAddress(?string $address): self
  150.     {
  151.         $this->address $address;
  152.         return $this;
  153.     }
  154.     public function getManager(): ?string
  155.     {
  156.         return $this->manager;
  157.     }
  158.     public function setManager(?string $manager): self
  159.     {
  160.         $this->manager $manager;
  161.         return $this;
  162.     }
  163.     public function getDirectoryPath(): ?string
  164.     {
  165.         return $this->directoryPath;
  166.     }
  167.     public function setDirectoryPath(string $directoryPath): self
  168.     {
  169.         $this->directoryPath $directoryPath;
  170.         return $this;
  171.     }
  172.     public function getLogoPath(): ?string
  173.     {
  174.         return $this->logoPath;
  175.     }
  176.     public function setLogoPath(?string $logoPath): self
  177.     {
  178.         $this->logoPath $logoPath;
  179.         return $this;
  180.     }
  181.     public function isAdminAccess(): ?bool
  182.     {
  183.         return $this->adminAccess;
  184.     }
  185.     public function setAdminAccess(bool $adminAccess): self
  186.     {
  187.         $this->adminAccess $adminAccess;
  188.         return $this;
  189.     }
  190.     public function isAdminActive(): ?bool
  191.     {
  192.         return $this->adminActive;
  193.     }
  194.     public function setAdminActive(bool $adminActive): self
  195.     {
  196.         $this->adminActive $adminActive;
  197.         return $this;
  198.     }
  199.     /**
  200.      * @return Collection<int, JoinTableDealerUser>
  201.      */
  202.     public function getUsers(): Collection
  203.     {
  204.         return $this->users;
  205.     }
  206.     public function addUser(JoinTableDealerUser $user): self
  207.     {
  208.         if (!$this->users->contains($user)) {
  209.             $this->users->add($user);
  210.             $user->setDealer($this);
  211.         }
  212.         return $this;
  213.     }
  214.     public function removeUser(JoinTableDealerUser $user): self
  215.     {
  216.         if ($this->users->removeElement($user)) {
  217.             // set the owning side to null (unless already changed)
  218.             if ($user->getDealer() === $this) {
  219.                 $user->setDealer(null);
  220.             }
  221.         }
  222.         return $this;
  223.     }
  224.     /**
  225.      * @return Collection<int, JoinTableDealerAgency>
  226.      */
  227.     public function getAgencies(): Collection
  228.     {
  229.         return $this->agencies;
  230.     }
  231.     public function addAgency(JoinTableDealerAgency $agency): self
  232.     {
  233.         if (!$this->agencies->contains($agency)) {
  234.             $this->agencies->add($agency);
  235.             $agency->setDealer($this);
  236.         }
  237.         return $this;
  238.     }
  239.     public function removeAgency(JoinTableDealerAgency $agency): self
  240.     {
  241.         if ($this->agencies->removeElement($agency)) {
  242.             // set the owning side to null (unless already changed)
  243.             if ($agency->getDealer() === $this) {
  244.                 $agency->setDealer(null);
  245.             }
  246.         }
  247.         return $this;
  248.     }
  249.     /**
  250.      * @return Collection<int, Boat>
  251.      */
  252.     public function getBoats(): Collection
  253.     {
  254.         return $this->boats;
  255.     }
  256.     public function addBoat(Boat $boat): self
  257.     {
  258.         if (!$this->boats->contains($boat)) {
  259.             $this->boats->add($boat);
  260.             $boat->setDealer($this);
  261.         }
  262.         return $this;
  263.     }
  264.     public function removeBoat(Boat $boat): self
  265.     {
  266.         if ($this->boats->removeElement($boat)) {
  267.             // set the owning side to null (unless already changed)
  268.             if ($boat->getDealer() === $this) {
  269.                 $boat->setDealer(null);
  270.             }
  271.         }
  272.         return $this;
  273.     }
  274.     /**
  275.      * @return Collection<int, Language>
  276.      */
  277.     public function getLanguages(): Collection
  278.     {
  279.         return $this->languages;
  280.     }
  281.     public function addLanguage(Language $language): self
  282.     {
  283.         if (!$this->languages->contains($language)) {
  284.             $this->languages->add($language);
  285.         }
  286.         return $this;
  287.     }
  288.     public function removeLanguage(Language $language): self
  289.     {
  290.         $this->languages->removeElement($language);
  291.         return $this;
  292.     }
  293. }