<?php
namespace App\Entity;
use App\Entity\Task\MonitoringObjective;
use App\Entity\Task\Objective;
use App\Entity\Techcard\Techcard;
use App\Repository\CultureRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=CultureRepository::class)
*/
class Culture
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\OneToMany(targetEntity=Techcard::class, mappedBy="culture")
*/
private $techcards;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": true})
*/
private $status;
/**
* @ORM\OneToMany(targetEntity=Field::class, mappedBy="culture")
*/
private $fields;
/**
* @ORM\ManyToOne(targetEntity=CompanyGroup::class, inversedBy="cultures")
*/
private $companyGroup;
/**
* @ORM\OneToMany(targetEntity=Objective::class, mappedBy="culture")
*/
private $objectives;
/**
* @ORM\OneToMany(targetEntity=MonitoringObjective::class, mappedBy="Culture")
*/
private $monitoringObjectives;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": false})
*/
private $remove;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $color;
public function __construct()
{
$this->techcards = new ArrayCollection();
if(is_null($this->id)){
$this->status = true;
$this->remove = false;
}
$this->objectives = new ArrayCollection();
$this->monitoringObjectives = 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;
}
public function __toString()
{
return $this->name;
}
/**
* @return Collection|Techcard[]
*/
public function getTechcards(): Collection
{
return $this->techcards;
}
public function addTechcard(Techcard $techcard): self
{
if (!$this->techcards->contains($techcard)) {
$this->techcards[] = $techcard;
$techcard->setCulture($this);
}
return $this;
}
public function removeTechcard(Techcard $techcard): self
{
if ($this->techcards->removeElement($techcard)) {
// set the owning side to null (unless already changed)
if ($techcard->getCulture() === $this) {
$techcard->setCulture(null);
}
}
return $this;
}
public function removeAllTechcard()
{
foreach ($this->getTechcards() as $techcard) {
$this->removeTechcard($techcard);
}
}
public function getStatus(): ?bool
{
return $this->status;
}
public function setStatus(?bool $status): self
{
$this->status = $status;
return $this;
}
/**
* @return Collection|Field[]
*/
public function getFields(): Collection
{
return $this->fields;
}
public function addField(Field $field): self
{
if (!$this->fields->contains($field)) {
$this->fields[] = $field;
$field->setCulture($this);
}
return $this;
}
public function removeField(Field $field): self
{
if ($this->fields->removeElement($field)) {
// set the owning side to null (unless already changed)
if ($field->getCulture() === $this) {
$field->setCulture(null);
}
}
return $this;
}
public function removeAllField()
{
if($this->getFields()->count()) {
foreach ($this->getFields() as $field) {
$this->removeField($field);
}
}
}
public function getCompanyGroup(): ?CompanyGroup
{
return $this->companyGroup;
}
public function setCompanyGroup(?CompanyGroup $companyGroup): self
{
$this->companyGroup = $companyGroup;
return $this;
}
/**
* @return Collection<int, Objective>
*/
public function getObjectives(): Collection
{
return $this->objectives;
}
public function addObjective(Objective $objective): self
{
if (!$this->objectives->contains($objective)) {
$this->objectives[] = $objective;
$objective->setCulture($this);
}
return $this;
}
public function removeObjective(Objective $objective): self
{
if ($this->objectives->removeElement($objective)) {
// set the owning side to null (unless already changed)
if ($objective->getCulture() === $this) {
$objective->setCulture(null);
}
}
return $this;
}
/**
* @return Collection<int, MonitoringObjective>
*/
public function getMonitoringObjectives(): Collection
{
return $this->monitoringObjectives;
}
public function addMonitoringObjective(MonitoringObjective $monitoringObjective): self
{
if (!$this->monitoringObjectives->contains($monitoringObjective)) {
$this->monitoringObjectives[] = $monitoringObjective;
$monitoringObjective->setCulture($this);
}
return $this;
}
public function removeMonitoringObjective(MonitoringObjective $monitoringObjective): self
{
if ($this->monitoringObjectives->removeElement($monitoringObjective)) {
// set the owning side to null (unless already changed)
if ($monitoringObjective->getCulture() === $this) {
$monitoringObjective->setCulture(null);
}
}
return $this;
}
public function isRemove(): ?bool
{
return $this->remove;
}
public function setRemove(?bool $remove): self
{
$this->remove = $remove;
return $this;
}
/**
* @return mixed
*/
public function getColor()
{
return $this->color;
}
/**
* @param mixed $color
*/
public function setColor($color): void
{
$this->color = $color;
}
}