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.     //
  191.     public function getId(): ?string
  192.     {
  193.         return $this->id;
  194.     }
  195.     public function getCode(): ?string
  196.     {
  197.         return $this->code;
  198.     }
  199.     public function setCode(?string $code): static
  200.     {
  201.         $this->code $code;
  202.         return $this;
  203.     }
  204.     public function getName(): ?string
  205.     {
  206.         return $this->name;
  207.     }
  208.     public function setName(string $name): static
  209.     {
  210.         $this->name $name;
  211.         return $this;
  212.     }
  213.     public function getEmail(): ?string
  214.     {
  215.         return $this->email;
  216.     }
  217.     public function setEmail(string $email): static
  218.     {
  219.         $this->email $email;
  220.         return $this;
  221.     }
  222.     public function getFiscalCode(): ?string
  223.     {
  224.         return $this->fiscalCode;
  225.     }
  226.     public function setFiscalCode(string $fiscalCode): static
  227.     {
  228.         $this->fiscalCode $fiscalCode;
  229.         return $this;
  230.     }
  231.     public function getVat(): ?string
  232.     {
  233.         return $this->vat;
  234.     }
  235.     public function setVat(string $vat): static
  236.     {
  237.         $this->vat $vat;
  238.         return $this;
  239.     }
  240.     public function getVatCountry(): ?string
  241.     {
  242.         return $this->vatCountry;
  243.     }
  244.     public function setVatCountry(string $vatCountry): static
  245.     {
  246.         $this->vatCountry $vatCountry;
  247.         return $this;
  248.     }
  249.     public function getPhoneAdministration(): ?string
  250.     {
  251.         return $this->phoneAdministration;
  252.     }
  253.     public function setPhoneAdministration(?string $phoneAdministration): static
  254.     {
  255.         $this->phoneAdministration $phoneAdministration;
  256.         return $this;
  257.     }
  258.     public function getPhoneSupportCustomer(): ?string
  259.     {
  260.         return $this->phoneSupportCustomer;
  261.     }
  262.     public function setPhoneSupportCustomer(?string $phoneSupportCustomer): static
  263.     {
  264.         $this->phoneSupportCustomer $phoneSupportCustomer;
  265.         return $this;
  266.     }
  267.     public function getPhoneSupportTechnician(): ?string
  268.     {
  269.         return $this->phoneSupportTechnician;
  270.     }
  271.     public function setPhoneSupportTechnician(?string $phoneSupportTechnician): static
  272.     {
  273.         $this->phoneSupportTechnician $phoneSupportTechnician;
  274.         return $this;
  275.     }
  276.     public function getPhoneLogistic(): ?string
  277.     {
  278.         return $this->phoneLogistic;
  279.     }
  280.     public function setPhoneLogistic(?string $phoneLogistic): static
  281.     {
  282.         $this->phoneLogistic $phoneLogistic;
  283.         return $this;
  284.     }
  285.     public function getEmailAdministration(): ?string
  286.     {
  287.         return $this->emailAdministration;
  288.     }
  289.     public function setEmailAdministration(?string $emailAdministration): static
  290.     {
  291.         $this->emailAdministration $emailAdministration;
  292.         return $this;
  293.     }
  294.     public function getEmailSupportCustomer(): ?string
  295.     {
  296.         return $this->emailSupportCustomer;
  297.     }
  298.     public function setEmailSupportCustomer(?string $emailSupportCustomer): static
  299.     {
  300.         $this->emailSupportCustomer $emailSupportCustomer;
  301.         return $this;
  302.     }
  303.     public function getEmailSupportTechnician(): ?string
  304.     {
  305.         return $this->emailSupportTechnician;
  306.     }
  307.     public function setEmailSupportTechnician(?string $emailSupportTechnician): static
  308.     {
  309.         $this->emailSupportTechnician $emailSupportTechnician;
  310.         return $this;
  311.     }
  312.     public function getEmailLogistic(): ?string
  313.     {
  314.         return $this->emailLogistic;
  315.     }
  316.     public function setEmailLogistic(?string $emailLogistic): static
  317.     {
  318.         $this->emailLogistic $emailLogistic;
  319.         return $this;
  320.     }
  321.     public function getDirectoryPath(): ?string
  322.     {
  323.         return $this->directoryPath;
  324.     }
  325.     public function setDirectoryPath(string $directoryPath): static
  326.     {
  327.         $this->directoryPath $directoryPath;
  328.         return $this;
  329.     }
  330.     public function getLogoPath(): ?string
  331.     {
  332.         return $this->logoPath;
  333.     }
  334.     public function setLogoPath(?string $logoPath): static
  335.     {
  336.         $this->logoPath $logoPath;
  337.         return $this;
  338.     }
  339.     public function getDbName(): ?string
  340.     {
  341.         return $this->dbName;
  342.     }
  343.     public function setDbName(string $dbName): static
  344.     {
  345.         $this->dbName $dbName;
  346.         return $this;
  347.     }
  348.     public function isAdminAccess(): ?bool
  349.     {
  350.         return $this->adminAccess;
  351.     }
  352.     public function setAdminAccess(bool $adminAccess): static
  353.     {
  354.         $this->adminAccess $adminAccess;
  355.         return $this;
  356.     }
  357.     public function isAdminActive(): ?bool
  358.     {
  359.         return $this->adminActive;
  360.     }
  361.     public function setAdminActive(bool $adminActive): static
  362.     {
  363.         $this->adminActive $adminActive;
  364.         return $this;
  365.     }
  366.     /**
  367.      * @return Collection<int, CompanyMailer>
  368.      */
  369.     public function getMailers(): Collection
  370.     {
  371.         return $this->mailers;
  372.     }
  373.     public function addMailer(CompanyMailer $mailer): static
  374.     {
  375.         if (!$this->mailers->contains($mailer)) {
  376.             $this->mailers->add($mailer);
  377.             $mailer->setCompany($this);
  378.         }
  379.         return $this;
  380.     }
  381.     public function removeMailer(CompanyMailer $mailer): static
  382.     {
  383.         if ($this->mailers->removeElement($mailer)) {
  384.             // set the owning side to null (unless already changed)
  385.             if ($mailer->getCompany() === $this) {
  386.                 $mailer->setCompany(null);
  387.             }
  388.         }
  389.         return $this;
  390.     }
  391.     /**
  392.      * @return Collection<int, JoinTableCompanySupplier>
  393.      */
  394.     public function getSuppliers(): Collection
  395.     {
  396.         return $this->suppliers;
  397.     }
  398.     public function addSupplier(JoinTableCompanySupplier $supplier): static
  399.     {
  400.         if (!$this->suppliers->contains($supplier)) {
  401.             $this->suppliers->add($supplier);
  402.             $supplier->setCompany($this);
  403.         }
  404.         return $this;
  405.     }
  406.     public function removeSupplier(JoinTableCompanySupplier $supplier): static
  407.     {
  408.         if ($this->suppliers->removeElement($supplier)) {
  409.             // set the owning side to null (unless already changed)
  410.             if ($supplier->getCompany() === $this) {
  411.                 $supplier->setCompany(null);
  412.             }
  413.         }
  414.         return $this;
  415.     }
  416.     /**
  417.      * @return Collection<int, Address>
  418.      */
  419.     public function getAddresses(): Collection
  420.     {
  421.         return $this->addresses;
  422.     }
  423.     public function addAddress(Address $address): static
  424.     {
  425.         if (!$this->addresses->contains($address)) {
  426.             $this->addresses->add($address);
  427.             $address->setCompany($this);
  428.         }
  429.         return $this;
  430.     }
  431.     public function removeAddress(Address $address): static
  432.     {
  433.         if ($this->addresses->removeElement($address)) {
  434.             // set the owning side to null (unless already changed)
  435.             if ($address->getCompany() === $this) {
  436.                 $address->setCompany(null);
  437.             }
  438.         }
  439.         return $this;
  440.     }
  441.     /**
  442.      * @return Collection<int, Contact>
  443.      */
  444.     public function getContacts(): Collection
  445.     {
  446.         return $this->contacts;
  447.     }
  448.     public function addContact(Contact $contact): static
  449.     {
  450.         if (!$this->contacts->contains($contact)) {
  451.             $this->contacts->add($contact);
  452.             $contact->setCompany($this);
  453.         }
  454.         return $this;
  455.     }
  456.     public function removeContact(Contact $contact): static
  457.     {
  458.         if ($this->contacts->removeElement($contact)) {
  459.             // set the owning side to null (unless already changed)
  460.             if ($contact->getCompany() === $this) {
  461.                 $contact->setCompany(null);
  462.             }
  463.         }
  464.         return $this;
  465.     }
  466.     /**
  467.      * @return Collection<int, License>
  468.      */
  469.     public function getLicenses(): Collection
  470.     {
  471.         return $this->licenses;
  472.     }
  473.     public function addLicense(License $license): static
  474.     {
  475.         if (!$this->licenses->contains($license)) {
  476.             $this->licenses->add($license);
  477.             $license->setCompany($this);
  478.         }
  479.         return $this;
  480.     }
  481.     public function removeLicense(License $license): static
  482.     {
  483.         if ($this->licenses->removeElement($license)) {
  484.             // set the owning side to null (unless already changed)
  485.             if ($license->getCompany() === $this) {
  486.                 $license->setCompany(null);
  487.             }
  488.         }
  489.         return $this;
  490.     }
  491.     /**
  492.      * @return Collection<int, Order>
  493.      */
  494.     public function getOrders(): Collection
  495.     {
  496.         return $this->orders;
  497.     }
  498.     public function addOrder(Order $order): static
  499.     {
  500.         if (!$this->orders->contains($order)) {
  501.             $this->orders->add($order);
  502.             $order->setCompany($this);
  503.         }
  504.         return $this;
  505.     }
  506.     public function removeOrder(Order $order): static
  507.     {
  508.         if ($this->orders->removeElement($order)) {
  509.             // set the owning side to null (unless already changed)
  510.             if ($order->getCompany() === $this) {
  511.                 $order->setCompany(null);
  512.             }
  513.         }
  514.         return $this;
  515.     }
  516.     /**
  517.      * @return Collection<int, Order>
  518.      */
  519.     public function getSignalerForOrders(): Collection
  520.     {
  521.         return $this->signalerForOrders;
  522.     }
  523.     public function addSignalerForOrder(Order $signalerForOrder): static
  524.     {
  525.         if (!$this->signalerForOrders->contains($signalerForOrder)) {
  526.             $this->signalerForOrders->add($signalerForOrder);
  527.             $signalerForOrder->setSignaler($this);
  528.         }
  529.         return $this;
  530.     }
  531.     public function removeSignalerForOrder(Order $signalerForOrder): static
  532.     {
  533.         if ($this->signalerForOrders->removeElement($signalerForOrder)) {
  534.             // set the owning side to null (unless already changed)
  535.             if ($signalerForOrder->getSignaler() === $this) {
  536.                 $signalerForOrder->setSignaler(null);
  537.             }
  538.         }
  539.         return $this;
  540.     }
  541.     /**
  542.      * @return Collection<int, JoinTableCompanyFeature>
  543.      */
  544.     public function getInvestorForFeatures(): Collection
  545.     {
  546.         return $this->investorForFeatures;
  547.     }
  548.     public function addInvestorForFeature(JoinTableCompanyFeature $investorForFeature): static
  549.     {
  550.         if (!$this->investorForFeatures->contains($investorForFeature)) {
  551.             $this->investorForFeatures->add($investorForFeature);
  552.             $investorForFeature->setCompany($this);
  553.         }
  554.         return $this;
  555.     }
  556.     public function removeInvestorForFeature(JoinTableCompanyFeature $investorForFeature): static
  557.     {
  558.         if ($this->investorForFeatures->removeElement($investorForFeature)) {
  559.             // set the owning side to null (unless already changed)
  560.             if ($investorForFeature->getCompany() === $this) {
  561.                 $investorForFeature->setCompany(null);
  562.             }
  563.         }
  564.         return $this;
  565.     }
  566.     /**
  567.      * @return Collection<int, Region>
  568.      */
  569.     public function getRegions(): Collection
  570.     {
  571.         return $this->regions;
  572.     }
  573.     public function addRegion(Region $region): static
  574.     {
  575.         if (!$this->regions->contains($region)) {
  576.             $this->regions->add($region);
  577.         }
  578.         return $this;
  579.     }
  580.     public function removeRegion(Region $region): static
  581.     {
  582.         $this->regions->removeElement($region);
  583.         return $this;
  584.     }
  585.     
  586. }