<?php
namespace App\Entity;
use App\Repository\CompanyRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Blameable\Traits\BlameableEntity;
use Gedmo\Timestampable\Traits\TimestampableEntity;
#[ORM\Entity(repositoryClass: CompanyRepository::class)]
class Company
{
use BlameableEntity;
use TimestampableEntity;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string', length: 255)]
private string $name;
#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'companies')]
private iterable $members;
#[ORM\OneToMany(targetEntity: CustomFieldSetting::class, mappedBy: 'company', orphanRemoval: true)]
private iterable $customFieldSettings;
#[ORM\OneToMany(targetEntity: AnalysisServiceGroup::class, mappedBy: 'company')]
private iterable $preselectedAnalysisGroups;
#[ORM\ManyToMany(targetEntity: AnalysisService::class, inversedBy: 'companies')]
private iterable $selectedAnalysisServices;
#[ORM\Column(type: 'string', length: 255, nullable: true, unique: true)]
private ?string $galabCustomerId;
#[ORM\OneToMany(mappedBy: 'company', targetEntity: AnalysisServicePrice::class)]
private iterable $prices;
#[ORM\Column(type: 'boolean', options: ['default' => false])]
private bool $disabled = false;
public function __construct()
{
$this->members = new ArrayCollection();
$this->customFieldSettings = new ArrayCollection();
$this->preselectedAnalysisGroups = new ArrayCollection();
$this->selectedAnalysisServices = new ArrayCollection();
$this->prices = new ArrayCollection();
}
public function getPrices(): ArrayCollection
{
return $this->prices;
}
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|User[]
*/
public function getMembers(): Collection
{
return $this->members;
}
public function addMember(User $member): self
{
if (!$this->members->contains($member)) {
$this->members[] = $member;
}
return $this;
}
public function removeMember(User $member): self
{
if ($this->members->contains($member)) {
$this->members->removeElement($member);
}
return $this;
}
/**
* @return Collection|CustomFieldSetting[]
*/
public function getCustomFieldSettings(): Collection
{
return $this->customFieldSettings;
}
public function addCustomFieldSetting(CustomFieldSetting $customFieldSetting): self
{
if (!$this->customFieldSettings->contains($customFieldSetting)) {
$this->customFieldSettings[] = $customFieldSetting;
$customFieldSetting->setCompany($this);
}
return $this;
}
public function removeCustomFieldSetting(CustomFieldSetting $customFieldSetting): self
{
if ($this->customFieldSettings->contains($customFieldSetting)) {
$this->customFieldSettings->removeElement($customFieldSetting);
// set the owning side to null (unless already changed)
if ($customFieldSetting->getCompany() === $this) {
$customFieldSetting->setCompany(null);
}
}
return $this;
}
/**
* @return Collection|AnalysisServiceGroup[]
*/
public function getPreselectedAnalysisGroups(): Collection
{
return $this->preselectedAnalysisGroups;
}
public function addPreselectedAnalysisGroup(AnalysisServiceGroup $preselectedAnalysisGroup): self
{
if (!$this->preselectedAnalysisGroups->contains($preselectedAnalysisGroup)) {
$this->preselectedAnalysisGroups[] = $preselectedAnalysisGroup;
}
return $this;
}
public function removePreselectedAnalysisGroup(AnalysisServiceGroup $preselectedAnalysisGroup): self
{
if ($this->preselectedAnalysisGroups->contains($preselectedAnalysisGroup)) {
$this->preselectedAnalysisGroups->removeElement($preselectedAnalysisGroup);
}
return $this;
}
/**
* @return Collection|AnalysisService[]
*/
public function getSelectedAnalysisServices(): Collection
{
return $this->selectedAnalysisServices;
}
public function addSelectedAnalysisService(AnalysisService $selectedAnalysisService): self
{
if (!$this->selectedAnalysisServices->contains($selectedAnalysisService)) {
$this->selectedAnalysisServices[] = $selectedAnalysisService;
}
return $this;
}
public function removeSelectedAnalysisService(AnalysisService $selectedAnalysisService): self
{
if ($this->selectedAnalysisServices->contains($selectedAnalysisService)) {
$this->selectedAnalysisServices->removeElement($selectedAnalysisService);
}
return $this;
}
public function getGalabCustomerId(): ?string
{
return $this->galabCustomerId;
}
public function setGalabCustomerId(?string $galabCustomerId): self
{
$this->galabCustomerId = $galabCustomerId;
return $this;
}
public function isDisabled(): bool
{
return $this->disabled;
}
public function setDisabled(bool $disabled): self
{
$this->disabled = $disabled;
return $this;
}
}