您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

297 行
7.2KB

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