<?php
namespace App\Entity;
use App\Repository\CompanyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CompanyRepository::class)
* @ORM\HasLifecycleCallbacks
*/
class CompanyGroup extends Company
{
const TYPE = 'type_group';
/**
* @return Collection<int, self>
*/
public function getCompanyGroupCompanies(): Collection
{
return $this->companyGroupCompanies;
}
public function addCompanyToGroup(self $companyGroup): self
{
if (!$this->companyGroupCompanies->contains($companyGroup)) {
$this->companyGroupCompanies[] = $companyGroup;
$companyGroup->setCompanyGroup($this);
}
return $this;
}
public function removeCompanyFromGroup(self $companyGroup): self
{
if ($this->companyGroupCompanies->removeElement($companyGroup)) {
// set the owning side to null (unless already changed)
if ($companyGroup->getCompanyGroup() === $this) {
$companyGroup->setCompanyGroup(null);
}
}
return $this;
}
}