|
- <?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;
- }
- }
|