src/Entity/Reproduct.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ReproductRepository;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * @ORM\Entity(repositoryClass=ReproductRepository::class)
  8.  */
  9. class Reproduct
  10. {
  11.     /**
  12.      * @ORM\Id
  13.      * @ORM\GeneratedValue
  14.      * @ORM\Column(type="integer")
  15.      */
  16.     private $id;
  17.     /**
  18.      * @ORM\Column(type="string", length=255)
  19.      */
  20.     private $name;
  21.     /**
  22.      * @ORM\Column(type="boolean", nullable=true, options={"default": true})
  23.      */
  24.     private $status;
  25.     /**
  26.      * @ORM\OneToMany(targetEntity=Field::class, mappedBy="reproduct")
  27.      */
  28.     private $fields;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity=CompanyGroup::class, inversedBy="reproducts")
  31.      */
  32.     private $companyGroup;
  33.     /**
  34.      * @ORM\Column(type="boolean", nullable=true)
  35.      */
  36.     private $remove;
  37.     
  38.     public function __construct()
  39.     {
  40.         if(is_null($this->id)){
  41.             $this->status true;
  42.             $this->remove false;
  43.         }
  44.     }
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getName(): ?string
  50.     {
  51.         return $this->name;
  52.     }
  53.     public function setName(string $name): self
  54.     {
  55.         $this->name $name;
  56.         return $this;
  57.     }
  58.     public function __toString()
  59.     {
  60.         return $this->name;
  61.     }
  62.     public function getStatus(): ?bool
  63.     {
  64.         return $this->status;
  65.     }
  66.     public function setStatus(?bool $status): self
  67.     {
  68.         $this->status $status;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection|Field[]
  73.      */
  74.     public function getFields(): Collection
  75.     {
  76.         return $this->fields;
  77.     }
  78.     public function addField(Field $field): self
  79.     {
  80.         if (!$this->fields->contains($field)) {
  81.             $this->fields[] = $field;
  82.             $field->setCulture($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeField(Field $field): self
  87.     {
  88.         if ($this->fields->removeElement($field)) {
  89.             // set the owning side to null (unless already changed)
  90.             if ($field->getReproduct() === $this) {
  91.                 $field->setReproduct(null);
  92.             }
  93.         }
  94.         return $this;
  95.     }
  96.     public function removeAllField()
  97.     {
  98.         if($this->getFields()->count()) {
  99.             foreach ($this->getFields() as $field) {
  100.                 $this->removeField($field);
  101.             }
  102.         }
  103.     }
  104.     public function getCompanyGroup(): ?CompanyGroup
  105.     {
  106.         return $this->companyGroup;
  107.     }
  108.     public function setCompanyGroup(?CompanyGroup $companyGroup): self
  109.     {
  110.         $this->companyGroup $companyGroup;
  111.         return $this;
  112.     }
  113.     public function isRemove(): ?bool
  114.     {
  115.         return $this->remove;
  116.     }
  117.     public function setRemove(?bool $remove): self
  118.     {
  119.         $this->remove $remove;
  120.         return $this;
  121.     }
  122. }