<?php
namespace App\Entity;
use App\Repository\PublicationRepository;
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 App\Form\ContactPositionFormType;
/**
* @ORM\Entity(repositoryClass=PublicationRepository::class)
*/
class Publication 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\Column(type="text")
* @CrudField(label="Auteur(s)")
*/
private $author;
/**
* @ORM\OneToMany(targetEntity=Section::class, mappedBy="publication", cascade={"persist", "remove"}, fetch="EAGER")
*/
private $sections;
/**
* @ORM\OneToMany(targetEntity=DocumentAssociate::class, mappedBy="publication", cascade={"persist", "remove"})
* @CrudField(tab="Colonne de droite", label="Documents associés")
*/
private $documentAssociates;
/**
* @ORM\OneToMany(targetEntity=ContactAssociate::class, mappedBy="publication")
* @CrudField(tab="Colonne de droite", label="Contact")
*/
private $contactAssociates;
/**
* @ORM\OneToMany(targetEntity=ContactPosition::class, mappedBy="publication",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="publication")
* @CrudField(tab="Colonne de droite", label="Pages associées")
*/
private $pagesAssociates;
/**
* @ORM\OneToMany(targetEntity=Actuality::class, mappedBy="publication")
* @CrudField(tab="Colonne de droite", label="Actualités associées")
*/
private $actualitiesAssociates;
/**
* @ORM\OneToMany(targetEntity=These::class, mappedBy="publication")
* @CrudField(tab="Colonne de droite", label="Thèses associées")
*/
private $theseAssociates;
/**
* @ORM\OneToMany(targetEntity=Publication::class, mappedBy="publication")
* @CrudField(tab="Colonne de droite", label="Publications associées")
*/
private $publicationAssociates;
/**
* @ORM\Column(type="text", nullable=true)
* @CrudField(tab="Citation", label="Citation")
*/
private $quote;
/**
* @ORM\Column(type="date")
* @CrudField(label="Date de publication", index=true)
*/
private $date;
/**
* @ORM\Column(type="boolean", nullable=true, options={"default": true})
* @CrudField(index=true, label="Affiché cette page sur le site")
*/
private $activate;
/**
* @ORM\ManyToOne(targetEntity=About::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $about;
/**
* @ORM\ManyToOne(targetEntity=Actuality::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $actuality;
/**
* @ORM\ManyToOne(targetEntity=Composition::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $composition;
/**
* @ORM\ManyToOne(targetEntity=DefinitionPage::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $definitionPage;
/**
* @ORM\ManyToOne(targetEntity=Departement::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $departement;
/**
* @ORM\ManyToOne(targetEntity=FullMemberPage::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $fullMemberPage;
/**
* @ORM\ManyToOne(targetEntity=Join::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $joinPage;
/**
* @ORM\ManyToOne(targetEntity=Page::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $page;
/**
* @ORM\ManyToOne(targetEntity=PartenairePage::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $partenairePage;
/**
* @ORM\ManyToOne(targetEntity=Publication::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $publication;
/**
* @ORM\ManyToOne(targetEntity=PublicationPage::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $publicationPage;
/**
* @ORM\ManyToOne(targetEntity=These::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $these;
/**
* @ORM\ManyToOne(targetEntity=ThesePage::class, inversedBy="publicationAssociates")
* @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=ManuelPage::class, inversedBy="publicationAssociates")
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
*/
private $manuelPage;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $old_id;
public function __construct()
{
$this->sections = new ArrayCollection();
$this->documentAssociates = new ArrayCollection();
$this->contactAssociates = new ArrayCollection();
$this->contactPositions = new ArrayCollection();
$this->date = new DateTime();
$this->pagesAssociates = new ArrayCollection();
$this->actualitiesAssociates = new ArrayCollection();
$this->theseAssociates = new ArrayCollection();
$this->publicationAssociates = new ArrayCollection();
}
public function __toString(): string
{
return $this->getTitle() ?? $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 getAuthor(): ?string
{
return $this->author;
}
public function setAuthor(string $author): self
{
$this->author = $author;
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->setPublication($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->getPublication() === $this) {
$section->setPublication(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->setPublication($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->getPublication() === $this) {
$documentAssociate->setPublication(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->setPublication($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->getPublication() === $this) {
$contactAssociate->setPublication(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->setPublication($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->getPublication() === $this) {
$contactPosition->setPublication(null);
}
}
return $this;
}
public function getQuote(): ?string
{
return $this->quote;
}
public function setQuote(?string $quote): self
{
$this->quote = $quote;
return $this;
}
public function getDate(): ?\DateTimeInterface
{
return $this->date;
}
public function setDate(\DateTimeInterface $date): self
{
$this->date = $date;
return $this;
}
public function getAbout(): ?About
{
return $this->about;
}
public function setAbout(?About $about): self
{
$this->about = $about;
return $this;
}
public function getActuality(): ?Actuality
{
return $this->actuality;
}
public function setActuality(?Actuality $actuality): self
{
$this->actuality = $actuality;
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, page>
*/
public function getPagesAssociates(): Collection
{
return $this->pagesAssociates;
}
public function addPagesAssociate(Page $pagesAssociate): self
{
if (!$this->pagesAssociates->contains($pagesAssociate)) {
$this->pagesAssociates[] = $pagesAssociate;
$pagesAssociate->setPublication($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->getPublication() === $this) {
$pagesAssociate->setPublication(null);
}
}
return $this;
}
/**
* @return Collection<int, actuality>
*/
public function getActualitiesAssociates(): Collection
{
return $this->actualitiesAssociates;
}
public function addActualitiesAssociate(Actuality $actualitiesAssociate): self
{
if (!$this->actualitiesAssociates->contains($actualitiesAssociate)) {
$this->actualitiesAssociates[] = $actualitiesAssociate;
$actualitiesAssociate->setPublication($this);
}
return $this;
}
public function removeActualitiesAssociate(Actuality $actualitiesAssociate): self
{
if ($this->actualitiesAssociates->removeElement($actualitiesAssociate)) {
// set the owning side to null (unless already changed)
if ($actualitiesAssociate->getPublication() === $this) {
$actualitiesAssociate->setPublication(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->setPublication($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->getPublication() === $this) {
$theseAssociate->setPublication(null);
}
}
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->setPublication($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->getPublication() === $this) {
$publicationAssociate->setPublication(null);
}
}
return $this;
}
public function getPublication(): ?self
{
return $this->publication;
}
public function setPublication(?self $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 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;
}
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;
}
}