Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

303 Zeilen
7.6KB

  1. <?php
  2. namespace Lc\PietroBundle\Model\IndividualData;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Lc\PietroBundle\Model\AbstractData;
  7. use Lc\PietroBundle\Model\Dream\DreamInterface;
  8. use Lc\PietroBundle\Model\ProjectBoost\ProjectBoostInterface;
  9. use Lc\PietroBundle\Model\ProjectInspiring\ProjectInspiringInterface;
  10. use Lc\PietroBundle\Model\Revolt\RevoltInterface;
  11. use Lc\PietroBundle\Model\Territory\TerritoryInterface;
  12. /**
  13. * @ORM\MappedSuperclass()
  14. */
  15. abstract class IndividualData extends AbstractData implements IndividualDataInterface
  16. {
  17. /**
  18. * @ORM\Column(type="string", length=255, nullable=true)
  19. */
  20. protected $firstname;
  21. /**
  22. * @ORM\Column(type="string", length=255, nullable=true)
  23. */
  24. protected $lastname;
  25. /**
  26. * @ORM\Column(type="string", length=255, nullable=true)
  27. */
  28. protected $email;
  29. /**
  30. * @ORM\Column(type="string", length=255, nullable=true)
  31. */
  32. protected $introQuestion;
  33. /**
  34. * @ORM\Column(type="string", length=255, nullable=true)
  35. */
  36. protected $introAnswer;
  37. /**
  38. * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Revolt\RevoltInterface", mappedBy="individualData", cascade={"persist", "remove"})
  39. */
  40. protected $revolt;
  41. /**
  42. * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Dream\DreamInterface", mappedBy="individualData", cascade={"persist", "remove"})
  43. */
  44. protected $dream;
  45. /**
  46. * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\ProjectBoost\ProjectBoostInterface", mappedBy="individualData", cascade={"persist", "remove"})
  47. */
  48. protected $projectBoost;
  49. /**
  50. * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\ProjectInspiring\ProjectInspiringInterface", mappedBy="individualData", cascade={"persist", "remove"})
  51. */
  52. protected $projectInspiring;
  53. /**
  54. * @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\Territory\TerritoryInterface", inversedBy="individualData")
  55. */
  56. protected $territory;
  57. public function __construct()
  58. {
  59. $this->revolt = new ArrayCollection();
  60. $this->dream = new ArrayCollection();
  61. $this->projectBoost = new ArrayCollection();
  62. $this->projectInspiring = new ArrayCollection();
  63. }
  64. public function getResume()
  65. {
  66. return count($this->getRevolt()) . " révolte(s) - " . count($this->getDream()) . " rêve(s) - " . count(
  67. $this->getProjectBoost()
  68. ) . " projet(s) boosté(s) - " . count($this->getProjectInspiring()) . " projets inspirants";
  69. }
  70. public function __toString()
  71. {
  72. return $this->firstname . " " . $this->lastname;
  73. }
  74. public function getNbDream(): string
  75. {
  76. return count($this->getDream());
  77. }
  78. public function getNbRevolt(): string
  79. {
  80. return count($this->getRevolt());
  81. }
  82. public function getNbProjectBoost(): string
  83. {
  84. return count($this->getProjectBoost());
  85. }
  86. public function getNbProjectInspiring(): string
  87. {
  88. return count($this->getProjectInspiring());
  89. }
  90. public function getFirstname(): ?string
  91. {
  92. return $this->firstname;
  93. }
  94. public function setFirstname(string $firstname): self
  95. {
  96. $this->firstname = $firstname;
  97. return $this;
  98. }
  99. public function getLastname(): ?string
  100. {
  101. return $this->lastname;
  102. }
  103. public function setLastname(string $lastname): self
  104. {
  105. $this->lastname = $lastname;
  106. return $this;
  107. }
  108. public function getEmail(): ?string
  109. {
  110. return $this->email;
  111. }
  112. public function setEmail(string $email): self
  113. {
  114. $this->email = $email;
  115. return $this;
  116. }
  117. public function getIntroQuestion(): ?string
  118. {
  119. return $this->introQuestion;
  120. }
  121. public function setIntroQuestion(string $introQuestion): self
  122. {
  123. $this->introQuestion = $introQuestion;
  124. return $this;
  125. }
  126. public function getIntroAnswer(): ?string
  127. {
  128. return $this->introAnswer;
  129. }
  130. public function setIntroAnswer(?string $introAnswer): self
  131. {
  132. $this->introAnswer = $introAnswer;
  133. return $this;
  134. }
  135. /**
  136. * @return Collection|RevoltInterface[]
  137. */
  138. public function getRevolt(): Collection
  139. {
  140. return $this->revolt;
  141. }
  142. public function addRevolt(RevoltInterface $revolt): self
  143. {
  144. if (!$this->revolt->contains($revolt)) {
  145. $this->revolt[] = $revolt;
  146. $revolt->setIndividualData($this);
  147. }
  148. return $this;
  149. }
  150. public function removeRevolt(RevoltInterface $revolt): self
  151. {
  152. if ($this->revolt->removeElement($revolt)) {
  153. // set the owning side to null (unless already changed)
  154. if ($revolt->getIndividualData() === $this) {
  155. $revolt->setIndividualData(null);
  156. }
  157. }
  158. return $this;
  159. }
  160. /**
  161. * @return Collection|DreamInterface[]
  162. */
  163. public function getDream(): Collection
  164. {
  165. return $this->dream;
  166. }
  167. public function addDream(DreamInterface $dream): self
  168. {
  169. if (!$this->dream->contains($dream)) {
  170. $this->dream[] = $dream;
  171. $dream->setIndividualData($this);
  172. }
  173. return $this;
  174. }
  175. public function removeDream(DreamInterface $dream): self
  176. {
  177. if ($this->dream->removeElement($dream)) {
  178. // set the owning side to null (unless already changed)
  179. if ($dream->getIndividualData() === $this) {
  180. $dream->setIndividualData(null);
  181. }
  182. }
  183. return $this;
  184. }
  185. /**
  186. * @return Collection|ProjectBoostInterface[]
  187. */
  188. public function getProjectBoost(): Collection
  189. {
  190. return $this->projectBoost;
  191. }
  192. public function addProjectBoost(ProjectBoostInterface $projectBoost): self
  193. {
  194. if (!$this->projectBoost->contains($projectBoost)) {
  195. $this->projectBoost[] = $projectBoost;
  196. $projectBoost->setIndividualData($this);
  197. }
  198. return $this;
  199. }
  200. public function removeProjectBoost(ProjectBoostInterface $projectBoost): self
  201. {
  202. if ($this->projectBoost->removeElement($projectBoost)) {
  203. // set the owning side to null (unless already changed)
  204. if ($projectBoost->getIndividualData() === $this) {
  205. $projectBoost->setIndividualData(null);
  206. }
  207. }
  208. return $this;
  209. }
  210. /**
  211. * @return Collection|ProjectInspiringInterface[]
  212. */
  213. public function getProjectInspiring(): Collection
  214. {
  215. return $this->projectInspiring;
  216. }
  217. public function addProjectInspiring(ProjectInspiringInterface $projectInspiring): self
  218. {
  219. if (!$this->projectInspiring->contains($projectInspiring)) {
  220. $this->projectInspiring[] = $projectInspiring;
  221. $projectInspiring->setIndividualData($this);
  222. }
  223. return $this;
  224. }
  225. public function removeProjectInspiring(ProjectInspiringInterface $projectInspiring): self
  226. {
  227. if ($this->projectInspiring->removeElement($projectInspiring)) {
  228. // set the owning side to null (unless already changed)
  229. if ($projectInspiring->getIndividualData() === $this) {
  230. $projectInspiring->setIndividualData(null);
  231. }
  232. }
  233. return $this;
  234. }
  235. public function getTerritory(): ?TerritoryInterface
  236. {
  237. return $this->territory;
  238. }
  239. public function setTerritory(?TerritoryInterface $territory): self
  240. {
  241. $this->territory = $territory;
  242. return $this;
  243. }
  244. }