src/Entity/MaritimeCategory.php line 25

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\QuoteTrait;
  4. use App\Repository\MaritimeCategoryRepository;
  5. use Cofondateur\SocleTechniqueBundle\Annotation\CrudField;
  6. use Cofondateur\SocleTechniqueBundle\Traits\SEOInterface;
  7. use Cofondateur\SocleTechniqueBundle\Traits\SEOTrait;
  8. use Cofondateur\SocleTechniqueBundle\Traits\SluggableInterface;
  9. use Cofondateur\SocleTechniqueBundle\Traits\SluggableTrait;
  10. use Doctrine\Common\Collections\ArrayCollection;
  11. use Doctrine\Common\Collections\Collection;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Component\HttpFoundation\File\File;
  14. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  15. use Vich\UploaderBundle\Mapping\Annotation\Uploadable;
  16. use App\Form\BlocFormType;
  17. use App\Form\OfferCustomFormType;
  18. /**
  19.  * @ORM\Entity(repositoryClass=MaritimeCategoryRepository::class)
  20.  * @Uploadable()
  21.  */
  22. class MaritimeCategory implements SEOInterfaceSluggableInterface
  23. {
  24.     
  25.     use SEOTrait;
  26.     use SluggableTrait;
  27.     use QuoteTrait;
  28.     
  29.     /**
  30.      * @ORM\Id
  31.      * @ORM\GeneratedValue
  32.      * @ORM\Column(type="integer")
  33.      */
  34.     private $id;
  35.     /**
  36.      * @ORM\Column(type="string")
  37.      */
  38.     private $coverName;
  39.     /**
  40.      * @ORM\Column(type="integer")
  41.      */
  42.     private $coverSize;
  43.     /**
  44.      * @ORM\Column(type="datetime", nullable=true)
  45.      */
  46.     private $coverUpdatedAt;
  47.     /**
  48.      * @Vich\UploadableField(mapping="default", fileNameProperty="coverName", size="coverSize")
  49.      * @CrudField(label="Visuel principal (bandeau top)")
  50.      */
  51.     private $coverFile;
  52.     /**
  53.      * @ORM\Column(type="string", nullable=true)
  54.      * @CrudField(label="Alt du visuel principal")
  55.      */
  56.     private $coverAlt;
  57.     /**
  58.      * @ORM\Column(type="string", length=255)
  59.      * @CrudField(index=true, label="Nom (affiché dans le menu)")
  60.      */
  61.     private $name;
  62.     /**
  63.      * @ORM\Column(type="string", length=255)
  64.      * @CrudField(label="Titre (bandeau top) (mettre entre étoiles pour rendre le titre en bleu. Exemple : 'ceci est en noir *ceci est bleu*')")
  65.      */
  66.     private $title;
  67.     /**
  68.      * @ORM\Column(type="string", length=255)
  69.      * @CrudField(tab="Introduction", label="Sur titre")
  70.      */
  71.     private $introSubTitle;
  72.     /**
  73.      * @ORM\Column(type="string", length=255)
  74.      * @CrudField(tab="Introduction", label="Titre (mettre entre étoiles pour rendre le titre en bleu. Exemple : 'ceci est en noir *ceci est bleu*')")
  75.      */
  76.     private $introTitle;
  77.     /**
  78.      * @ORM\Column(type="text")
  79.      * @CrudField(tab="Introduction", label="Paragraphe", ckeditor=true)
  80.      */
  81.     private $introParagraph;
  82.     /**
  83.      * @ORM\OneToMany(targetEntity=Bloc::class, mappedBy="maritimeCategory", cascade={"persist", "remove"}, orphanRemoval=true)
  84.      * @CrudField(label="Paragraphes", formType=BlocFormType::class, tab="Paragraphes")
  85.      */
  86.     private $paragraphs;
  87.     /**
  88.      * @ORM\Column(type="string", length=255)
  89.      * @CrudField(label="Sur titre", tab="Contrats")
  90.      */
  91.     private $offerSubTitle;
  92.     /**
  93.      * @ORM\Column(type="string", length=255)
  94.      * @CrudField(label="Titre", tab="Contrats")
  95.      */
  96.     private $offerTitle;
  97.     /**
  98.      * @ORM\Column(type="text")
  99.      * @CrudField(label="Paragraphe", tab="Contrats")
  100.      */
  101.     private $offerParagraph;
  102.     /**
  103.      * @ORM\OneToMany(targetEntity=Offer::class, mappedBy="maritimeCategory", cascade={"persist", "remove"}, orphanRemoval=true)
  104.      */
  105.     private $offers;
  106.     /**
  107.      * @Vich\UploadableField(mapping="default", fileNameProperty="quoteCoverName", size="quoteCoverSize")
  108.      * @CrudField(tab="Citation", label="Visuel de fond")
  109.      */
  110.     private $quoteCoverFile;
  111.     public function __construct()
  112.     {
  113.         $this->paragraphs = new ArrayCollection();
  114.         $this->offers = new ArrayCollection();
  115.     }
  116.     public function __toString(): string
  117.     {
  118.         return $this->getName() ?? $this->getId() ?? "N/A";
  119.     }
  120.     public function getId(): ?int
  121.     {
  122.         return $this->id;
  123.     }
  124.     public function getCoverName(): ?string
  125.     {
  126.         return $this->coverName;
  127.     }
  128.     public function setCoverName(?string $coverName): self
  129.     {
  130.         $this->coverName $coverName;
  131.         return $this;
  132.     }
  133.     public function getCoverSize(): ?int
  134.     {
  135.         return $this->coverSize;
  136.     }
  137.     public function setCoverSize(?int $coverSize): self
  138.     {
  139.         $this->coverSize $coverSize;
  140.         return $this;
  141.     }
  142.     public function getCoverUpdatedAt(): ?\DateTimeInterface
  143.     {
  144.         return $this->coverUpdatedAt;
  145.     }
  146.     public function setCoverUpdatedAt(?\DateTimeInterface $coverUpdatedAt): self
  147.     {
  148.         $this->coverUpdatedAt $coverUpdatedAt;
  149.         return $this;
  150.     }
  151.     public function getCoverFile(): ?File
  152.     {
  153.         return $this->coverFile;
  154.     }
  155.     public function setCoverFile(?File $coverFile): self
  156.     {
  157.         $this->coverFile $coverFile;
  158.         if (null !== $this->coverFile) {
  159.             $this->coverUpdatedAt = new \DateTimeImmutable();
  160.         }
  161.         return $this;
  162.     }
  163.     public function getCoverAlt(): ?string
  164.     {
  165.         return $this->coverAlt;
  166.     }
  167.     public function setCoverAlt(?string $coverAlt): self
  168.     {
  169.         $this->coverAlt $coverAlt;
  170.         return $this;
  171.     }
  172.     public function getIntroSubTitle(): ?string
  173.     {
  174.         return $this->introSubTitle;
  175.     }
  176.     public function setIntroSubTitle(string $introSubTitle): self
  177.     {
  178.         $this->introSubTitle $introSubTitle;
  179.         return $this;
  180.     }
  181.     public function getIntroTitle(): ?string
  182.     {
  183.         return $this->introTitle;
  184.     }
  185.     public function setIntroTitle(string $introTitle): self
  186.     {
  187.         $this->introTitle $introTitle;
  188.         return $this;
  189.     }
  190.     public function getName(): ?string
  191.     {
  192.         return $this->name;
  193.     }
  194.     public function setName(string $name): self
  195.     {
  196.         $this->name $name;
  197.         return $this;
  198.     }
  199.     public function getIntroParagraph(): ?string
  200.     {
  201.         return $this->introParagraph;
  202.     }
  203.     public function setIntroParagraph(string $introParagraph): self
  204.     {
  205.         $this->introParagraph $introParagraph;
  206.         return $this;
  207.     }
  208.     /**
  209.      * @return Collection<int, Bloc>
  210.      */
  211.     public function getParagraphs(): Collection
  212.     {
  213.         return $this->paragraphs;
  214.     }
  215.     public function addParagraph(Bloc $paragraph): self
  216.     {
  217.         if (!$this->paragraphs->contains($paragraph)) {
  218.             $this->paragraphs[] = $paragraph;
  219.             $paragraph->setMaritimeCategory($this);
  220.         }
  221.         return $this;
  222.     }
  223.     public function removeParagraph(Bloc $paragraph): self
  224.     {
  225.         if ($this->paragraphs->removeElement($paragraph)) {
  226.             // set the owning side to null (unless already changed)
  227.             if ($paragraph->getMaritimeCategory() === $this) {
  228.                 $paragraph->setMaritimeCategory(null);
  229.             }
  230.         }
  231.         return $this;
  232.     }
  233.     /**
  234.      * @return Collection<int, Offer>
  235.      */
  236.     public function getOffers(): Collection
  237.     {
  238.         return $this->offers;
  239.     }
  240.     public function addOffer(Offer $offer): self
  241.     {
  242.         if (!$this->offers->contains($offer)) {
  243.             $this->offers[] = $offer;
  244.             $offer->setMaritimeCategory($this);
  245.         }
  246.         return $this;
  247.     }
  248.     public function removeOffer(Offer $offer): self
  249.     {
  250.         if ($this->offers->removeElement($offer)) {
  251.             // set the owning side to null (unless already changed)
  252.             if ($offer->getMaritimeCategory() === $this) {
  253.                 $offer->setMaritimeCategory(null);
  254.             }
  255.         }
  256.         return $this;
  257.     }
  258.     public function getOfferSubTitle(): ?string
  259.     {
  260.         return $this->offerSubTitle;
  261.     }
  262.     public function setOfferSubTitle(string $offerSubTitle): self
  263.     {
  264.         $this->offerSubTitle $offerSubTitle;
  265.         return $this;
  266.     }
  267.     public function getOfferTitle(): ?string
  268.     {
  269.         return $this->offerTitle;
  270.     }
  271.     public function setOfferTitle(string $offerTitle): self
  272.     {
  273.         $this->offerTitle $offerTitle;
  274.         return $this;
  275.     }
  276.     public function getOfferParagraph(): ?string
  277.     {
  278.         return $this->offerParagraph;
  279.     }
  280.     public function setOfferParagraph(string $offerParagraph): self
  281.     {
  282.         $this->offerParagraph $offerParagraph;
  283.         return $this;
  284.     }
  285.     public function getTitle(): ?string
  286.     {
  287.         return $this->title;
  288.     }
  289.     public function setTitle(string $title): self
  290.     {
  291.         $this->title $title;
  292.         return $this;
  293.     }
  294. }