|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302 |
- <?php
-
- namespace Lc\PietroBundle\Model\IndividualData;
-
- use Doctrine\Common\Collections\ArrayCollection;
- use Doctrine\Common\Collections\Collection;
- use Doctrine\ORM\Mapping as ORM;
- use Lc\PietroBundle\Model\AbstractData;
- use Lc\PietroBundle\Model\Dream\DreamInterface;
- use Lc\PietroBundle\Model\ProjectBoost\ProjectBoostInterface;
- use Lc\PietroBundle\Model\ProjectInspiring\ProjectInspiringInterface;
- use Lc\PietroBundle\Model\Revolt\RevoltInterface;
- use Lc\PietroBundle\Model\Territory\TerritoryInterface;
-
- /**
- * @ORM\MappedSuperclass()
- */
- abstract class IndividualData extends AbstractData implements IndividualDataInterface
- {
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $firstname;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $lastname;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $email;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $introQuestion;
-
- /**
- * @ORM\Column(type="string", length=255, nullable=true)
- */
- protected $introAnswer;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Revolt\RevoltInterface", mappedBy="individualData", cascade={"persist", "remove"})
- */
- protected $revolt;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\Dream\DreamInterface", mappedBy="individualData", cascade={"persist", "remove"})
- */
- protected $dream;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\ProjectBoost\ProjectBoostInterface", mappedBy="individualData", cascade={"persist", "remove"})
- */
- protected $projectBoost;
-
- /**
- * @ORM\OneToMany(targetEntity="Lc\PietroBundle\Model\ProjectInspiring\ProjectInspiringInterface", mappedBy="individualData", cascade={"persist", "remove"})
- */
- protected $projectInspiring;
-
- /**
- * @ORM\ManyToOne(targetEntity="Lc\PietroBundle\Model\Territory\TerritoryInterface", inversedBy="individualData")
- */
- protected $territory;
-
- public function __construct()
- {
- $this->revolt = new ArrayCollection();
- $this->dream = new ArrayCollection();
- $this->projectBoost = new ArrayCollection();
- $this->projectInspiring = new ArrayCollection();
- }
-
- public function getResume()
- {
- return count($this->getRevolt()) . " révolte(s) - " . count($this->getDream()) . " rêve(s) - " . count(
- $this->getProjectBoost()
- ) . " projet(s) boosté(s) - " . count($this->getProjectInspiring()) . " projets inspirants";
- }
-
- public function __toString()
- {
- return $this->firstname . " " . $this->lastname;
- }
-
- public function getNbDream(): string
- {
- return count($this->getDream());
- }
-
- public function getNbRevolt(): string
- {
- return count($this->getRevolt());
- }
-
- public function getNbProjectBoost(): string
- {
- return count($this->getProjectBoost());
- }
-
- public function getNbProjectInspiring(): string
- {
- return count($this->getProjectInspiring());
- }
-
- public function getFirstname(): ?string
- {
- return $this->firstname;
- }
-
- public function setFirstname(string $firstname): self
- {
- $this->firstname = $firstname;
-
- return $this;
- }
-
- public function getLastname(): ?string
- {
- return $this->lastname;
- }
-
- public function setLastname(string $lastname): self
- {
- $this->lastname = $lastname;
-
- return $this;
- }
-
- public function getEmail(): ?string
- {
- return $this->email;
- }
-
- public function setEmail(string $email): self
- {
- $this->email = $email;
-
- return $this;
- }
-
- public function getIntroQuestion(): ?string
- {
- return $this->introQuestion;
- }
-
- public function setIntroQuestion(string $introQuestion): self
- {
- $this->introQuestion = $introQuestion;
-
- return $this;
- }
-
- public function getIntroAnswer(): ?string
- {
- return $this->introAnswer;
- }
-
- public function setIntroAnswer(?string $introAnswer): self
- {
- $this->introAnswer = $introAnswer;
-
- return $this;
- }
-
- /**
- * @return Collection|RevoltInterface[]
- */
- public function getRevolt(): Collection
- {
- return $this->revolt;
- }
-
- public function addRevolt(RevoltInterface $revolt): self
- {
- if (!$this->revolt->contains($revolt)) {
- $this->revolt[] = $revolt;
- $revolt->setIndividualData($this);
- }
-
- return $this;
- }
-
- public function removeRevolt(RevoltInterface $revolt): self
- {
- if ($this->revolt->removeElement($revolt)) {
- // set the owning side to null (unless already changed)
- if ($revolt->getIndividualData() === $this) {
- $revolt->setIndividualData(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection|DreamInterface[]
- */
- public function getDream(): Collection
- {
- return $this->dream;
- }
-
- public function addDream(DreamInterface $dream): self
- {
- if (!$this->dream->contains($dream)) {
- $this->dream[] = $dream;
- $dream->setIndividualData($this);
- }
-
- return $this;
- }
-
- public function removeDream(DreamInterface $dream): self
- {
- if ($this->dream->removeElement($dream)) {
- // set the owning side to null (unless already changed)
- if ($dream->getIndividualData() === $this) {
- $dream->setIndividualData(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection|ProjectBoostInterface[]
- */
- public function getProjectBoost(): Collection
- {
- return $this->projectBoost;
- }
-
- public function addProjectBoost(ProjectBoostInterface $projectBoost): self
- {
- if (!$this->projectBoost->contains($projectBoost)) {
- $this->projectBoost[] = $projectBoost;
- $projectBoost->setIndividualData($this);
- }
-
- return $this;
- }
-
- public function removeProjectBoost(ProjectBoostInterface $projectBoost): self
- {
- if ($this->projectBoost->removeElement($projectBoost)) {
- // set the owning side to null (unless already changed)
- if ($projectBoost->getIndividualData() === $this) {
- $projectBoost->setIndividualData(null);
- }
- }
-
- return $this;
- }
-
- /**
- * @return Collection|ProjectInspiringInterface[]
- */
- public function getProjectInspiring(): Collection
- {
- return $this->projectInspiring;
- }
-
- public function addProjectInspiring(ProjectInspiringInterface $projectInspiring): self
- {
- if (!$this->projectInspiring->contains($projectInspiring)) {
- $this->projectInspiring[] = $projectInspiring;
- $projectInspiring->setIndividualData($this);
- }
-
- return $this;
- }
-
- public function removeProjectInspiring(ProjectInspiringInterface $projectInspiring): self
- {
- if ($this->projectInspiring->removeElement($projectInspiring)) {
- // set the owning side to null (unless already changed)
- if ($projectInspiring->getIndividualData() === $this) {
- $projectInspiring->setIndividualData(null);
- }
- }
-
- return $this;
- }
-
- public function getTerritory(): ?TerritoryInterface
- {
- return $this->territory;
- }
-
- public function setTerritory(?TerritoryInterface $territory): self
- {
- $this->territory = $territory;
-
- return $this;
- }
- }
|