<?php
namespace App\Entity;
use App\Repository\ActualityRepository;
use Cofondateur\SocleTechniqueBundle\Annotation\CrudField;
use Cofondateur\SocleTechniqueBundle\Traits\SEOInterface;
use Cofondateur\SocleTechniqueBundle\Traits\SEOTrait;
use Cofondateur\SocleTechniqueBundle\Traits\SluggableInterface;
use Cofondateur\SocleTechniqueBundle\Traits\SluggableTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Form\DocumentAssociateFormType;
use DateTime;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Vich\UploaderBundle\Mapping\Annotation\Uploadable;
use App\Form\ContactPositionFormType;
/**
* @ORM\Entity(repositoryClass=ActualityRepository::class)
* @Uploadable()
*/
class Actuality implements SEOInterface, SluggableInterface
{
use SEOTrait;
use SluggableTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(index=true, label="Titre")
*/
private $title;
/**
* @ORM\ManyToOne(targetEntity=ActualityCategory::class, inversedBy="actualities")
* @ORM\JoinColumn(nullable=false)
* @CrudField(index=true, label="Catégorie")
*/
private $category;
/**
* @ORM\ManyToMany(targetEntity=ActualityLabel::class, inversedBy="actualities")
* @CrudField(index=true, label="Étiquettes")
*/
private $labels;
/**
* @ORM\Column(type="text")
* @CrudField(label="Résumé")
*/
private $resume;
/**
* @ORM\Column(type="string")
*/
private $illustrationName;
/**
* @ORM\Column(type="integer")
*/
private $illustrationSize;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $illustrationUpdatedAt;
/**
* @Vich\UploadableField(mapping="default", fileNameProperty="illustrationName", size="illustrationSize")
* @CrudField(label="Photo principale")
*/
private $illustrationFile;
/**
* @ORM\Column(type="string", nullable=true)
* @CrudField(label="Alt de la photo principale")
*/
private $illustrationAlt;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": true})
* @CrudField(index=true, label="Affiché cette page sur le site")
*/
private $activate;
/**
* @ORM\OneToMany(targetEntity=Section::class, mappedBy="actuality", cascade={"persist", "remove"}, fetch="EAGER")
* @ORM\OrderBy({"position"="ASC"})
*/
private $sections;
/**
* @ORM\OneToMany(targetEntity=DocumentAssociate::class, mappedBy="actuality", cascade={"persist", "remove"})
* @CrudField(tab="Colonne de droite", label="Documents associés")
*/
private $documentAssociates;
/**
* @ORM\OneToMany(targetEntity=ContactAssociate::class, mappedBy="actuality")
* @CrudField(tab="Colonne de droite", label="Contact")
*/
private $contactAssociates;
/**
* @ORM\OneToMany(targetEntity=ContactPosition::class, mappedBy="actuality",cascade={"persist"})
* @CrudField(tab="Colonne de droite", formType=ContactPositionFormType::class,label="Contacts associés")
* @ORM\OrderBy({"position"="ASC"})
*/
private $contactPositions;
/**
* @ORM\OneToMany(targetEntity=Page::class, mappedBy="actuality")
* @CrudField(tab="Colonne de droite", label="Pages associées")
*/
private $pagesAssociates;
/**
* @ORM\OneToMany(targetEntity=Actuality::class, mappedBy="actuality")
* @CrudField(tab="Colonne de droite", label="Actualités associées")
*/
private $actualitiesAssociates;
/**
* @ORM\OneToMany(targetEntity=These::class, mappedBy="actuality")
* @CrudField(tab="Colonne de droite", label="Thèses associées")
*/
private $theseAssociates;
/**
* @ORM\OneToMany(targetEntity=Publication::class, mappedBy="actuality")
* @CrudField(tab="Colonne de droite", label="Publications associées")
*/
private $publicationAssociates;
/**
* @ORM\Column(type="string", length=255, nullable=true)
* @CrudField(tab="Citation", label="Citation")
*/
private $quote;
/**
* @ORM\Column(type="date")
* @CrudField(index=true, label="Date")
*/
private $createdAt;
/**
* @ORM\ManyToOne(targetEntity=Actuality::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $actuality;
/**
* @ORM\ManyToOne(targetEntity=About::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $about;
/**
* @ORM\ManyToOne(targetEntity=Composition::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $composition;
/**
* @ORM\ManyToOne(targetEntity=DefinitionPage::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $definitionPage;
/**
* @ORM\ManyToOne(targetEntity=Departement::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $departement;
/**
* @ORM\ManyToOne(targetEntity=FullMemberPage::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $fullMemberPage;
/**
* @ORM\ManyToOne(targetEntity=Join::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $joinPage;
/**
* @ORM\ManyToOne(targetEntity=Page::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $page;
/**
* @ORM\ManyToOne(targetEntity=PartenairePage::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $partenairePage;
/**
* @ORM\ManyToOne(targetEntity=Publication::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $publication;
/**
* @ORM\ManyToOne(targetEntity=PublicationPage::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $publicationPage;
/**
* @ORM\ManyToOne(targetEntity=These::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $these;
/**
* @ORM\ManyToOne(targetEntity=ThesePage::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $thesePage;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page A propos", tab="Colonne de droite")
*/
private $aboutAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Composition", tab="Colonne de droite")
*/
private $compositionAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Membres titulaires", tab="Colonne de droite")
*/
private $fullMemberAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Département", tab="Colonne de droite")
*/
private $departementAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Partenaire", tab="Colonne de droite")
*/
private $partnerAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Liste des publications", tab="Colonne de droite")
*/
private $publicationAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Liste des thèses", tab="Colonne de droite")
*/
private $theseAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Liste des actualités", tab="Colonne de droite")
*/
private $actualityAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Définitions", tab="Colonne de droite")
*/
private $definitionAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Manuels", tab="Colonne de droite")
*/
private $manuelAssociate;
/**
* @ORM\Column(type="boolean", nullable=true)
* @CrudField(label="Associer page Adhérer", tab="Colonne de droite")
*/
private $joinAssociate;
/**
* @ORM\ManyToOne(targetEntity=Homepage::class, inversedBy="actualitiesSliderLarge")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $homepageLarge;
/**
* @ORM\ManyToOne(targetEntity=Homepage::class, inversedBy="actualitiesSliderLittle")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $homepageLittle;
/**
* @ORM\ManyToOne(targetEntity=ManuelPage::class, inversedBy="actualitiesAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $manuelPage;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $old_id;
/**
* @ORM\OneToMany(targetEntity=HomepageActuality::class, mappedBy="actuality")
*/
private $homepageActualities;
public function __construct()
{
$this->sections = new ArrayCollection();
$this->documentAssociates = new ArrayCollection();
$this->contactAssociates = new ArrayCollection();
$this->contactPositions = new ArrayCollection();
$this->createdAt = new DateTime();
$this->pagesAssociates = new ArrayCollection();
$this->actualitiesAssociates = new ArrayCollection();
$this->theseAssociates = new ArrayCollection();
$this->publicationAssociates = new ArrayCollection();
$this->labels = new ArrayCollection();
$this->homepageActualities = new ArrayCollection();
}
public function __toString(): string
{
return $this->getTitle() . " - " . $this->getCategory() ?? $this->getId() ?? "N/A";
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getCategory(): ?ActualityCategory
{
return $this->category;
}
public function setCategory(?ActualityCategory $category): self
{
$this->category = $category;
return $this;
}
/**
* @return Collection<int, Section>
*/
public function getSections(): Collection
{
return $this->sections;
}
public function addSection(Section $section): self
{
if (!$this->sections->contains($section)) {
$this->sections[] = $section;
$section->setActuality($this);
}
return $this;
}
public function removeSection(Section $section): self
{
if ($this->sections->removeElement($section)) {
// set the owning side to null (unless already changed)
if ($section->getActuality() === $this) {
$section->setActuality(null);
}
}
return $this;
}
/**
* @return Collection<int, DocumentAssociate>
*/
public function getDocumentAssociates(): Collection
{
return $this->documentAssociates;
}
public function addDocumentAssociate(DocumentAssociate $documentAssociate): self
{
if (!$this->documentAssociates->contains($documentAssociate)) {
$this->documentAssociates[] = $documentAssociate;
$documentAssociate->setActuality($this);
}
return $this;
}
public function removeDocumentAssociate(DocumentAssociate $documentAssociate): self
{
if ($this->documentAssociates->removeElement($documentAssociate)) {
// set the owning side to null (unless already changed)
if ($documentAssociate->getActuality() === $this) {
$documentAssociate->setActuality(null);
}
}
return $this;
}
/**
* @return Collection<int, ContactAssociate>
*/
public function getContactAssociates(): Collection
{
return $this->contactAssociates;
}
public function addContactAssociate(ContactAssociate $contactAssociate): self
{
if (!$this->contactAssociates->contains($contactAssociate)) {
$this->contactAssociates[] = $contactAssociate;
$contactAssociate->setActuality($this);
}
return $this;
}
public function removeContactAssociate(ContactAssociate $contactAssociate): self
{
if ($this->contactAssociates->removeElement($contactAssociate)) {
// set the owning side to null (unless already changed)
if ($contactAssociate->getActuality() === $this) {
$contactAssociate->setActuality(null);
}
}
return $this;
}
/**
* @return Collection<int, ContactAssociate>
*/
public function getContactPositions(): Collection
{
return $this->contactPositions;
}
public function addContactPosition(ContactPosition $contactPosition): self
{
if (!$this->contactPositions->contains($contactPosition)) {
$this->contactPositions[] = $contactPosition;
$contactPosition->setActuality($this);
}
return $this;
}
public function removeContactPosition(ContactPosition $contactPosition): self
{
if ($this->contactPositions->removeElement($contactPosition)) {
// set the owning side to null (unless already changed)
if ($contactPosition->getActuality() === $this) {
$contactPosition->setActuality(null);
}
}
return $this;
}
public function getQuote(): ?string
{
return $this->quote;
}
public function setQuote(?string $quote): self
{
$this->quote = $quote;
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getResume(): ?string
{
return $this->resume;
}
public function setResume(string $resume): self
{
$this->resume = $resume;
return $this;
}
public function getAbout(): ?About
{
return $this->about;
}
public function setAbout(?About $about): self
{
$this->about = $about;
return $this;
}
/**
* @return Collection<int, Page>
*/
public function getPagesAssociates(): Collection
{
return $this->pagesAssociates;
}
public function addPagesAssociate(Page $pagesAssociate): self
{
if (!$this->pagesAssociates->contains($pagesAssociate)) {
$this->pagesAssociates[] = $pagesAssociate;
$pagesAssociate->setActuality($this);
}
return $this;
}
public function removePagesAssociate(Page $pagesAssociate): self
{
if ($this->pagesAssociates->removeElement($pagesAssociate)) {
// set the owning side to null (unless already changed)
if ($pagesAssociate->getActuality() === $this) {
$pagesAssociate->setActuality(null);
}
}
return $this;
}
public function getActuality(): ?self
{
return $this->actuality;
}
public function setActuality(?self $actuality): self
{
$this->actuality = $actuality;
return $this;
}
/**
* @return Collection<int, self>
*/
public function getActualitiesAssociates(): Collection
{
return $this->actualitiesAssociates;
}
public function addActualitiesAssociate(self $actualitiesAssociate): self
{
if (!$this->actualitiesAssociates->contains($actualitiesAssociate)) {
$this->actualitiesAssociates[] = $actualitiesAssociate;
$actualitiesAssociate->setActuality($this);
}
return $this;
}
public function removeActualitiesAssociate(self $actualitiesAssociate): self
{
if ($this->actualitiesAssociates->removeElement($actualitiesAssociate)) {
// set the owning side to null (unless already changed)
if ($actualitiesAssociate->getActuality() === $this) {
$actualitiesAssociate->setActuality(null);
}
}
return $this;
}
/**
* @return Collection<int, These>
*/
public function getTheseAssociates(): Collection
{
return $this->theseAssociates;
}
public function addTheseAssociate(These $theseAssociate): self
{
if (!$this->theseAssociates->contains($theseAssociate)) {
$this->theseAssociates[] = $theseAssociate;
$theseAssociate->setActuality($this);
}
return $this;
}
public function removeTheseAssociate(These $theseAssociate): self
{
if ($this->theseAssociates->removeElement($theseAssociate)) {
// set the owning side to null (unless already changed)
if ($theseAssociate->getActuality() === $this) {
$theseAssociate->setActuality(null);
}
}
return $this;
}
public function getComposition(): ?Composition
{
return $this->composition;
}
public function setComposition(?Composition $composition): self
{
$this->composition = $composition;
return $this;
}
public function getDefinitionPage(): ?DefinitionPage
{
return $this->definitionPage;
}
public function setDefinitionPage(?DefinitionPage $definitionPage): self
{
$this->definitionPage = $definitionPage;
return $this;
}
public function getDepartement(): ?Departement
{
return $this->departement;
}
public function setDepartement(?Departement $departement): self
{
$this->departement = $departement;
return $this;
}
public function getFullMemberPage(): ?FullMemberPage
{
return $this->fullMemberPage;
}
public function setFullMemberPage(?FullMemberPage $fullMemberPage): self
{
$this->fullMemberPage = $fullMemberPage;
return $this;
}
public function getJoinPage(): ?Join
{
return $this->joinPage;
}
public function setJoinPage(?Join $joinPage): self
{
$this->joinPage = $joinPage;
return $this;
}
public function getPage(): ?Page
{
return $this->page;
}
public function setPage(?Page $page): self
{
$this->page = $page;
return $this;
}
public function getPartenairePage(): ?PartenairePage
{
return $this->partenairePage;
}
public function setPartenairePage(?PartenairePage $partenairePage): self
{
$this->partenairePage = $partenairePage;
return $this;
}
/**
* @return Collection<int, publication>
*/
public function getPublicationAssociates(): Collection
{
return $this->publicationAssociates;
}
public function addPublicationAssociate(Publication $publicationAssociate): self
{
if (!$this->publicationAssociates->contains($publicationAssociate)) {
$this->publicationAssociates[] = $publicationAssociate;
$publicationAssociate->setActuality($this);
}
return $this;
}
public function removePublicationAssociate(Publication $publicationAssociate): self
{
if ($this->publicationAssociates->removeElement($publicationAssociate)) {
// set the owning side to null (unless already changed)
if ($publicationAssociate->getActuality() === $this) {
$publicationAssociate->setActuality(null);
}
}
return $this;
}
public function getPublication(): ?Publication
{
return $this->publication;
}
public function setPublication(?Publication $publication): self
{
$this->publication = $publication;
return $this;
}
public function getPublicationPage(): ?PublicationPage
{
return $this->publicationPage;
}
public function setPublicationPage(?PublicationPage $publicationPage): self
{
$this->publicationPage = $publicationPage;
return $this;
}
public function getThese(): ?These
{
return $this->these;
}
public function setThese(?These $these): self
{
$this->these = $these;
return $this;
}
public function getThesePage(): ?ThesePage
{
return $this->thesePage;
}
public function setThesePage(?ThesePage $thesePage): self
{
$this->thesePage = $thesePage;
return $this;
}
public function getIllustrationName(): ?string
{
return $this->illustrationName;
}
public function setIllustrationName(?string $illustrationName): self
{
$this->illustrationName = $illustrationName;
return $this;
}
public function getIllustrationSize(): ?int
{
return $this->illustrationSize;
}
public function setIllustrationSize(?int $illustrationSize): self
{
$this->illustrationSize = $illustrationSize;
return $this;
}
public function getIllustrationUpdatedAt(): ?\DateTimeInterface
{
return $this->illustrationUpdatedAt;
}
public function setIllustrationUpdatedAt(?\DateTimeInterface $illustrationUpdatedAt): self
{
$this->illustrationUpdatedAt = $illustrationUpdatedAt;
return $this;
}
public function getIllustrationFile(): ?File
{
return $this->illustrationFile;
}
public function setIllustrationFile(?File $illustrationFile): self
{
$this->illustrationFile = $illustrationFile;
if (null !== $this->illustrationFile) {
$this->illustrationUpdatedAt = new \DateTimeImmutable();
}
return $this;
}
public function getIllustrationAlt(): ?string
{
return $this->illustrationAlt;
}
public function setIllustrationAlt(?string $illustrationAlt): self
{
$this->illustrationAlt = $illustrationAlt;
return $this;
}
public function isAboutAssociate(): ?bool
{
return $this->aboutAssociate;
}
public function setAboutAssociate(?bool $aboutAssociate): self
{
$this->aboutAssociate = $aboutAssociate;
return $this;
}
public function isCompositionAssociate(): ?bool
{
return $this->compositionAssociate;
}
public function setCompositionAssociate(?bool $compositionAssociate): self
{
$this->compositionAssociate = $compositionAssociate;
return $this;
}
public function isFullMemberAssociate(): ?bool
{
return $this->fullMemberAssociate;
}
public function setFullMemberAssociate(?bool $fullMemberAssociate): self
{
$this->fullMemberAssociate = $fullMemberAssociate;
return $this;
}
public function isDepartementAssociate(): ?bool
{
return $this->departementAssociate;
}
public function setDepartementAssociate(?bool $departementAssociate): self
{
$this->departementAssociate = $departementAssociate;
return $this;
}
public function isPartnerAssociate(): ?bool
{
return $this->partnerAssociate;
}
public function setPartnerAssociate(?bool $partnerAssociate): self
{
$this->partnerAssociate = $partnerAssociate;
return $this;
}
public function isPublicationAssociate(): ?bool
{
return $this->publicationAssociate;
}
public function setPublicationAssociate(?bool $publicationAssociate): self
{
$this->publicationAssociate = $publicationAssociate;
return $this;
}
public function isTheseAssociate(): ?bool
{
return $this->theseAssociate;
}
public function setTheseAssociate(?bool $theseAssociate): self
{
$this->theseAssociate = $theseAssociate;
return $this;
}
public function isActualityAssociate(): ?bool
{
return $this->actualityAssociate;
}
public function setActualityAssociate(?bool $actualityAssociate): self
{
$this->actualityAssociate = $actualityAssociate;
return $this;
}
public function isDefinitionAssociate(): ?bool
{
return $this->definitionAssociate;
}
public function setDefinitionAssociate(?bool $definitionAssociate): self
{
$this->definitionAssociate = $definitionAssociate;
return $this;
}
public function isManuelAssociate(): ?bool
{
return $this->manuelAssociate;
}
public function setManuelAssociate(?bool $manuelAssociate): self
{
$this->manuelAssociate = $manuelAssociate;
return $this;
}
public function isJoinAssociate(): ?bool
{
return $this->joinAssociate;
}
public function setJoinAssociate(?bool $joinAssociate): self
{
$this->joinAssociate = $joinAssociate;
return $this;
}
/**
* @return Collection<int, ActualityLabel>
*/
public function getLabels(): Collection
{
return $this->labels;
}
public function addLabel(ActualityLabel $label): self
{
if (!$this->labels->contains($label)) {
$this->labels[] = $label;
}
return $this;
}
public function removeLabel(ActualityLabel $label): self
{
$this->labels->removeElement($label);
return $this;
}
public function getHomepageLarge(): ?Homepage
{
return $this->homepageLarge;
}
public function setHomepageLarge(?Homepage $homepageLarge): self
{
$this->homepageLarge = $homepageLarge;
return $this;
}
public function getHomepageLittle(): ?Homepage
{
return $this->homepageLittle;
}
public function setHomepageLittle(?Homepage $homepageLittle): self
{
$this->homepageLittle = $homepageLittle;
return $this;
}
public function getManuelPage(): ?ManuelPage
{
return $this->manuelPage;
}
public function setManuelPage(?ManuelPage $manuelPage): self
{
$this->manuelPage = $manuelPage;
return $this;
}
public function getOldId(): ?int
{
return $this->old_id;
}
public function setOldId(?int $old_id): self
{
$this->old_id = $old_id;
return $this;
}
public function isActivate(): ?bool
{
return $this->activate;
}
public function setActivate(?bool $activate): self
{
$this->activate = $activate;
return $this;
}
/**
* @return Collection<int, HomepageActuality>
*/
public function getHomepageActualities(): Collection
{
return $this->homepageActualities;
}
public function addHomepageActuality(HomepageActuality $homepageActuality): self
{
if (!$this->homepageActualities->contains($homepageActuality)) {
$this->homepageActualities[] = $homepageActuality;
$homepageActuality->setActuality($this);
}
return $this;
}
public function removeHomepageActuality(HomepageActuality $homepageActuality): self
{
if ($this->homepageActualities->removeElement($homepageActuality)) {
// set the owning side to null (unless already changed)
if ($homepageActuality->getActuality() === $this) {
$homepageActuality->setActuality(null);
}
}
return $this;
}
}