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