1: <?php
2: namespace TIC\TownBundle\Entity;
3:
4: use TIC\TownBundle\Repository\RegionRepository as EntityRepo;
5: use TIC\TownBundle\Traits\InseeTnccable;
6:
7: use Doctrine\ORM\Mapping as ORM;
8: use Doctrine\Common\Collections\ArrayCollection;
9:
10: /**
11: * Région française.
12: * @ORM\Table(name="tic_town_region", indexes={
13: * @ORM\Index(name="nom_idx", columns={"nom"}),
14: * })
15: * @ORM\Entity(repositoryClass=EntityRepo::class)
16: */
17: class Region
18: {
19: use InseeTnccable;
20:
21:
22: // --------------------------------------------------------------------- Properties
23:
24: /**
25: * @ORM\Id
26: * @ORM\Column(type="smallint")
27: */
28: private $insee;
29:
30: /**
31: * @ORM\Column(type="string", length=5, nullable=true)
32: */
33: private $cheflieu;
34:
35: /**
36: * @ORM\Column(type="string", length=255)
37: */
38: private $nom_maj;
39:
40: /**
41: * @ORM\Column(type="string", length=255)
42: */
43: private $nom;
44:
45: /**
46: * @ORM\OneToMany(targetEntity="Departement", mappedBy="region")
47: */
48: private $departements;
49:
50: /**
51: * @ORM\Column(type="boolean")
52: */
53: private $enabled;
54:
55: /**
56: * @ORM\Column(type="boolean")
57: */
58: private $outre_mer;
59:
60:
61: // --------------------------------------------------------------------- Custom methods
62:
63: public function __construct()
64: {
65: $this->departements = new ArrayCollection();
66: $this->enabled = true;
67: $this->outre_mer = false;
68: }
69:
70: public function __toString()
71: {
72: # return $this->getArtNom();
73: return $this->getNomArt();
74: }
75:
76:
77: // --------------------------------------------------------------------- Shortcut methods
78:
79:
80: // --------------------------------------------------------------------- Tweaked methods
81:
82:
83: // --------------------------------------------------------------------- Auto-generated
84:
85: public function getInsee(): ?int
86: {
87: return $this->insee;
88: }
89:
90: public function setInsee(?int $insee)
91: {
92: $this->insee = $insee;
93:
94: return $this;
95: }
96:
97: public function getCheflieu(): ?string
98: {
99: return $this->cheflieu;
100: }
101:
102: public function setCheflieu(?string $cheflieu): self
103: {
104: $this->cheflieu = $cheflieu;
105:
106: return $this;
107: }
108:
109: public function getNomMaj(): ?string
110: {
111: return $this->nom_maj;
112: }
113:
114: public function setNomMaj(string $nom_maj): self
115: {
116: $this->nom_maj = $nom_maj;
117:
118: return $this;
119: }
120:
121: public function getNom(): ?string
122: {
123: return $this->nom;
124: }
125:
126: public function setNom(string $nom): self
127: {
128: $this->nom = $nom;
129:
130: return $this;
131: }
132:
133: public function getEnabled(): ?bool
134: {
135: return $this->enabled;
136: }
137:
138: public function setEnabled(bool $enabled): self
139: {
140: $this->enabled = $enabled;
141:
142: return $this;
143: }
144:
145: public function getOutreMer(): ?bool
146: {
147: return $this->outre_mer;
148: }
149:
150: public function setOutreMer(bool $outre_mer): self
151: {
152: $this->outre_mer = $outre_mer;
153:
154: return $this;
155: }
156:
157: public function getDepartements(): ArrayCollection
158: {
159: return $this->departements;
160: }
161:
162: public function addDepartement(Departement $departement): self
163: {
164: if (!$this->departements->contains($departement)) {
165: $this->departements[] = $departement;
166: $departement->setRegion($this);
167: }
168:
169: return $this;
170: }
171:
172: public function removeDepartement(Departement $departement): self
173: {
174: if ($this->departements->contains($departement)) {
175: $this->departements->removeElement($departement);
176: // set the owning side to null (unless already changed)
177: if ($departement->getRegion() === $this) {
178: $departement->setRegion(null);
179: }
180: }
181:
182: return $this;
183: }
184: }
185: