|
- <?php
-
- namespace Lc\PietroBundle\Model;
-
- use App\Repository\TerritoryRepository;
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\SovBundle\Doctrine\EntityInterface;
- use Lc\SovBundle\Doctrine\Extension\DevAliasInterface;
- use Lc\SovBundle\Doctrine\Extension\DevAliasTrait;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class Territory implements EntityInterface, DevAliasInterface
- {
- use DevAliasTrait;
-
-
- /**
- * @ORM\Column(type="string", length=255)
- */
- private $name;
-
- /**
- * @ORM\OneToMany(targetEntity=IndividualData::class, mappedBy="territory")
- */
- private $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(?IndividualData $individualData): self
- {
- $this->individualData = $individualData;
-
- return $this;
- }
-
- /**
- * @return Collection|Territory[]
- */
- public function getTerritory(): Collection
- {
- return $this->territory;
- }
-
- public function addTerritory(Territory $territory): self
- {
- if (!$this->territory->contains($territory)) {
- $this->territory[] = $territory;
- $territory->setIndividualData($this);
- }
-
- return $this;
- }
-
- public function removeTerritory(Territory $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;
- }
- }
|