<?php
namespace App\Entity;
use App\Entity\Base\AbstractEntity;
use App\Repository\CompanyTypeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CompanyTypeRepository::class)
*/
class CompanyType extends AbstractEntity
{
//kliens
const COMPANY_TYPE_K = 1;
//beszalito
const COMPANY_TYPE_B = 2;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Company::class, mappedBy="companyType")
*/
private $companies;
public function __construct()
{
$this->companies = new ArrayCollection();
}
public function __toString(): string
{
return $this->getName();
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection<int, Company>
*/
public function getCompanies(): Collection
{
return $this->companies;
}
public function addCompany(Company $company): self
{
if (!$this->companies->contains($company)) {
$this->companies[] = $company;
$company->setCompanyType($this);
}
return $this;
}
public function removeCompany(Company $company): self
{
if ($this->companies->removeElement($company)) {
// set the owning side to null (unless already changed)
if ($company->getCompanyType() === $this) {
$company->setCompanyType(null);
}
}
return $this;
}
}