src/Entity/Master/Company.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Master;
  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="eposm_m_company")
  9.  * @ORM\Entity(repositoryClass="App\Repository\Master\CompanyRepository")
  10.  */
  11. class Company
  12. {
  13.     public function __toString(){
  14.         return $this->name;
  15.     }
  16.     public function getIsLicenseValid()
  17.     {
  18.         if($this->license != null && $this->license->getIsActive())
  19.             return true;
  20.         return false;
  21.     }
  22.     public function getIsActive()
  23.     {
  24.         if($this->isAdminActive && $this->license != null && $this->license->getIsActive())
  25.             return true;
  26.         return false;
  27.     }
  28.     
  29.     public function getIsConfigurationCompleted(){
  30.         if($this->configurationPhase == 6)
  31.             return true;
  32.         return false;
  33.     }
  34.     public function getMainAddress(){
  35.         foreach($this->getAddresses() as $address){
  36.             if($address->isMain())
  37.                 return $address;
  38.         }
  39.     }
  40.     /**
  41.      * @ORM\Column(name="id", type="bigint")
  42.      * @ORM\Id
  43.      * @ORM\GeneratedValue(strategy="AUTO")
  44.      */
  45.     protected $id;
  46.         
  47.     /**
  48.      * @ORM\Column(name="code", type="string", nullable=true)
  49.      */
  50.     protected $code;
  51.         
  52.     /**
  53.      * @ORM\Column(name="name", type="string", length=191)
  54.      */
  55.     protected $name;
  56.     /**
  57.      * @ORM\Column(name="email", type="string", length=191)
  58.      */
  59.     protected $email;
  60.     
  61.     /**
  62.      * @ORM\Column(name="fiscal_code", type="string", length=191)
  63.      */
  64.     protected $fiscalCode;
  65.     /**
  66.      * @ORM\Column(name="vat", type="string", length=191)
  67.      */
  68.     protected $vat;
  69.     
  70.     /**
  71.      * @ORM\Column(name="vat_country", type="string", length=191)
  72.      */
  73.     protected $vatCountry;
  74.     /**
  75.      * @ORM\Column(name="phone_administration", type="string", length=191, nullable=true)
  76.      */
  77.     protected $phoneAdministration;
  78.     /**
  79.      * @ORM\Column(name="phone_support_customer", type="string", length=191, nullable=true)
  80.      */
  81.     protected $phoneSupportCustomer;
  82.     /**
  83.      * @ORM\Column(name="phone_support_technician", type="string", length=191, nullable=true)
  84.      */
  85.     protected $phoneSupportTechnician;
  86.     
  87.     /**
  88.      * @ORM\Column(name="phone_logistic", type="string", length=191, nullable=true)
  89.      */
  90.     protected $phoneLogistic;
  91.     /**
  92.      * @ORM\Column(name="email_administration", type="string", length=191, nullable=true)
  93.      */
  94.     protected $emailAdministration;
  95.     /**
  96.      * @ORM\Column(name="email_support_customer", type="string", length=191, nullable=true)
  97.      */
  98.     protected $emailSupportCustomer;
  99.     /**
  100.      * @ORM\Column(name="email_support_technician", type="string", length=191, nullable=true)
  101.      */
  102.     protected $emailSupportTechnician;
  103.     
  104.     /**
  105.      * @ORM\Column(name="email_logistic", type="string", length=191, nullable=true)
  106.      */
  107.     protected $emailLogistic;
  108.     
  109.     /**
  110.      * @ORM\Column(name="directory_path", type="string", length=191)
  111.      */
  112.     protected $directoryPath;
  113.     /**
  114.      * @ORM\Column(name="logo_path", type="string", length=191, nullable=true)
  115.      */
  116.     protected $logoPath;
  117.     
  118.     /**
  119.      * @ORM\Column(name="db_name", type="string", length=191)
  120.      */
  121.     protected $dbName;
  122.     
  123.     /**
  124.      * @ORM\Column(name="admin_access", type="boolean")
  125.      */
  126.     protected $adminAccess false;
  127.     
  128.     /**
  129.      * @ORM\Column(name="admin_active", type="boolean")
  130.      */
  131.     protected $adminActive true;
  132.     // OneToMany
  133.         /**
  134.          * @ORM\OneToMany(targetEntity="App\Entity\Master\CompanyMailer", mappedBy="company")
  135.          */
  136.         private $mailers;
  137.         /**
  138.          * @ORM\OneToMany(targetEntity="App\Entity\Master\JoinTableCompanySupplier", mappedBy="company")
  139.          */
  140.         private $suppliers;
  141.         
  142.         /**
  143.          * @ORM\OneToMany(targetEntity="App\Entity\Master\Address", mappedBy="company")
  144.          */
  145.         private $addresses;
  146.         
  147.         /**
  148.          * @ORM\OneToMany(targetEntity="App\Entity\Master\Contact", mappedBy="company")
  149.          */
  150.         private $contacts;
  151.         
  152.         /**
  153.          * @ORM\OneToMany(targetEntity="App\Entity\Master\License", mappedBy="company")
  154.          */
  155.         private $licenses;
  156.         
  157.         /**
  158.          * @ORM\OneToMany(targetEntity="App\Entity\Master\Order", mappedBy="company")
  159.          */
  160.         private $orders;
  161.         
  162.         /**
  163.          * @ORM\OneToMany(targetEntity="App\Entity\Master\Order", mappedBy="signaler")
  164.          */
  165.         private $signalerForOrders;
  166.         
  167.         /**
  168.          * @ORM\OneToMany(targetEntity="App\Entity\Master\JoinTableCompanyFeature", mappedBy="company")
  169.          */
  170.         private $investorForFeatures;
  171.     //
  172.     // ManyToMany
  173.         /**
  174.          * @ORM\ManyToMany(targetEntity="App\Entity\Master\Region", inversedBy="companies")
  175.          * @ORM\JoinTable(name="eposm_m_join_table_company_region")
  176.          */
  177.         private $regions;
  178.         public function __construct()
  179.         {
  180.             $this->mailers = new ArrayCollection();
  181.             $this->suppliers = new ArrayCollection();
  182.             $this->addresses = new ArrayCollection();
  183.             $this->contacts = new ArrayCollection();
  184.             $this->licenses = new ArrayCollection();
  185.             $this->orders = new ArrayCollection();
  186.             $this->signalerForOrders = new ArrayCollection();
  187.             $this->investorForFeatures = new ArrayCollection();
  188.             $this->regions = new ArrayCollection();
  189.         }
  190.         public function getId(): ?string
  191.         {
  192.             return $this->id;
  193.         }
  194.         public function getCode(): ?string
  195.         {
  196.             return $this->code;
  197.         }
  198.         public function setCode(?string $code): static
  199.         {
  200.             $this->code $code;
  201.             return $this;
  202.         }
  203.         public function getName(): ?string
  204.         {
  205.             return $this->name;
  206.         }
  207.         public function setName(string $name): static
  208.         {
  209.             $this->name $name;
  210.             return $this;
  211.         }
  212.         public function getEmail(): ?string
  213.         {
  214.             return $this->email;
  215.         }
  216.         public function setEmail(string $email): static
  217.         {
  218.             $this->email $email;
  219.             return $this;
  220.         }
  221.         public function getFiscalCode(): ?string
  222.         {
  223.             return $this->fiscalCode;
  224.         }
  225.         public function setFiscalCode(string $fiscalCode): static
  226.         {
  227.             $this->fiscalCode $fiscalCode;
  228.             return $this;
  229.         }
  230.         public function getVat(): ?string
  231.         {
  232.             return $this->vat;
  233.         }
  234.         public function setVat(string $vat): static
  235.         {
  236.             $this->vat $vat;
  237.             return $this;
  238.         }
  239.         public function getVatCountry(): ?string
  240.         {
  241.             return $this->vatCountry;
  242.         }
  243.         public function setVatCountry(string $vatCountry): static
  244.         {
  245.             $this->vatCountry $vatCountry;
  246.             return $this;
  247.         }
  248.         public function getPhoneAdministration(): ?string
  249.         {
  250.             return $this->phoneAdministration;
  251.         }
  252.         public function setPhoneAdministration(?string $phoneAdministration): static
  253.         {
  254.             $this->phoneAdministration $phoneAdministration;
  255.             return $this;
  256.         }
  257.         public function getPhoneSupportCustomer(): ?string
  258.         {
  259.             return $this->phoneSupportCustomer;
  260.         }
  261.         public function setPhoneSupportCustomer(?string $phoneSupportCustomer): static
  262.         {
  263.             $this->phoneSupportCustomer $phoneSupportCustomer;
  264.             return $this;
  265.         }
  266.         public function getPhoneSupportTechnician(): ?string
  267.         {
  268.             return $this->phoneSupportTechnician;
  269.         }
  270.         public function setPhoneSupportTechnician(?string $phoneSupportTechnician): static
  271.         {
  272.             $this->phoneSupportTechnician $phoneSupportTechnician;
  273.             return $this;
  274.         }
  275.         public function getPhoneLogistic(): ?string
  276.         {
  277.             return $this->phoneLogistic;
  278.         }
  279.         public function setPhoneLogistic(?string $phoneLogistic): static
  280.         {
  281.             $this->phoneLogistic $phoneLogistic;
  282.             return $this;
  283.         }
  284.         public function getEmailAdministration(): ?string
  285.         {
  286.             return $this->emailAdministration;
  287.         }
  288.         public function setEmailAdministration(?string $emailAdministration): static
  289.         {
  290.             $this->emailAdministration $emailAdministration;
  291.             return $this;
  292.         }
  293.         public function getEmailSupportCustomer(): ?string
  294.         {
  295.             return $this->emailSupportCustomer;
  296.         }
  297.         public function setEmailSupportCustomer(?string $emailSupportCustomer): static
  298.         {
  299.             $this->emailSupportCustomer $emailSupportCustomer;
  300.             return $this;
  301.         }
  302.         public function getEmailSupportTechnician(): ?string
  303.         {
  304.             return $this->emailSupportTechnician;
  305.         }
  306.         public function setEmailSupportTechnician(?string $emailSupportTechnician): static
  307.         {
  308.             $this->emailSupportTechnician $emailSupportTechnician;
  309.             return $this;
  310.         }
  311.         public function getEmailLogistic(): ?string
  312.         {
  313.             return $this->emailLogistic;
  314.         }
  315.         public function setEmailLogistic(?string $emailLogistic): static
  316.         {
  317.             $this->emailLogistic $emailLogistic;
  318.             return $this;
  319.         }
  320.         public function getDirectoryPath(): ?string
  321.         {
  322.             return $this->directoryPath;
  323.         }
  324.         public function setDirectoryPath(string $directoryPath): static
  325.         {
  326.             $this->directoryPath $directoryPath;
  327.             return $this;
  328.         }
  329.         public function getLogoPath(): ?string
  330.         {
  331.             return $this->logoPath;
  332.         }
  333.         public function setLogoPath(?string $logoPath): static
  334.         {
  335.             $this->logoPath $logoPath;
  336.             return $this;
  337.         }
  338.         public function getDbName(): ?string
  339.         {
  340.             return $this->dbName;
  341.         }
  342.         public function setDbName(string $dbName): static
  343.         {
  344.             $this->dbName $dbName;
  345.             return $this;
  346.         }
  347.         public function isAdminAccess(): ?bool
  348.         {
  349.             return $this->adminAccess;
  350.         }
  351.         public function setAdminAccess(bool $adminAccess): static
  352.         {
  353.             $this->adminAccess $adminAccess;
  354.             return $this;
  355.         }
  356.         public function isAdminActive(): ?bool
  357.         {
  358.             return $this->adminActive;
  359.         }
  360.         public function setAdminActive(bool $adminActive): static
  361.         {
  362.             $this->adminActive $adminActive;
  363.             return $this;
  364.         }
  365.         /**
  366.          * @return Collection<int, CompanyMailer>
  367.          */
  368.         public function getMailers(): Collection
  369.         {
  370.             return $this->mailers;
  371.         }
  372.         public function addMailer(CompanyMailer $mailer): static
  373.         {
  374.             if (!$this->mailers->contains($mailer)) {
  375.                 $this->mailers->add($mailer);
  376.                 $mailer->setCompany($this);
  377.             }
  378.             return $this;
  379.         }
  380.         public function removeMailer(CompanyMailer $mailer): static
  381.         {
  382.             if ($this->mailers->removeElement($mailer)) {
  383.                 // set the owning side to null (unless already changed)
  384.                 if ($mailer->getCompany() === $this) {
  385.                     $mailer->setCompany(null);
  386.                 }
  387.             }
  388.             return $this;
  389.         }
  390.         /**
  391.          * @return Collection<int, JoinTableCompanySupplier>
  392.          */
  393.         public function getSuppliers(): Collection
  394.         {
  395.             return $this->suppliers;
  396.         }
  397.         public function addSupplier(JoinTableCompanySupplier $supplier): static
  398.         {
  399.             if (!$this->suppliers->contains($supplier)) {
  400.                 $this->suppliers->add($supplier);
  401.                 $supplier->setCompany($this);
  402.             }
  403.             return $this;
  404.         }
  405.         public function removeSupplier(JoinTableCompanySupplier $supplier): static
  406.         {
  407.             if ($this->suppliers->removeElement($supplier)) {
  408.                 // set the owning side to null (unless already changed)
  409.                 if ($supplier->getCompany() === $this) {
  410.                     $supplier->setCompany(null);
  411.                 }
  412.             }
  413.             return $this;
  414.         }
  415.         /**
  416.          * @return Collection<int, Address>
  417.          */
  418.         public function getAddresses(): Collection
  419.         {
  420.             return $this->addresses;
  421.         }
  422.         public function addAddress(Address $address): static
  423.         {
  424.             if (!$this->addresses->contains($address)) {
  425.                 $this->addresses->add($address);
  426.                 $address->setCompany($this);
  427.             }
  428.             return $this;
  429.         }
  430.         public function removeAddress(Address $address): static
  431.         {
  432.             if ($this->addresses->removeElement($address)) {
  433.                 // set the owning side to null (unless already changed)
  434.                 if ($address->getCompany() === $this) {
  435.                     $address->setCompany(null);
  436.                 }
  437.             }
  438.             return $this;
  439.         }
  440.         /**
  441.          * @return Collection<int, Contact>
  442.          */
  443.         public function getContacts(): Collection
  444.         {
  445.             return $this->contacts;
  446.         }
  447.         public function addContact(Contact $contact): static
  448.         {
  449.             if (!$this->contacts->contains($contact)) {
  450.                 $this->contacts->add($contact);
  451.                 $contact->setCompany($this);
  452.             }
  453.             return $this;
  454.         }
  455.         public function removeContact(Contact $contact): static
  456.         {
  457.             if ($this->contacts->removeElement($contact)) {
  458.                 // set the owning side to null (unless already changed)
  459.                 if ($contact->getCompany() === $this) {
  460.                     $contact->setCompany(null);
  461.                 }
  462.             }
  463.             return $this;
  464.         }
  465.         /**
  466.          * @return Collection<int, License>
  467.          */
  468.         public function getLicenses(): Collection
  469.         {
  470.             return $this->licenses;
  471.         }
  472.         public function addLicense(License $license): static
  473.         {
  474.             if (!$this->licenses->contains($license)) {
  475.                 $this->licenses->add($license);
  476.                 $license->setCompany($this);
  477.             }
  478.             return $this;
  479.         }
  480.         public function removeLicense(License $license): static
  481.         {
  482.             if ($this->licenses->removeElement($license)) {
  483.                 // set the owning side to null (unless already changed)
  484.                 if ($license->getCompany() === $this) {
  485.                     $license->setCompany(null);
  486.                 }
  487.             }
  488.             return $this;
  489.         }
  490.         /**
  491.          * @return Collection<int, Order>
  492.          */
  493.         public function getOrders(): Collection
  494.         {
  495.             return $this->orders;
  496.         }
  497.         public function addOrder(Order $order): static
  498.         {
  499.             if (!$this->orders->contains($order)) {
  500.                 $this->orders->add($order);
  501.                 $order->setCompany($this);
  502.             }
  503.             return $this;
  504.         }
  505.         public function removeOrder(Order $order): static
  506.         {
  507.             if ($this->orders->removeElement($order)) {
  508.                 // set the owning side to null (unless already changed)
  509.                 if ($order->getCompany() === $this) {
  510.                     $order->setCompany(null);
  511.                 }
  512.             }
  513.             return $this;
  514.         }
  515.         /**
  516.          * @return Collection<int, Order>
  517.          */
  518.         public function getSignalerForOrders(): Collection
  519.         {
  520.             return $this->signalerForOrders;
  521.         }
  522.         public function addSignalerForOrder(Order $signalerForOrder): static
  523.         {
  524.             if (!$this->signalerForOrders->contains($signalerForOrder)) {
  525.                 $this->signalerForOrders->add($signalerForOrder);
  526.                 $signalerForOrder->setSignaler($this);
  527.             }
  528.             return $this;
  529.         }
  530.         public function removeSignalerForOrder(Order $signalerForOrder): static
  531.         {
  532.             if ($this->signalerForOrders->removeElement($signalerForOrder)) {
  533.                 // set the owning side to null (unless already changed)
  534.                 if ($signalerForOrder->getSignaler() === $this) {
  535.                     $signalerForOrder->setSignaler(null);
  536.                 }
  537.             }
  538.             return $this;
  539.         }
  540.         /**
  541.          * @return Collection<int, JoinTableCompanyFeature>
  542.          */
  543.         public function getInvestorForFeatures(): Collection
  544.         {
  545.             return $this->investorForFeatures;
  546.         }
  547.         public function addInvestorForFeature(JoinTableCompanyFeature $investorForFeature): static
  548.         {
  549.             if (!$this->investorForFeatures->contains($investorForFeature)) {
  550.                 $this->investorForFeatures->add($investorForFeature);
  551.                 $investorForFeature->setCompany($this);
  552.             }
  553.             return $this;
  554.         }
  555.         public function removeInvestorForFeature(JoinTableCompanyFeature $investorForFeature): static
  556.         {
  557.             if ($this->investorForFeatures->removeElement($investorForFeature)) {
  558.                 // set the owning side to null (unless already changed)
  559.                 if ($investorForFeature->getCompany() === $this) {
  560.                     $investorForFeature->setCompany(null);
  561.                 }
  562.             }
  563.             return $this;
  564.         }
  565.         /**
  566.          * @return Collection<int, Region>
  567.          */
  568.         public function getRegions(): Collection
  569.         {
  570.             return $this->regions;
  571.         }
  572.         public function addRegion(Region $region): static
  573.         {
  574.             if (!$this->regions->contains($region)) {
  575.                 $this->regions->add($region);
  576.             }
  577.             return $this;
  578.         }
  579.         public function removeRegion(Region $region): static
  580.         {
  581.             $this->regions->removeElement($region);
  582.             return $this;
  583.         }
  584.     
  585. }