src/Entity/Culture.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Task\MonitoringObjective;
  4. use App\Entity\Task\Objective;
  5. use App\Entity\Techcard\Techcard;
  6. use App\Repository\CultureRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * @ORM\Entity(repositoryClass=CultureRepository::class)
  12.  */
  13. class Culture
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      */
  24.     private $name;
  25.     /**
  26.      * @ORM\OneToMany(targetEntity=Techcard::class, mappedBy="culture")
  27.      */
  28.     private $techcards;
  29.     /**
  30.      * @ORM\Column(type="boolean", nullable=true, options={"default": true})
  31.      */
  32.     private $status;
  33.     
  34.     /**
  35.      * @ORM\OneToMany(targetEntity=Field::class, mappedBy="culture")
  36.      */
  37.     private $fields;
  38.     /**
  39.      * @ORM\ManyToOne(targetEntity=CompanyGroup::class, inversedBy="cultures")
  40.      */
  41.     private $companyGroup;
  42.     /**
  43.      * @ORM\OneToMany(targetEntity=Objective::class, mappedBy="culture")
  44.      */
  45.     private $objectives;
  46.     /**
  47.      * @ORM\OneToMany(targetEntity=MonitoringObjective::class, mappedBy="Culture")
  48.      */
  49.     private $monitoringObjectives;
  50.     /**
  51.      * @ORM\Column(type="boolean", nullable=true, options={"default": false})
  52.      */
  53.     private $remove;
  54.     /**
  55.      * @ORM\Column(type="string", length=255, nullable=true)
  56.      */
  57.     private $color;
  58.     
  59.     public function __construct()
  60.     {
  61.         $this->techcards = new ArrayCollection();
  62.         if(is_null($this->id)){
  63.             $this->status true;
  64.             $this->remove false;
  65.         }
  66.         $this->objectives = new ArrayCollection();
  67.         $this->monitoringObjectives = new ArrayCollection();
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getName(): ?string
  74.     {
  75.         return $this->name;
  76.     }
  77.     public function setName(string $name): self
  78.     {
  79.         $this->name $name;
  80.         return $this;
  81.     }
  82.     public function __toString()
  83.     {
  84.         return $this->name;
  85.     }
  86.     /**
  87.      * @return Collection|Techcard[]
  88.      */
  89.     public function getTechcards(): Collection
  90.     {
  91.         return $this->techcards;
  92.     }
  93.     public function addTechcard(Techcard $techcard): self
  94.     {
  95.         if (!$this->techcards->contains($techcard)) {
  96.             $this->techcards[] = $techcard;
  97.             $techcard->setCulture($this);
  98.         }
  99.         return $this;
  100.     }
  101.     public function removeTechcard(Techcard $techcard): self
  102.     {
  103.         if ($this->techcards->removeElement($techcard)) {
  104.             // set the owning side to null (unless already changed)
  105.             if ($techcard->getCulture() === $this) {
  106.                 $techcard->setCulture(null);
  107.             }
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeAllTechcard()
  112.     {
  113.         foreach ($this->getTechcards() as $techcard) {
  114.             $this->removeTechcard($techcard);
  115.         }
  116.     }
  117.     public function getStatus(): ?bool
  118.     {
  119.         return $this->status;
  120.     }
  121.     public function setStatus(?bool $status): self
  122.     {
  123.         $this->status $status;
  124.         return $this;
  125.     }
  126.     /**
  127.      * @return Collection|Field[]
  128.      */
  129.     public function getFields(): Collection
  130.     {
  131.         return $this->fields;
  132.     }
  133.     public function addField(Field $field): self
  134.     {
  135.         if (!$this->fields->contains($field)) {
  136.             $this->fields[] = $field;
  137.             $field->setCulture($this);
  138.         }
  139.         return $this;
  140.     }
  141.     public function removeField(Field $field): self
  142.     {
  143.         if ($this->fields->removeElement($field)) {
  144.             // set the owning side to null (unless already changed)
  145.             if ($field->getCulture() === $this) {
  146.                 $field->setCulture(null);
  147.             }
  148.         }
  149.         return $this;
  150.     }
  151.     public function removeAllField()
  152.     {
  153.         if($this->getFields()->count()) {
  154.             foreach ($this->getFields() as $field) {
  155.                 $this->removeField($field);
  156.             }
  157.         }
  158.     }
  159.     public function getCompanyGroup(): ?CompanyGroup
  160.     {
  161.         return $this->companyGroup;
  162.     }
  163.     public function setCompanyGroup(?CompanyGroup $companyGroup): self
  164.     {
  165.         $this->companyGroup $companyGroup;
  166.         return $this;
  167.     }
  168.     /**
  169.      * @return Collection<int, Objective>
  170.      */
  171.     public function getObjectives(): Collection
  172.     {
  173.         return $this->objectives;
  174.     }
  175.     public function addObjective(Objective $objective): self
  176.     {
  177.         if (!$this->objectives->contains($objective)) {
  178.             $this->objectives[] = $objective;
  179.             $objective->setCulture($this);
  180.         }
  181.         return $this;
  182.     }
  183.     public function removeObjective(Objective $objective): self
  184.     {
  185.         if ($this->objectives->removeElement($objective)) {
  186.             // set the owning side to null (unless already changed)
  187.             if ($objective->getCulture() === $this) {
  188.                 $objective->setCulture(null);
  189.             }
  190.         }
  191.         return $this;
  192.     }
  193.     /**
  194.      * @return Collection<int, MonitoringObjective>
  195.      */
  196.     public function getMonitoringObjectives(): Collection
  197.     {
  198.         return $this->monitoringObjectives;
  199.     }
  200.     public function addMonitoringObjective(MonitoringObjective $monitoringObjective): self
  201.     {
  202.         if (!$this->monitoringObjectives->contains($monitoringObjective)) {
  203.             $this->monitoringObjectives[] = $monitoringObjective;
  204.             $monitoringObjective->setCulture($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function removeMonitoringObjective(MonitoringObjective $monitoringObjective): self
  209.     {
  210.         if ($this->monitoringObjectives->removeElement($monitoringObjective)) {
  211.             // set the owning side to null (unless already changed)
  212.             if ($monitoringObjective->getCulture() === $this) {
  213.                 $monitoringObjective->setCulture(null);
  214.             }
  215.         }
  216.         return $this;
  217.     }
  218.     public function isRemove(): ?bool
  219.     {
  220.         return $this->remove;
  221.     }
  222.     public function setRemove(?bool $remove): self
  223.     {
  224.         $this->remove $remove;
  225.         return $this;
  226.     }
  227.     /**
  228.      * @return mixed
  229.      */
  230.     public function getColor()
  231.     {
  232.         return $this->color;
  233.     }
  234.     /**
  235.      * @param mixed $color
  236.      */
  237.     public function setColor($color): void
  238.     {
  239.         $this->color $color;
  240.     }
  241. }