src/Entity/Departement.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DepartementRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8. * @ORM\Entity(repositoryClass=DepartementRepository::class)
  9. */
  10. class Departement
  11. {
  12. /**
  13. * @ORM\Id
  14. * @ORM\GeneratedValue
  15. * @ORM\Column(type="integer")
  16. */
  17. private $id;
  18. /**
  19. * @ORM\ManyToOne(targetEntity=Country::class, inversedBy="departements")
  20. * @ORM\JoinColumn(nullable=true)
  21. */
  22. private $country;
  23. /**
  24. * @ORM\Column(type="string", length=255)
  25. */
  26. private $name;
  27. /**
  28. * @ORM\OneToMany(targetEntity=Location::class, mappedBy="departement")
  29. */
  30. private $locations;
  31. /**
  32. * @ORM\ManyToOne(targetEntity=Media::class)
  33. */
  34. private $media;
  35. /**
  36. * @ORM\Column(type="string", length=4)
  37. */
  38. private $number;
  39. public function __construct()
  40. {
  41. $this->locations = new ArrayCollection();
  42. }
  43. public function getId(): ?int
  44. {
  45. return $this->id;
  46. }
  47. public function getCountry(): ?Country
  48. {
  49. return $this->country;
  50. }
  51. public function setCountry(?Country $country): self
  52. {
  53. $this->country = $country;
  54. return $this;
  55. }
  56. public function getName(): ?string
  57. {
  58. return $this->name;
  59. }
  60. public function setName(string $name): self
  61. {
  62. $this->name = $name;
  63. return $this;
  64. }
  65. /**
  66. * @return Collection|Location[]
  67. */
  68. public function getLocations(): Collection
  69. {
  70. return $this->locations;
  71. }
  72. public function addLocation(Location $location): self
  73. {
  74. if (!$this->locations->contains($location)) {
  75. $this->locations[] = $location;
  76. $location->setDepartement($this);
  77. }
  78. return $this;
  79. }
  80. public function removeLocation(Location $location): self
  81. {
  82. if ($this->locations->removeElement($location)) {
  83. // set the owning side to null (unless already changed)
  84. if ($location->getDepartement() === $this) {
  85. $location->setDepartement(null);
  86. }
  87. }
  88. return $this;
  89. }
  90. public function getMedia(): ?Media
  91. {
  92. return $this->media;
  93. }
  94. public function setMedia(?Media $media): self
  95. {
  96. $this->media = $media;
  97. return $this;
  98. }
  99. public function getNumber(): ?string
  100. {
  101. return $this->number;
  102. }
  103. public function setNumber(string $number): self
  104. {
  105. $this->number = $number;
  106. return $this;
  107. }
  108. }