<?php
declare(strict_types=1);
namespace App\Entity;
use App\Repository\FicheActionRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* FicheAction V2.
*
* @ORM\Table(name="FicheAction")
*
* @ORM\Entity(repositoryClass=FicheActionRepository::class)
*
* @ORM\HasLifecycleCallbacks
*/
class FicheAction
{
public $noResultReason;
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
*
* @ORM\Id
*
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @Gedmo\Timestampable(on="create")
*
* @ORM\Column(name="created", type="datetime")
*/
private $created;
/**
* @ORM\Column(name="updated", type="datetime")
*
* @Gedmo\Timestampable(on="update")
*/
private $updated;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255, nullable=true)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="summary", type="text", nullable=true)
*/
private $summary;
/**
* @ORM\OneToOne(targetEntity="Document", inversedBy="ficheActionDoc1", cascade={"persist"})
*
* @ORM\JoinColumn(name="document1_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $document1;
/**
* @ORM\OneToOne(targetEntity="Document", inversedBy="ficheActionDoc2", cascade={"persist"})
*
* @ORM\JoinColumn(name="document2_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $document2;
/**
* @ORM\OneToOne(targetEntity="Document", inversedBy="ficheActionDoc3", cascade={"persist"})
*
* @ORM\JoinColumn(name="document3_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $document3;
/**
* @ORM\OneToOne(targetEntity="Document", inversedBy="ficheActionDoc4", cascade={"persist"})
*
* @ORM\JoinColumn(name="document4_id", referencedColumnName="id", onDelete="SET NULL")
*/
private $document4;
/**
* Pourquoi cette action a été mies en place ?
*
* @var string
*
* @ORM\Column(name="objective", type="text", nullable=true)
*/
private $objective;
/**
* Comment cette action a été menée ?
*
* @var string
*
* @ORM\Column(name="descriptive", type="text", nullable=true)
*/
private $descriptive;
/**
* Qu'est-ce que cette action a produit ? (3 champs texte).
*
* @var string
*
* @ORM\Column(name="resultOnTheTerritory", type="text", nullable=true)
*/
private $resultOnTheTerritory;
/**
* Qu'est-ce que cette action a produit ?
*
* @var string
*
* @ORM\Column(name="resultForSocialCenter", type="text", nullable=true)
*/
private $resultForSocialCenter;
/**
* Qu'est-ce que cette action a produit ?
*
* @var string
*
* @ORM\Column(name="resultForInhabitants", type="text", nullable=true)
*/
private $resultForInhabitants;
/**
* @ORM\ManyToMany(targetEntity="PartnerAction", inversedBy="fichesActionAction", cascade={"persist"})
*
* @ORM\JoinTable(name="ficheAction_actionPartners")
*/
private $actionPartners;
/**
* @ORM\ManyToMany(targetEntity="PartnerAction", inversedBy="fichesActionPartners", cascade={"persist"})
*
* @ORM\JoinTable(name="ficheAction_financialPartners")
*/
private $financialPartners;
/**
* @ORM\ManyToOne(targetEntity="DimensionAction", inversedBy="fichesAction")
*
* @ORM\JoinColumn(name="dimension_action_id", referencedColumnName="id")
*/
private $dimension;
/**
* @ORM\ManyToOne(targetEntity="PublicAction", inversedBy="fichesAction")
*
* @ORM\JoinColumn(name="public_action_id", referencedColumnName="id")
*/
private $public;
/**
* @ORM\ManyToMany(targetEntity="Keyword", inversedBy="fichesAction", cascade={"persist"})
*
* @ORM\JoinTable(name="ficheAction_keyword")
*/
private $keywords;
/**
* Qui est à l'initiative de l'action.
*
* @ORM\ManyToMany(targetEntity="ApplicantAction", inversedBy="fichesAction", cascade={"persist"})
*
* @ORM\JoinTable(name="ficheAction_applicant")
*/
private $applicants;
/**
* Précision applicants ( si autre ).
*
* @var string
*
* @ORM\Column(name="applicant_other", type="text", nullable=true)
*/
private $applicantOther;
/**
* @ORM\ManyToOne(targetEntity="Structure", inversedBy="fichesAction")
*
* @ORM\JoinColumn(name="structure_id", referencedColumnName="id", onDelete="CASCADE")
*/
private $structure;
/**
* @var int
*
* @ORM\Column(name="status", type="integer", nullable=true)
*/
private $status;
/**
* precision champ status si réponse = action terminée.
*
* @var string
*
* @ORM\Column(name="status_detailsr", type="text", nullable=true)
*/
private $statusDetails;
/**
* Suite de l'action / limites.
*
* @var string
*
* @ORM\Column(name="afterActionLimits", type="text", nullable=true)
*/
private $afterActionLimits;
/**
* Suite de l'action / Perspectives.
*
* @var string
*
* @ORM\Column(name="afterActionProspects", type="text", nullable=true)
*/
private $afterActionProspects;
/**
* @var int
*
* @ORM\Column(name="financialRessources", type="text", nullable=true)
*/
private $financialRessources;
/**
* @var int
*
* @ORM\Column(name="professionalRessources", type="text", nullable=true)
*/
private $professionalRessources;
/**
* @ORM\ManyToOne(targetEntity="FicheActionTerritoire", inversedBy="fichesAction")
*
* @ORM\JoinColumn(name="ficheActionTerritoire_id", referencedColumnName="id")
*/
private $ficheActionTerritoire;
/**
* Précision territoire concerné ( si autre ).
*
* @var string
*
* @ORM\Column(name="ficheActionTerritoire_other", type="text", nullable=true)
*/
private $ficheActionTerritoireOther;
/**
* @ORM\OneToOne(targetEntity="FicheSynthetique", mappedBy="ficheAction")
*/
private $ficheSynthetique;
/**
* @var int
*
* @ORM\Column(name="nbViews", type="integer", options={"default" = 0})
*/
private $nbViews = 0;
/**
* Constructor.
*/
public function __construct()
{
$this->keywords = new \Doctrine\Common\Collections\ArrayCollection();
$this->applicants = new \Doctrine\Common\Collections\ArrayCollection();
$this->actionPartners = new ArrayCollection();
$this->financialPartners = new ArrayCollection();
}
#[\Override]
public function __toString(): string
{
return $this->title.' ';
}
/**
* specials fields for export.
**/
protected $exportKeywords;
protected $exportApplicants;
protected $exportActionPartners;
protected $exportStatus;
protected $exportSummuary;
protected $exportStatusDetails;
protected $exportApplicantOther;
protected $exportObjective;
protected $exportFicheActionTerritoireOther;
protected $exportDescriptive;
protected $exportFinancialRessources;
protected $exportProfessionalRessources;
protected $exportResultOnTheTerritory;
protected $exportResultForSocialCenter;
protected $exportResultForInhabitants;
protected $exportAfterActionLimits;
protected $exportAfterActionProspects;
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->created;
}
public function getUpdated(): ?\DateTimeInterface
{
return $this->updated;
}
public function setCreated(\DateTimeInterface $created): self
{
$this->created = $created;
return $this;
}
public function setUpdated(\DateTimeInterface $updated): self
{
$this->updated = $updated;
return $this;
}
/**
* Set title.
*
* @param string $title
*/
public function setTitle($title): static
{
$this->title = $title;
return $this;
}
/**
* Get title.
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set summary.
*
* @param string $summary
*/
public function setSummary($summary): static
{
$this->summary = $summary;
return $this;
}
/**
* Get summary.
*
* @return string
*/
public function getSummary()
{
return $this->summary;
}
/**
* Set objective.
*
* @param string $objective
*/
public function setObjective($objective): static
{
$this->objective = $objective;
return $this;
}
/**
* Get objective.
*
* @return string
*/
public function getObjective()
{
return $this->objective;
}
/**
* Set descriptive.
*
* @param string $descriptive
*/
public function setDescriptive($descriptive): static
{
$this->descriptive = $descriptive;
return $this;
}
/**
* Get descriptive.
*
* @return string
*/
public function getDescriptive()
{
return $this->descriptive;
}
/**
* Set actionPartners.
*
* @param string $actionPartners
*/
public function setActionPartners($actionPartners): static
{
$this->actionPartners = $actionPartners;
return $this;
}
/**
* Get actionPartners.
*
* @return string
*/
public function getActionPartners()
{
return $this->actionPartners;
}
/**
* Set financialPartners.
*
* @param string $financialPartners
*/
public function setFinancialPartners($financialPartners): static
{
$this->financialPartners = $financialPartners;
return $this;
}
/**
* Get financialPartners.
*
* @return string
*/
public function getFinancialPartners()
{
return $this->financialPartners;
}
/**
* Set resultOnTheTerritory.
*
* @param string $resultOnTheTerritory
*/
public function setResultOnTheTerritory($resultOnTheTerritory): static
{
$this->resultOnTheTerritory = $resultOnTheTerritory;
return $this;
}
/**
* Get resultOnTheTerritory.
*
* @return string
*/
public function getResultOnTheTerritory()
{
return $this->resultOnTheTerritory;
}
/**
* Set resultForSocialCenter.
*
* @param string $resultForSocialCenter
*/
public function setResultForSocialCenter($resultForSocialCenter): static
{
$this->resultForSocialCenter = $resultForSocialCenter;
return $this;
}
/**
* Get resultForSocialCenter.
*
* @return string
*/
public function getResultForSocialCenter()
{
return $this->resultForSocialCenter;
}
/**
* Set resultForInhabitants.
*
* @param string $resultForInhabitants
*/
public function setResultForInhabitants($resultForInhabitants): static
{
$this->resultForInhabitants = $resultForInhabitants;
return $this;
}
/**
* Get resultForInhabitants.
*
* @return string
*/
public function getResultForInhabitants()
{
return $this->resultForInhabitants;
}
/**
* Set dimension.
*/
public function setDimension(?DimensionAction $dimension = null): static
{
$this->dimension = $dimension;
return $this;
}
/**
* Get dimension.
*
* @return DimensionAction
*/
public function getDimension()
{
return $this->dimension;
}
/**
* Set public.
*/
public function setPublic(?PublicAction $public = null): static
{
$this->public = $public;
return $this;
}
/**
* Get public.
*
* @return PublicAction
*/
public function getPublic()
{
return $this->public;
}
/**
* Add keywords.
*/
public function addKeyword(Keyword $keywords): static
{
$this->keywords[] = $keywords;
return $this;
}
/**
* Remove keywords.
*/
public function removeKeyword(Keyword $keywords): void
{
$this->keywords->removeElement($keywords);
}
/**
* Get keywords.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getKeywords()
{
return $this->keywords;
}
/**
* Add applicants.
*/
public function addApplicant(ApplicantAction $applicants): static
{
$this->applicants[] = $applicants;
return $this;
}
/**
* Remove applicants.
*/
public function removeApplicant(ApplicantAction $applicants): void
{
$this->applicants->removeElement($applicants);
}
/**
* Get applicants.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getApplicants()
{
return $this->applicants;
}
/**
* Add actionPartners.
*/
public function addActionPartner(PartnerAction $actionPartners): static
{
$this->actionPartners[] = $actionPartners;
return $this;
}
/**
* Remove actionPartners.
*/
public function removeActionPartner(PartnerAction $actionPartners): void
{
$this->actionPartners->removeElement($actionPartners);
}
/**
* Add financialPartners.
*/
public function addFinancialPartner(PartnerAction $financialPartners): static
{
$this->financialPartners[] = $financialPartners;
return $this;
}
/**
* Remove financialPartners.
*/
public function removeFinancialPartner(PartnerAction $financialPartners): void
{
$this->financialPartners->removeElement($financialPartners);
}
/**
* Set structure.
*/
public function setStructure(?Structure $structure = null): static
{
$this->structure = $structure;
return $this;
}
/**
* Get structure.
*
* @return Structure
*/
public function getStructure()
{
return $this->structure;
}
/**
* Set document1.
*/
public function setDocument1(?Document $document1 = null): static
{
$this->document1 = $document1;
return $this;
}
/**
* Get document1.
*
* @return Document
*/
public function getDocument1()
{
return $this->document1;
}
/**
* Set document2.
*/
public function setDocument2(?Document $document2 = null): static
{
$this->document2 = $document2;
return $this;
}
/**
* Get document2.
*
* @return Document
*/
public function getDocument2()
{
return $this->document2;
}
/**
* Set document3.
*/
public function setDocument3(?Document $document3 = null): static
{
$this->document3 = $document3;
return $this;
}
/**
* Get document3.
*
* @return Document
*/
public function getDocument3()
{
return $this->document3;
}
/**
* Set document4.
*/
public function setDocument4(?Document $document4 = null): static
{
$this->document4 = $document4;
return $this;
}
/**
* Get document4.
*
* @return Document
*/
public function getDocument4()
{
return $this->document4;
}
/**
* Set applicantOther.
*
* @param string $applicantOther
*/
public function setApplicantOther($applicantOther): static
{
$this->applicantOther = $applicantOther;
return $this;
}
/**
* Get applicantOther.
*
* @return string
*/
public function getApplicantOther()
{
return $this->applicantOther;
}
/**
* Set status.
*
* @param int $status
*/
public function setStatus($status): static
{
$this->status = $status;
return $this;
}
/**
* Get status.
*
* @return int
*/
public function getStatus()
{
return $this->status;
}
/**
* Set noResultReason.
*
* @param string $noResultReason
*/
public function setNoResultReason($noResultReason): static
{
$this->noResultReason = $noResultReason;
return $this;
}
/**
* Get noResultReason.
*
* @return string
*/
public function getNoResultReason()
{
return $this->noResultReason;
}
/**
* Set afterActionLimits.
*
* @param string $afterActionLimits
*/
public function setAfterActionLimits($afterActionLimits): static
{
$this->afterActionLimits = $afterActionLimits;
return $this;
}
/**
* Get afterActionLimits.
*
* @return string
*/
public function getAfterActionLimits()
{
return $this->afterActionLimits;
}
/**
* Set afterActionProspects.
*
* @param string $afterActionProspects
*/
public function setAfterActionProspects($afterActionProspects): static
{
$this->afterActionProspects = $afterActionProspects;
return $this;
}
/**
* Get afterActionProspects.
*
* @return string
*/
public function getAfterActionProspects()
{
return $this->afterActionProspects;
}
/**
* Set financialRessources.
*
* @param int $financialRessources
*/
public function setFinancialRessources($financialRessources): static
{
$this->financialRessources = $financialRessources;
return $this;
}
/**
* Get financialRessources.
*
* @return int
*/
public function getFinancialRessources()
{
return $this->financialRessources;
}
/**
* Set professionalRessources.
*
* @param int $professionalRessources
*/
public function setProfessionalRessources($professionalRessources): static
{
$this->professionalRessources = $professionalRessources;
return $this;
}
/**
* Get professionalRessources.
*
* @return int
*/
public function getProfessionalRessources()
{
return $this->professionalRessources;
}
/**
* Set ficheActionTerritoire.
*/
public function setFicheActionTerritoire(?FicheActionTerritoire $ficheActionTerritoire = null): static
{
$this->ficheActionTerritoire = $ficheActionTerritoire;
return $this;
}
/**
* Get ficheActionTerritoire.
*
* @return FicheActionTerritoire
*/
public function getFicheActionTerritoire()
{
return $this->ficheActionTerritoire;
}
/**
* Set ficheActionTerritoireOther.
*
* @param string $ficheActionTerritoireOther
*/
public function setFicheActionTerritoireOther($ficheActionTerritoireOther): static
{
$this->ficheActionTerritoireOther = $ficheActionTerritoireOther;
return $this;
}
/**
* Get ficheActionTerritoireOther.
*
* @return string
*/
public function getFicheActionTerritoireOther()
{
return $this->ficheActionTerritoireOther;
}
/**
* Set statusDetails.
*
* @param string $statusDetails
*/
public function setStatusDetails($statusDetails): static
{
$this->statusDetails = $statusDetails;
return $this;
}
/**
* Get statusDetails.
*
* @return string
*/
public function getStatusDetails()
{
return $this->statusDetails;
}
/**
* specials method for export fields.
**/
public function getExportKeywords(): string
{
$return = '';
$separator = '';
foreach ($this->getKeywords() as $keyword) {
$return .= $separator.$keyword;
$separator = ', ';
}
return $this->exportKeywords = $return;
}
public function getExportApplicants(): string
{
$return = '';
$separator = '';
foreach ($this->getApplicants() as $applicant) {
$return .= $separator.$applicant;
$separator = ', ';
}
return $this->exportApplicants = $return;
}
public function getExportActionPartners(): string
{
$return = '';
$separator = '';
foreach ($this->getActionPartners() as $actionPartner) {
$return .= $separator.$actionPartner;
$separator = ', ';
}
return $this->exportActionPartners = $return;
}
public function getExportStatus(): string
{
$return = '';
if (1 == $this->getStatus()) {
$return = 'Action en cours';
}
if (2 == $this->getStatus()) {
$return = 'Action terminée';
}
return $this->exportStatus = $return;
}
public function getExportSummuary(): string
{
return $this->exportSummuary = $this->cleanRichTextforExport($this->getSummary());
}
public function getExportStatusDetails(): string
{
return $this->exportStatusDetails = $this->cleanRichTextforExport($this->getStatusDetails());
}
public function getExportApplicantOther(): string
{
return $this->exportApplicantOther = $this->cleanRichTextforExport($this->getApplicantOther());
}
public function getExportObjective(): string
{
return $this->exportObjective = $this->cleanRichTextforExport($this->getObjective());
}
public function getExportFicheActionTerritoireOther(): string
{
return $this->exportFicheActionTerritoireOther = $this->cleanRichTextforExport($this->getFicheActionTerritoireOther());
}
public function getExportDescriptive(): string
{
return $this->exportDescriptive = $this->cleanRichTextforExport($this->getDescriptive());
}
public function getExportFinancialRessources(): string
{
return $this->exportFinancialRessources = $this->cleanRichTextforExport($this->getFinancialRessources());
}
public function getExportProfessionalRessources(): string
{
return $this->exportProfessionalRessources = $this->cleanRichTextforExport($this->getProfessionalRessources());
}
public function getExportResultOnTheTerritory(): string
{
return $this->exportResultOnTheTerritory = $this->cleanRichTextforExport($this->getResultOnTheTerritory());
}
public function getExportResultForSocialCenter(): string
{
return $this->exportResultForSocialCenter = $this->cleanRichTextforExport($this->getResultForSocialCenter());
}
public function getExportResultForInhabitants(): string
{
return $this->exportResultForInhabitants = $this->cleanRichTextforExport($this->getResultForInhabitants());
}
public function getExportAfterActionLimits(): string
{
return $this->exportAfterActionLimits = $this->cleanRichTextforExport($this->getAfterActionLimits());
}
public function getExportAfterActionProspects(): string
{
return $this->exportAfterActionProspects = $this->cleanRichTextforExport($this->getAfterActionProspects());
}
private function cleanRichTextforExport($text): string
{
$text = str_replace(''', "'", $text);
return strip_tags(html_entity_decode($text));
}
/**
* Set ficheSynthetique.
*/
public function setFicheSynthetique(?FicheSynthetique $ficheSynthetique = null): static
{
$this->ficheSynthetique = $ficheSynthetique;
return $this;
}
/**
* Get ficheSynthetique.
*
* @return FicheSynthetique
*/
public function getFicheSynthetique()
{
return $this->ficheSynthetique;
}
/**
* Set nbViews.
*
* @param int $nbViews
*/
public function setNbViews($nbViews): static
{
$this->nbViews = $nbViews;
return $this;
}
/**
* Get nbViews.
*
* @return int
*/
public function getNbViews()
{
return $this->nbViews;
}
}