<?php
namespace App\Entity\Master;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(name="eposm_m_company")
* @ORM\Entity(repositoryClass="App\Repository\Master\CompanyRepository")
*/
class Company
{
public function __toString(){
return $this->name;
}
public function getIsLicenseValid()
{
if($this->license != null && $this->license->getIsActive())
return true;
return false;
}
public function getIsActive()
{
if($this->isAdminActive && $this->license != null && $this->license->getIsActive())
return true;
return false;
}
public function getIsConfigurationCompleted(){
if($this->configurationPhase == 6)
return true;
return false;
}
public function getMainAddress(){
foreach($this->getAddresses() as $address){
if($address->isMain())
return $address;
}
}
/**
* @ORM\Column(name="id", type="bigint")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(name="code", type="string", nullable=true)
*/
protected $code;
/**
* @ORM\Column(name="name", type="string", length=191)
*/
protected $name;
/**
* @ORM\Column(name="email", type="string", length=191)
*/
protected $email;
/**
* @ORM\Column(name="fiscal_code", type="string", length=191)
*/
protected $fiscalCode;
/**
* @ORM\Column(name="vat", type="string", length=191)
*/
protected $vat;
/**
* @ORM\Column(name="vat_country", type="string", length=191)
*/
protected $vatCountry;
/**
* @ORM\Column(name="phone_administration", type="string", length=191, nullable=true)
*/
protected $phoneAdministration;
/**
* @ORM\Column(name="phone_support_customer", type="string", length=191, nullable=true)
*/
protected $phoneSupportCustomer;
/**
* @ORM\Column(name="phone_support_technician", type="string", length=191, nullable=true)
*/
protected $phoneSupportTechnician;
/**
* @ORM\Column(name="phone_logistic", type="string", length=191, nullable=true)
*/
protected $phoneLogistic;
/**
* @ORM\Column(name="email_administration", type="string", length=191, nullable=true)
*/
protected $emailAdministration;
/**
* @ORM\Column(name="email_support_customer", type="string", length=191, nullable=true)
*/
protected $emailSupportCustomer;
/**
* @ORM\Column(name="email_support_technician", type="string", length=191, nullable=true)
*/
protected $emailSupportTechnician;
/**
* @ORM\Column(name="email_logistic", type="string", length=191, nullable=true)
*/
protected $emailLogistic;
/**
* @ORM\Column(name="directory_path", type="string", length=191)
*/
protected $directoryPath;
/**
* @ORM\Column(name="logo_path", type="string", length=191, nullable=true)
*/
protected $logoPath;
/**
* @ORM\Column(name="db_name", type="string", length=191)
*/
protected $dbName;
/**
* @ORM\Column(name="admin_access", type="boolean")
*/
protected $adminAccess = false;
/**
* @ORM\Column(name="admin_active", type="boolean")
*/
protected $adminActive = true;
// OneToMany
/**
* @ORM\OneToMany(targetEntity="App\Entity\Master\CompanyMailer", mappedBy="company")
*/
private $mailers;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Master\JoinTableCompanySupplier", mappedBy="company")
*/
private $suppliers;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Master\Address", mappedBy="company")
*/
private $addresses;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Master\Contact", mappedBy="company")
*/
private $contacts;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Master\License", mappedBy="company")
*/
private $licenses;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Master\Order", mappedBy="company")
*/
private $orders;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Master\Order", mappedBy="signaler")
*/
private $signalerForOrders;
/**
* @ORM\OneToMany(targetEntity="App\Entity\Master\JoinTableCompanyFeature", mappedBy="company")
*/
private $investorForFeatures;
//
// ManyToMany
/**
* @ORM\ManyToMany(targetEntity="App\Entity\Master\Region", inversedBy="companies")
* @ORM\JoinTable(name="eposm_m_join_table_company_region")
*/
private $regions;
public function __construct()
{
$this->mailers = new ArrayCollection();
$this->suppliers = new ArrayCollection();
$this->addresses = new ArrayCollection();
$this->contacts = new ArrayCollection();
$this->licenses = new ArrayCollection();
$this->orders = new ArrayCollection();
$this->signalerForOrders = new ArrayCollection();
$this->investorForFeatures = new ArrayCollection();
$this->regions = new ArrayCollection();
}
//
public function getId(): ?string
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): static
{
$this->code = $code;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): static
{
$this->email = $email;
return $this;
}
public function getFiscalCode(): ?string
{
return $this->fiscalCode;
}
public function setFiscalCode(string $fiscalCode): static
{
$this->fiscalCode = $fiscalCode;
return $this;
}
public function getVat(): ?string
{
return $this->vat;
}
public function setVat(string $vat): static
{
$this->vat = $vat;
return $this;
}
public function getVatCountry(): ?string
{
return $this->vatCountry;
}
public function setVatCountry(string $vatCountry): static
{
$this->vatCountry = $vatCountry;
return $this;
}
public function getPhoneAdministration(): ?string
{
return $this->phoneAdministration;
}
public function setPhoneAdministration(?string $phoneAdministration): static
{
$this->phoneAdministration = $phoneAdministration;
return $this;
}
public function getPhoneSupportCustomer(): ?string
{
return $this->phoneSupportCustomer;
}
public function setPhoneSupportCustomer(?string $phoneSupportCustomer): static
{
$this->phoneSupportCustomer = $phoneSupportCustomer;
return $this;
}
public function getPhoneSupportTechnician(): ?string
{
return $this->phoneSupportTechnician;
}
public function setPhoneSupportTechnician(?string $phoneSupportTechnician): static
{
$this->phoneSupportTechnician = $phoneSupportTechnician;
return $this;
}
public function getPhoneLogistic(): ?string
{
return $this->phoneLogistic;
}
public function setPhoneLogistic(?string $phoneLogistic): static
{
$this->phoneLogistic = $phoneLogistic;
return $this;
}
public function getEmailAdministration(): ?string
{
return $this->emailAdministration;
}
public function setEmailAdministration(?string $emailAdministration): static
{
$this->emailAdministration = $emailAdministration;
return $this;
}
public function getEmailSupportCustomer(): ?string
{
return $this->emailSupportCustomer;
}
public function setEmailSupportCustomer(?string $emailSupportCustomer): static
{
$this->emailSupportCustomer = $emailSupportCustomer;
return $this;
}
public function getEmailSupportTechnician(): ?string
{
return $this->emailSupportTechnician;
}
public function setEmailSupportTechnician(?string $emailSupportTechnician): static
{
$this->emailSupportTechnician = $emailSupportTechnician;
return $this;
}
public function getEmailLogistic(): ?string
{
return $this->emailLogistic;
}
public function setEmailLogistic(?string $emailLogistic): static
{
$this->emailLogistic = $emailLogistic;
return $this;
}
public function getDirectoryPath(): ?string
{
return $this->directoryPath;
}
public function setDirectoryPath(string $directoryPath): static
{
$this->directoryPath = $directoryPath;
return $this;
}
public function getLogoPath(): ?string
{
return $this->logoPath;
}
public function setLogoPath(?string $logoPath): static
{
$this->logoPath = $logoPath;
return $this;
}
public function getDbName(): ?string
{
return $this->dbName;
}
public function setDbName(string $dbName): static
{
$this->dbName = $dbName;
return $this;
}
public function isAdminAccess(): ?bool
{
return $this->adminAccess;
}
public function setAdminAccess(bool $adminAccess): static
{
$this->adminAccess = $adminAccess;
return $this;
}
public function isAdminActive(): ?bool
{
return $this->adminActive;
}
public function setAdminActive(bool $adminActive): static
{
$this->adminActive = $adminActive;
return $this;
}
/**
* @return Collection<int, CompanyMailer>
*/
public function getMailers(): Collection
{
return $this->mailers;
}
public function addMailer(CompanyMailer $mailer): static
{
if (!$this->mailers->contains($mailer)) {
$this->mailers->add($mailer);
$mailer->setCompany($this);
}
return $this;
}
public function removeMailer(CompanyMailer $mailer): static
{
if ($this->mailers->removeElement($mailer)) {
// set the owning side to null (unless already changed)
if ($mailer->getCompany() === $this) {
$mailer->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, JoinTableCompanySupplier>
*/
public function getSuppliers(): Collection
{
return $this->suppliers;
}
public function addSupplier(JoinTableCompanySupplier $supplier): static
{
if (!$this->suppliers->contains($supplier)) {
$this->suppliers->add($supplier);
$supplier->setCompany($this);
}
return $this;
}
public function removeSupplier(JoinTableCompanySupplier $supplier): static
{
if ($this->suppliers->removeElement($supplier)) {
// set the owning side to null (unless already changed)
if ($supplier->getCompany() === $this) {
$supplier->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, Address>
*/
public function getAddresses(): Collection
{
return $this->addresses;
}
public function addAddress(Address $address): static
{
if (!$this->addresses->contains($address)) {
$this->addresses->add($address);
$address->setCompany($this);
}
return $this;
}
public function removeAddress(Address $address): static
{
if ($this->addresses->removeElement($address)) {
// set the owning side to null (unless already changed)
if ($address->getCompany() === $this) {
$address->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, Contact>
*/
public function getContacts(): Collection
{
return $this->contacts;
}
public function addContact(Contact $contact): static
{
if (!$this->contacts->contains($contact)) {
$this->contacts->add($contact);
$contact->setCompany($this);
}
return $this;
}
public function removeContact(Contact $contact): static
{
if ($this->contacts->removeElement($contact)) {
// set the owning side to null (unless already changed)
if ($contact->getCompany() === $this) {
$contact->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, License>
*/
public function getLicenses(): Collection
{
return $this->licenses;
}
public function addLicense(License $license): static
{
if (!$this->licenses->contains($license)) {
$this->licenses->add($license);
$license->setCompany($this);
}
return $this;
}
public function removeLicense(License $license): static
{
if ($this->licenses->removeElement($license)) {
// set the owning side to null (unless already changed)
if ($license->getCompany() === $this) {
$license->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): static
{
if (!$this->orders->contains($order)) {
$this->orders->add($order);
$order->setCompany($this);
}
return $this;
}
public function removeOrder(Order $order): static
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getCompany() === $this) {
$order->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getSignalerForOrders(): Collection
{
return $this->signalerForOrders;
}
public function addSignalerForOrder(Order $signalerForOrder): static
{
if (!$this->signalerForOrders->contains($signalerForOrder)) {
$this->signalerForOrders->add($signalerForOrder);
$signalerForOrder->setSignaler($this);
}
return $this;
}
public function removeSignalerForOrder(Order $signalerForOrder): static
{
if ($this->signalerForOrders->removeElement($signalerForOrder)) {
// set the owning side to null (unless already changed)
if ($signalerForOrder->getSignaler() === $this) {
$signalerForOrder->setSignaler(null);
}
}
return $this;
}
/**
* @return Collection<int, JoinTableCompanyFeature>
*/
public function getInvestorForFeatures(): Collection
{
return $this->investorForFeatures;
}
public function addInvestorForFeature(JoinTableCompanyFeature $investorForFeature): static
{
if (!$this->investorForFeatures->contains($investorForFeature)) {
$this->investorForFeatures->add($investorForFeature);
$investorForFeature->setCompany($this);
}
return $this;
}
public function removeInvestorForFeature(JoinTableCompanyFeature $investorForFeature): static
{
if ($this->investorForFeatures->removeElement($investorForFeature)) {
// set the owning side to null (unless already changed)
if ($investorForFeature->getCompany() === $this) {
$investorForFeature->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, Region>
*/
public function getRegions(): Collection
{
return $this->regions;
}
public function addRegion(Region $region): static
{
if (!$this->regions->contains($region)) {
$this->regions->add($region);
}
return $this;
}
public function removeRegion(Region $region): static
{
$this->regions->removeElement($region);
return $this;
}
}