<?php
namespace App\Entity;
use App\Repository\SubsidiaryCompanyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JMS\Serializer\Annotation as Serializer;
/**
* @ORM\Table(indexes={ @ORM\Index(name="idx_subsidiarycompany_module_id", columns={"module_id"}), @ORM\Index(name="idx_subsidiarycompany_program_id", columns={"program_id"}) })
* @ORM\Entity(repositoryClass=SubsidiaryCompanyRepository::class)
* @Serializer\ExclusionPolicy("ALL")
*/
class SubsidiaryCompany extends BaseEntity
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Serializer\Expose
* @Serializer\Groups({"subsidiary_company", "user_profile"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Serializer\Expose
* @Serializer\Groups({"subsidiary_company", "user_profile"})
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity=Office::class, inversedBy="subsidiaryCompanies")
*/
private $offices;
/**
* @ORM\ManyToOne(targetEntity=Module::class, inversedBy="subsidiaryCompanies")
* @ORM\JoinColumn(name="module_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
private $module;
/**
* @ORM\ManyToOne(targetEntity=Program::class, inversedBy="subsidiaryCompanies")
* @ORM\JoinColumn(name="program_id", referencedColumnName="id", nullable=true, onDelete="SET NULL")
*/
private $program;
/**
* @ORM\ManyToOne(targetEntity=Quote::class, inversedBy="subsidiaryCompanies")
*/
private $quote;
/**
* @ORM\ManyToOne(targetEntity=Director::class, inversedBy="subsidiaryCompanies")
*/
private $director;
/**
* @ORM\ManyToOne(targetEntity=Live::class, inversedBy="subsidiaryCompanies")
*/
private $live;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Expose
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @Serializer\Expose
* @Serializer\Groups({"subsidiary_company"})
*/
private $mailingListAllStaff;
/**
* @ORM\ManyToOne(targetEntity=Country::class, inversedBy="subsidiaryCompanies")
*/
private $country;
/**
* @ORM\OneToMany(targetEntity=User::class, mappedBy="subsidiaryCompany", fetch="EXTRA_LAZY")
*/
private $users;
/**
* @ORM\OneToMany(targetEntity=Target::class, mappedBy="subsidiaryCompany", fetch="EXTRA_LAZY")
*/
private Collection $targets;
public function __construct()
{
$this->offices = new ArrayCollection();
$this->users = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return Collection<int, Office>
*/
public function getOffices(): Collection
{
return $this->offices;
}
public function addOffice(Office $office): self
{
if (!$this->offices->contains($office)) {
$this->offices[] = $office;
}
return $this;
}
public function removeOffice(Office $office): self
{
$this->offices->removeElement($office);
return $this;
}
public function getModule(): ?Module
{
return $this->module;
}
public function setModule(?Module $module): self
{
$this->module = $module;
return $this;
}
public function getProgram(): ?Program
{
return $this->program;
}
public function setProgram(?Program $program): self
{
$this->program = $program;
return $this;
}
public function getQuote(): ?Quote
{
return $this->quote;
}
public function setQuote(?Quote $quote): self
{
$this->quote = $quote;
return $this;
}
public function getDirector(): ?Director
{
return $this->director;
}
public function setDirector(?Director $director): self
{
$this->director = $director;
return $this;
}
public function getLive(): ?Live
{
return $this->live;
}
public function setLive(?Live $live): self
{
$this->live = $live;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getMailingListAllStaff(): ?string
{
return $this->mailingListAllStaff;
}
public function setMailingListAllStaff(?string $mailingListAllStaff): self
{
$this->mailingListAllStaff = $mailingListAllStaff;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
/**
* @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->setSubsidiaryCompany($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->getSubsidiaryCompany() === $this) {
$user->setSubsidiaryCompany(null);
}
}
return $this;
}
/**
* @return Collection<int, Target>
*/
public function getTargets(): Collection
{
return $this->targets;
}
public function addTarget(Target $target): self
{
if (!$this->targets->contains($target)) {
$this->targets[] = $target;
$target->setSubsidiaryCompany($this);
}
return $this;
}
public function removeTarget(Target $target): self
{
if ($this->targets->removeElement($target)) {
// set the owning side to null (unless already changed)
if ($target->getSubsidiaryCompany() === $this) {
$target->setSubsidiaryCompany(null);
}
}
return $this;
}
}