<?phpnamespace App\Entity;use App\Repository\ReproductRepository;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ReproductRepository::class) */class Reproduct{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $name; /** * @ORM\Column(type="boolean", nullable=true, options={"default": true}) */ private $status; /** * @ORM\OneToMany(targetEntity=Field::class, mappedBy="reproduct") */ private $fields; /** * @ORM\ManyToOne(targetEntity=CompanyGroup::class, inversedBy="reproducts") */ private $companyGroup; /** * @ORM\Column(type="boolean", nullable=true) */ private $remove; public function __construct() { if(is_null($this->id)){ $this->status = true; $this->remove = false; } } 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; } 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->getReproduct() === $this) { $field->setReproduct(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; } public function isRemove(): ?bool { return $this->remove; } public function setRemove(?bool $remove): self { $this->remove = $remove; return $this; }}