|
- <?php
-
- namespace Lc\PietroBundle\Model\Territory;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\PietroBundle\Model\IndividualData\IndividualDataInterface;
- use Lc\SovBundle\Doctrine\EntityInterface;
- use Lc\SovBundle\Doctrine\Extension\DevAliasInterface;
- use Lc\SovBundle\Doctrine\Extension\DevAliasTrait;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class Territory implements TerritoryInterface, DevAliasInterface, EntityInterface
- {
- use DevAliasTrait;
-
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- protected $name;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\IndividualData\IndividualDataInterface", mappedBy="territory")
- */
- protected $individualData;
-
- public function __construct()
- {
- $this->individualData = new ArrayCollection();
- }
-
- public function __toString()
- {
- return $this->name;
- }
-
- public function getName(): ?string
- {
- return $this->name;
- }
-
- public function setName(string $name): self
- {
- $this->name = $name;
-
- return $this;
- }
-
- public function getIndividualData(): ?Collection
- {
- return $this->individualData;
- }
-
- public function setIndividualData(?IndividualDataInterface $individualData): self
- {
- $this->individualData = $individualData;
-
- return $this;
- }
-
- /**
- * @return Collection|TerritoryInterface[]
- */
- public function getTerritory(): Collection
- {
- return $this->territory;
- }
-
- public function addTerritory(TerritoryInterface $territory): self
- {
- if (!$this->territory->contains($territory)) {
- $this->territory[] = $territory;
- $territory->setIndividualData($this);
- }
-
- return $this;
- }
-
- public function removeTerritory(TerritoryInterface $territory): self
- {
- if ($this->territory->removeElement($territory)) {
- // set the owning side to null (unless already changed)
- if ($territory->getIndividualData() === $this) {
- $territory->setIndividualData(null);
- }
- }
-
- return $this;
- }
- }
|