<?php
namespace App\Entity;
use App\Entity\File\CompanyFile;
use App\Entity\File\Photo;
use App\Entity\File\ProductFile;
use App\Repository\CompanyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\MappedSuperclass()
* @ORM\Entity(repositoryClass=CompanyRepository::class)
* @ORM\InheritanceType("SINGLE_TABLE")
* @ORM\DiscriminatorColumn(name="type", type="string")
* @ORM\DiscriminatorMap({"type_group" = "CompanyGroup", "type_company" = "Company"})
* @ORM\HasLifecycleCallbacks
*/
class Company extends AbstractEntity
{
const TYPE = 'type_company';
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=8, nullable=true)
*/
private $code;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $provision;
/**
* @ORM\Column(type="string", length=512, nullable=true)
*/
private $name;
/**
* @ORM\Column(type="string", length=512, nullable=true)
*/
private $address;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $street;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $town;
/**
* @ORM\Column(type="string", length=6, nullable=true)
*/
private $postal;
/**
* @ORM\Column(type="string", length=512, nullable=true)
*/
private $address2;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $street2;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $town2;
/**
* @ORM\Column(type="string", length=6, nullable=true)
*/
private $postal2;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $ic;
/**
* @ORM\Column(type="string", length=36, nullable=true)
*/
private $dic;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $phone;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $bankName;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $bankAccount;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $swift;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $iban;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $registrationPlace;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $registrationNumber;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $registrationPartition;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $registrationInsertion;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $representantive;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $notes;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="company")
*/
private $users;
/**
* @ORM\OneToMany(targetEntity=Order::class, mappedBy="company")
*/
private $orders;
/**
* @ORM\OneToMany(targetEntity=Product::class, mappedBy="company")
*/
private $products;
/**
* @ORM\Column(type="boolean")
*/
private $deleted = false;
/**
* @ORM\Column(type="string", length=6, nullable=true)
*/
private $bankCode;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $webHeader;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $webPerex;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $webDesc;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $webImage;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $webLink;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $webLinkForm;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $webOrder = 0;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $demioForm;
/**
* @ORM\ManyToOne(targetEntity=Company::class, inversedBy="companyGroupCompanies")
* @ORM\JoinColumn(name="company_group_id", referencedColumnName="id")
*/
protected $companyGroup;
/**
* @ORM\OneToMany(targetEntity=Company::class, mappedBy="companyGroup")
*/
protected $companyGroupCompanies;
/**
* @ORM\OneToMany(targetEntity=InvoiceAutomation::class, mappedBy="subscriber")
*/
private $invoices;
/**
* @ORM\OneToMany(targetEntity=InvoiceAutomationExpand::class, mappedBy="company")
*/
private $invoiceAutomationExpands;
/**
* @ORM\OneToMany(targetEntity=InterestPaidoffReport::class, mappedBy="company")
*/
private $interestPaidoffReports;
/**
* @ORM\OneToOne(targetEntity=Photo::class, cascade={"persist", "remove"})
*/
private $profilePhoto;
/**
* @ORM\OneToMany(targetEntity=CompanyFile::class, mappedBy="company", cascade={"persist", "remove"})
* @ORM\OrderBy({"sortOrder" = "ASC"})
*/
private $companyFiles;
public function __construct()
{
$this->users = new ArrayCollection();
$this->orders = new ArrayCollection();
$this->products = new ArrayCollection();
$this->companyGroupCompanies = new ArrayCollection();
$this->invoices = new ArrayCollection();
$this->invoiceAutomationExpands = new ArrayCollection();
$this->interestPaidoffReports = new ArrayCollection();
$this->companyFiles = new ArrayCollection();
}
/**
* @return string (ID:{$this->getId()}) {$this->getName()}
*/
public function __toString(): string
{
return "{$this->getName()}";
}
public function getId(): ?int
{
return $this->id;
}
public function getCode(): ?string
{
return $this->code;
}
public function setCode(?string $code): self
{
$this->code = $code;
return $this;
}
public function getProvision(): ?int
{
return $this->provision;
}
public function setProvision(?int $provision): self
{
$this->provision = $provision;
return $this;
}
/**
* @return mixed
*/
public function getName()
{
return $this->name;
}
/**
* @param mixed $name
*/
public function setName($name): self
{
$this->name = $name;
return $this;
}
/**
* @return mixed
*/
public function getAddress()
{
if(is_null($this->address)){
return
$this->getStreet() . " " .
$this->getTown() . " " .
$this->getPostal();
}
return $this->address;
}
/**
* @param mixed $address
*/
public function setAddress($address): void
{
$this->address = $address;
}
/**
* @return mixed
*/
public function getStreet()
{
return $this->street;
}
/**
* @param mixed $street
*/
public function setStreet($street): void
{
$this->street = $street;
}
/**
* @return mixed
*/
public function getTown()
{
return $this->town;
}
/**
* @param mixed $town
*/
public function setTown($town): void
{
$this->town = $town;
}
/**
* @return mixed
*/
public function getPostal()
{
return $this->postal;
}
/**
* @param mixed $postal
*/
public function setPostal($postal): void
{
$this->postal = $postal;
}
/**
* @return mixed
*/
public function getAddress2()
{
if(is_null($this->address2)){
return
$this->getStreet2() . " " .
$this->getTown2() . " " .
$this->getPostal2();
}
return $this->address2;
}
/**
* @param mixed $address2
*/
public function setAddress2($address2): void
{
$this->address2 = $address2;
}
/**
* @return mixed
*/
public function getStreet2()
{
return $this->street2;
}
/**
* @param mixed $street2
*/
public function setStreet2($street2): void
{
$this->street2 = $street2;
}
/**
* @return mixed
*/
public function getTown2()
{
return $this->town2;
}
/**
* @param mixed $town2
*/
public function setTown2($town2): void
{
$this->town2 = $town2;
}
/**
* @return mixed
*/
public function getPostal2()
{
return $this->postal2;
}
/**
* @param mixed $postal2
*/
public function setPostal2($postal2): void
{
$this->postal2 = $postal2;
}
/**
* @return mixed
*/
public function getIc()
{
return $this->ic;
}
/**
* @param mixed $ic
*/
public function setIc($ic): self
{
$this->ic = $ic;
return $this;
}
/**
* @return mixed
*/
public function getDic()
{
return $this->dic;
}
/**
* @param mixed $dic
*/
public function setDic($dic): self
{
$this->dic = $dic;
return $this;
}
/**
* @return mixed
*/
public function getPhone()
{
return $this->phone;
}
/**
* @param mixed $phone
*/
public function setPhone($phone): void
{
$this->phone = $phone;
}
/**
* @return mixed
*/
public function getEmail()
{
return $this->email;
}
/**
* @param mixed $email
*/
public function setEmail($email): void
{
$this->email = $email;
}
/**
* @return mixed
*/
public function getBankName()
{
return $this->bankName;
}
/**
* @param mixed $bankName
*/
public function setBankName($bankName): void
{
$this->bankName = $bankName;
}
/**
* @return mixed
*/
public function getBankAccount()
{
return $this->bankAccount;
}
/**
* @param mixed $bankAccount
*/
public function setBankAccount($bankAccount): void
{
$this->bankAccount = $bankAccount;
}
/**
* @return mixed
*/
public function getSwift()
{
return $this->swift;
}
/**
* @param mixed $swift
*/
public function setSwift($swift): void
{
$this->swift = $swift;
}
/**
* @return mixed
*/
public function getIban()
{
return $this->iban;
}
/**
* @param mixed $iban
*/
public function setIban($iban): void
{
$this->iban = $iban;
}
/**
* @return mixed
*/
public function getRegistrationPlace()
{
return $this->registrationPlace;
}
/**
* @param mixed $registrationPlace
*/
public function setRegistrationPlace($registrationPlace): void
{
$this->registrationPlace = $registrationPlace;
}
/**
* @return mixed
*/
public function getRegistrationNumber()
{
return $this->registrationNumber;
}
/**
* @param mixed $registrationNumber
*/
public function setRegistrationNumber($registrationNumber): void
{
$this->registrationNumber = $registrationNumber;
}
/**
* @return mixed
*/
public function getRegistrationPartition()
{
return $this->registrationPartition;
}
/**
* @param mixed $registrationPartition
*/
public function setRegistrationPartition($registrationPartition): void
{
$this->registrationPartition = $registrationPartition;
}
/**
* @return mixed
*/
public function getRegistrationInsertion()
{
return $this->registrationInsertion;
}
/**
* @param mixed $registrationInsertion
*/
public function setRegistrationInsertion($registrationInsertion): void
{
$this->registrationInsertion = $registrationInsertion;
}
/**
* @return mixed
*/
public function getRepresentantive()
{
return $this->representantive;
}
/**
* @param mixed $representantive
*/
public function setRepresentantive($representantive): void
{
$this->representantive = $representantive;
}
/**
* @return mixed
*/
public function getNotes()
{
return $this->notes;
}
/**
* @param mixed $notes
*/
public function setNotes($notes): void
{
$this->notes = $notes;
}
/**
* @return Collection<int, User>
*/
public function getUsers(): Collection
{
return $this->users;
}
public function addUser(User $user): self
{
if (!$this->users->contains($user)) {
$this->users[] = $user;
$user->setCompany($this);
}
return $this;
}
public function removeUser(User $user): self
{
if ($this->users->removeElement($user)) {
// set the owning side to null (unless already changed)
if ($user->getCompany() === $this) {
$user->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, Order>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Order $order): self
{
if (!$this->orders->contains($order)) {
$this->orders[] = $order;
$order->setCompany($this);
}
return $this;
}
public function removeOrder(Order $order): self
{
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, Product>
*/
public function getProducts(): Collection
{
return $this->products;
}
public function addProduct(Product $product): self
{
if (!$this->products->contains($product)) {
$this->products[] = $product;
$product->setCompany($this);
}
return $this;
}
public function removeProduct(Product $product): self
{
if ($this->products->removeElement($product)) {
// set the owning side to null (unless already changed)
if ($product->getCompany() === $this) {
$product->setCompany(null);
}
}
return $this;
}
public function isDeleted(): ?bool
{
return $this->deleted;
}
public function setDeleted(bool $deleted): self
{
$this->deleted = $deleted;
return $this;
}
public function getBankCode(): ?string
{
return $this->bankCode;
}
public function setBankCode(?string $bankCode): self
{
$this->bankCode = $bankCode;
return $this;
}
public function getWebHeader(): ?string
{
return $this->webHeader;
}
public function setWebHeader(?string $webHeader): self
{
$this->webHeader = $webHeader;
return $this;
}
public function getWebPerex(): ?string
{
return $this->webPerex;
}
public function setWebPerex(?string $webPerex): self
{
$this->webPerex = $webPerex;
return $this;
}
public function getWebDesc(): ?string
{
return $this->webDesc;
}
public function setWebDesc(?string $webDesc): self
{
$this->webDesc = $webDesc;
return $this;
}
public function getWebImage(): ?string
{
return $this->webImage;
}
public function setWebImage(?string $webImage): self
{
$this->webImage = $webImage;
return $this;
}
public function getWebLink(): ?string
{
return $this->webLink;
}
public function setWebLink(?string $webLink): self
{
$this->webLink = $webLink;
return $this;
}
public function getWebLinkForm(): ?string
{
return $this->webLinkForm;
}
public function setWebLinkForm(?string $webLinkForm): self
{
$this->webLinkForm = $webLinkForm;
return $this;
}
public function getDemioForm(): ?string
{
return $this->demioForm;
}
public function setDemioForm(?string $demioForm): self
{
$this->demioForm = $demioForm;
return $this;
}
public function getWebOrder(): ?int
{
return $this->webOrder;
}
public function setWebOrder(?int $webOrder): self
{
$this->webOrder = $webOrder;
return $this;
}
public function getCompanyGroup(): ?self
{
return $this->companyGroup;
}
public function setCompanyGroup(?self $companyGroup): self
{
$this->companyGroup = $companyGroup;
return $this;
}
/**
* @return Collection<int, InvoiceAutomation>
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(InvoiceAutomation $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices[] = $invoice;
$invoice->setSubscriber($this);
}
return $this;
}
public function removeInvoice(InvoiceAutomation $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getSubscriber() === $this) {
$invoice->setSubscriber(null);
}
}
return $this;
}
/**
* @return Collection<int, InvoiceAutomationExpand>
*/
public function getInvoiceAutomationExpands(): Collection
{
return $this->invoiceAutomationExpands;
}
public function addInvoiceAutomationExpand(InvoiceAutomationExpand $invoiceAutomationExpand): self
{
if (!$this->invoiceAutomationExpands->contains($invoiceAutomationExpand)) {
$this->invoiceAutomationExpands[] = $invoiceAutomationExpand;
$invoiceAutomationExpand->setCompany($this);
}
return $this;
}
public function removeInvoiceAutomationExpand(InvoiceAutomationExpand $invoiceAutomationExpand): self
{
if ($this->invoiceAutomationExpands->removeElement($invoiceAutomationExpand)) {
// set the owning side to null (unless already changed)
if ($invoiceAutomationExpand->getCompany() === $this) {
$invoiceAutomationExpand->setCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, InterestPaidoffReport>
*/
public function getInterestPaidoffReports(): Collection
{
return $this->interestPaidoffReports;
}
public function addInterestPaidoffReport(InterestPaidoffReport $interestPaidoffReport): self
{
if (!$this->interestPaidoffReports->contains($interestPaidoffReport)) {
$this->interestPaidoffReports[] = $interestPaidoffReport;
$interestPaidoffReport->setCompany($this);
}
return $this;
}
public function removeInterestPaidoffReport(InterestPaidoffReport $interestPaidoffReport): self
{
if ($this->interestPaidoffReports->removeElement($interestPaidoffReport)) {
// set the owning side to null (unless already changed)
if ($interestPaidoffReport->getCompany() === $this) {
$interestPaidoffReport->setCompany(null);
}
}
return $this;
}
public function getProfilePhoto(): ?Photo
{
return $this->profilePhoto;
}
public function setProfilePhoto(?Photo $profilePhoto): self
{
$this->profilePhoto = $profilePhoto;
return $this;
}
/**
* @return Collection<int, CompanyFile>
*/
public function getCompanyFiles(): Collection
{
return $this->companyFiles;
}
public function addCompanyFile(CompanyFile $companyFile): self
{
if (!$this->companyFiles->contains($companyFile)) {
$this->companyFiles[] = $companyFile;
$companyFile->setCompany($this);
}
return $this;
}
public function removeCompanyFile(CompanyFile $companyFile): self
{
if ($this->companyFiles->removeElement($companyFile)) {
// set the owning side to null (unless already changed)
if ($companyFile->getCompany() === $this) {
$companyFile->setCompany(null);
}
}
return $this;
}
}