You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 line
1.6KB

  1. <?php
  2. namespace App\Entity;
  3. use Lc\PietroBundle\Repository\Territory\TerritoryRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Lc\PietroBundle\Model\Territory\Territory as PietroTerritory;
  8. /**
  9. * @ORM\Entity(repositoryClass=TerritoryRepository::class)
  10. */
  11. class Territory extends PietroTerritory
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\GeneratedValue
  16. * @ORM\Column(type="integer")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\OneToMany(targetEntity=CollectifData::class, mappedBy="territory")
  21. */
  22. private $collectifData;
  23. public function __construct()
  24. {
  25. parent::__construct();
  26. $this->collectifData = new ArrayCollection();
  27. }
  28. public function getId(): ?int
  29. {
  30. return $this->id;
  31. }
  32. /**
  33. * @return Collection|CollectifData[]
  34. */
  35. public function getCollectifData(): Collection
  36. {
  37. return $this->collectifData;
  38. }
  39. public function addCollectifData(CollectifData $collectifData): self
  40. {
  41. if (!$this->collectifData->contains($collectifData)) {
  42. $this->collectifData[] = $collectifData;
  43. $collectifData->setTerritory($this);
  44. }
  45. return $this;
  46. }
  47. public function removeCollectifData(CollectifData $collectifData): self
  48. {
  49. if ($this->collectifData->removeElement($collectifData)) {
  50. // set the owning side to null (unless already changed)
  51. if ($collectifData->getTerritory() === $this) {
  52. $collectifData->setTerritory(null);
  53. }
  54. }
  55. return $this;
  56. }
  57. }