<?php
namespace App\Entity;
use App\Repository\ObjectGroupRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ObjectGroupRepository::class)
*/
class ObjectGroup
{
/**
* @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":false})
*/
private $removed;
/**
* @ORM\ManyToOne(targetEntity=Client::class, inversedBy="objectGroups")
*/
private $subdivision;
/**
* @ORM\OneToMany(targetEntity=Field::class, mappedBy="objectGroup")
*/
private $fields;
public function __construct()
{
$this->fields = 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 isRemoved(): ?bool
{
return $this->removed;
}
public function setRemoved(bool $removed): self
{
$this->removed = $removed;
return $this;
}
public function getSubdivision(): ?Client
{
return $this->subdivision;
}
public function setSubdivision(?Client $subdivision): self
{
$this->subdivision = $subdivision;
return $this;
}
/**
* @return Collection<int, Field>
*/
public function getFields(): Collection
{
return $this->fields;
}
public function addField(Field $field): self
{
if (!$this->fields->contains($field)) {
$this->fields[] = $field;
$field->setObjectGroup($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->getObjectGroup() === $this) {
$field->setObjectGroup(null);
}
}
return $this;
}
}