<?php
namespace App\Entity;
use App\Entity\Traits\QuoteTrait;
use App\Repository\MaritimeCategoryRepository;
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 Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Vich\UploaderBundle\Mapping\Annotation\Uploadable;
use App\Form\BlocFormType;
use App\Form\OfferCustomFormType;
/**
* @ORM\Entity(repositoryClass=MaritimeCategoryRepository::class)
* @Uploadable()
*/
class MaritimeCategory implements SEOInterface, SluggableInterface
{
use SEOTrait;
use SluggableTrait;
use QuoteTrait;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string")
*/
private $coverName;
/**
* @ORM\Column(type="integer")
*/
private $coverSize;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $coverUpdatedAt;
/**
* @Vich\UploadableField(mapping="default", fileNameProperty="coverName", size="coverSize")
* @CrudField(label="Visuel principal (bandeau top)")
*/
private $coverFile;
/**
* @ORM\Column(type="string", nullable=true)
* @CrudField(label="Alt du visuel principal")
*/
private $coverAlt;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(index=true, label="Nom (affiché dans le menu)")
*/
private $name;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(label="Titre (bandeau top) (mettre entre étoiles pour rendre le titre en bleu. Exemple : 'ceci est en noir *ceci est bleu*')")
*/
private $title;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(tab="Introduction", label="Sur titre")
*/
private $introSubTitle;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(tab="Introduction", label="Titre (mettre entre étoiles pour rendre le titre en bleu. Exemple : 'ceci est en noir *ceci est bleu*')")
*/
private $introTitle;
/**
* @ORM\Column(type="text")
* @CrudField(tab="Introduction", label="Paragraphe", ckeditor=true)
*/
private $introParagraph;
/**
* @ORM\OneToMany(targetEntity=Bloc::class, mappedBy="maritimeCategory", cascade={"persist", "remove"}, orphanRemoval=true)
* @CrudField(label="Paragraphes", formType=BlocFormType::class, tab="Paragraphes")
*/
private $paragraphs;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(label="Sur titre", tab="Contrats")
*/
private $offerSubTitle;
/**
* @ORM\Column(type="string", length=255)
* @CrudField(label="Titre", tab="Contrats")
*/
private $offerTitle;
/**
* @ORM\Column(type="text")
* @CrudField(label="Paragraphe", tab="Contrats")
*/
private $offerParagraph;
/**
* @ORM\OneToMany(targetEntity=Offer::class, mappedBy="maritimeCategory", cascade={"persist", "remove"}, orphanRemoval=true)
*/
private $offers;
/**
* @Vich\UploadableField(mapping="default", fileNameProperty="quoteCoverName", size="quoteCoverSize")
* @CrudField(tab="Citation", label="Visuel de fond")
*/
private $quoteCoverFile;
public function __construct()
{
$this->paragraphs = new ArrayCollection();
$this->offers = new ArrayCollection();
}
public function __toString(): string
{
return $this->getName() ?? $this->getId() ?? "N/A";
}
public function getId(): ?int
{
return $this->id;
}
public function getCoverName(): ?string
{
return $this->coverName;
}
public function setCoverName(?string $coverName): self
{
$this->coverName = $coverName;
return $this;
}
public function getCoverSize(): ?int
{
return $this->coverSize;
}
public function setCoverSize(?int $coverSize): self
{
$this->coverSize = $coverSize;
return $this;
}
public function getCoverUpdatedAt(): ?\DateTimeInterface
{
return $this->coverUpdatedAt;
}
public function setCoverUpdatedAt(?\DateTimeInterface $coverUpdatedAt): self
{
$this->coverUpdatedAt = $coverUpdatedAt;
return $this;
}
public function getCoverFile(): ?File
{
return $this->coverFile;
}
public function setCoverFile(?File $coverFile): self
{
$this->coverFile = $coverFile;
if (null !== $this->coverFile) {
$this->coverUpdatedAt = new \DateTimeImmutable();
}
return $this;
}
public function getCoverAlt(): ?string
{
return $this->coverAlt;
}
public function setCoverAlt(?string $coverAlt): self
{
$this->coverAlt = $coverAlt;
return $this;
}
public function getIntroSubTitle(): ?string
{
return $this->introSubTitle;
}
public function setIntroSubTitle(string $introSubTitle): self
{
$this->introSubTitle = $introSubTitle;
return $this;
}
public function getIntroTitle(): ?string
{
return $this->introTitle;
}
public function setIntroTitle(string $introTitle): self
{
$this->introTitle = $introTitle;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getIntroParagraph(): ?string
{
return $this->introParagraph;
}
public function setIntroParagraph(string $introParagraph): self
{
$this->introParagraph = $introParagraph;
return $this;
}
/**
* @return Collection<int, Bloc>
*/
public function getParagraphs(): Collection
{
return $this->paragraphs;
}
public function addParagraph(Bloc $paragraph): self
{
if (!$this->paragraphs->contains($paragraph)) {
$this->paragraphs[] = $paragraph;
$paragraph->setMaritimeCategory($this);
}
return $this;
}
public function removeParagraph(Bloc $paragraph): self
{
if ($this->paragraphs->removeElement($paragraph)) {
// set the owning side to null (unless already changed)
if ($paragraph->getMaritimeCategory() === $this) {
$paragraph->setMaritimeCategory(null);
}
}
return $this;
}
/**
* @return Collection<int, Offer>
*/
public function getOffers(): Collection
{
return $this->offers;
}
public function addOffer(Offer $offer): self
{
if (!$this->offers->contains($offer)) {
$this->offers[] = $offer;
$offer->setMaritimeCategory($this);
}
return $this;
}
public function removeOffer(Offer $offer): self
{
if ($this->offers->removeElement($offer)) {
// set the owning side to null (unless already changed)
if ($offer->getMaritimeCategory() === $this) {
$offer->setMaritimeCategory(null);
}
}
return $this;
}
public function getOfferSubTitle(): ?string
{
return $this->offerSubTitle;
}
public function setOfferSubTitle(string $offerSubTitle): self
{
$this->offerSubTitle = $offerSubTitle;
return $this;
}
public function getOfferTitle(): ?string
{
return $this->offerTitle;
}
public function setOfferTitle(string $offerTitle): self
{
$this->offerTitle = $offerTitle;
return $this;
}
public function getOfferParagraph(): ?string
{
return $this->offerParagraph;
}
public function setOfferParagraph(string $offerParagraph): self
{
$this->offerParagraph = $offerParagraph;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
}