<?php
namespace App\Entity\Articles;
use Doctrine\DBAL\Types\Types;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
use Doctrine\ORM\Mapping as ORM;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
use Symfony\Component\HttpFoundation\File\File;
use App\Repository\Articles\ArticlesRepository;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Vich\UploaderBundle\Entity\File as EmbeddedFile;
/**
* Articles
*
* @ORM\Table("articles_articles")
* @ORM\Entity(repositoryClass=ArticlesRepository::class)
* @ORM\HasLifecycleCallbacks()
* @Vich\Uploadable
*/
class Articles {
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
* [Groups(['list', 'item'])]
*/
protected $id;
/**
* @var string
*
* @ORM\Column(name="created_at", type="datetime", nullable=true, options={"comment":"Date de création"})
*/
private $createdAt;
/**
* @var string
*
* @ORM\Column(name="updated_at", type="datetime", nullable=true, options={"comment":"Date de mise à jour"})
*/
private $updatedAt;
/**
* @var string
*
* @ORM\Column(name="published_at", type="datetime", nullable=true)
* [Groups(['list', 'item'])]
*/
private $publishedAt;
/**
* @var string
*
* @ORM\Column(name="slug", type="string", length=255, nullable=true)
*/
private $slug;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=500, nullable=true)
* [Groups(['list', 'item'])]
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="shortTitle", type="string", length=500, nullable=true)
*/
private $shortTitle;
/**
* @var string
*
* @ORM\Column(name="subtitle", type="string", length=500, nullable=true)
*/
private $subtitle;
/**
* @var string
*
* @ORM\Column(name="type", type="string", length=500, nullable=true)
*/
private $type;
/**
* @var string
*
* @ORM\Column(name="short_description", type="text", nullable=true)
*/
private $shortDescription;
/**
* @var string
*
* @ORM\Column(name="description", type="text", nullable=true)
* [Groups(['list', 'item'])]
*/
private $description;
/**
* @var string
*
* @ORM\Column(name="description_start", type="text", nullable=true)
* [Groups(['list', 'item'])]
*/
private $descriptionStart;
/**
* @var string
*
* @ORM\Column(name="tags", type="text", nullable=true)
* [Groups(['list', 'item'])]
*/
private $tags;
/**
* NOTE: This is not a mapped field of entity metadata, just a simple property.
*
* @Vich\UploadableField(mapping="articles_files", fileNameProperty="image.name", size="image.size", mimeType="image.mimeType", originalName="image.originalName", dimensions="image.dimensions")
*
* @var File|null
*/
private $imageFile;
/**
* @ORM\Embedded(class="Vich\UploaderBundle\Entity\File")
*
* @var EmbeddedFile
*/
private $image;
/**
* @var string
*
* @ORM\Column(name="visibility", type="boolean", nullable=true)
*/
private $visibility;
/**
* @var string
*
* @ORM\Column(name="language", type="text", nullable=true)
*/
private $language;
/**
* @var string
*
* @ORM\Column(name="carousel", type="boolean", nullable=true)
*/
private $carousel;
/**
* @var string
*
* @ORM\Column(name="featured", type="boolean", nullable=true)
*/
private $featured;
/**
* @var string
*
* @ORM\Column(name="autopublished_at", type="datetime", nullable=true)
*/
private $autopublishedAt;
/**
* @var string
*
* @ORM\Column(name="translation", type="text", nullable=true)
*/
private $translation;
/**
* @var string
*
* @ORM\Column(name="sitemap", type="boolean", nullable=true)
*/
private $sitemap;
/**
* @var string
*
* @ORM\Column(name="robots", type="string", length=255, nullable=true)
*/
private $robots;
/**
* @var string
*
* @ORM\Column(name="type_editor", type="boolean", nullable=true)
*/
private $typeEditor;
/**
* @var string
*
* @ORM\Column(name="canonical", type="string", length=500, nullable=true)
*/
private $canonical;
/**
* @var string
*
* @ORM\Column(name="author", type="string", length=155, nullable=true)
*/
private $author;
/**
* @var string
*
* @ORM\Column(name="url", type="string", length=500, nullable=true)
*/
private $url;
/**
* @var string
*
* @ORM\Column(name="cta_html", type="text", nullable=true)
*/
private $ctaHTML;
public function __construct() {
$this->image = new \Vich\UploaderBundle\Entity\File();
}
/**
* @ORM\PrePersist
*/
public function setCreatedAtValue(): void {
$this->setCreatedAt(new \DateTime("now"));
$this->setUpdatedAt(new \DateTime("now"));
$this->visibility = false;
$this->featured = false;
$this->carousel = false;
$this->language = "fr";
$this->sitemap = true;
$this->robots = "index,follow";
$this->typeEditor = "classic";
}
/**
* @ORM\PreUpdate
*/
public function setUpdatedAtValue(): void {
$this->setUpdatedAt(new \DateTime("now"));
}
public function __toString()
{
return $this->name;
}
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|UploadedFile|null $imageFile
*/
public function setImageFile(?File $imageFile = null)
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->setUpdatedAt(new \DateTime("now"));
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImage(EmbeddedFile $image): void
{
$this->image = $image;
}
public function getImage(): ?EmbeddedFile
{
return $this->image;
}
public function getId(): ?int
{
return $this->id;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}
public function setUpdatedAt(?\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getPublishedAt(): ?\DateTimeInterface
{
return $this->publishedAt;
}
public function setPublishedAt(?\DateTimeInterface $publishedAt): self
{
$this->publishedAt = $publishedAt;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(?string $title): self
{
$this->title = $title;
return $this;
}
public function getShortTitle(): ?string
{
return $this->shortTitle;
}
public function setShortTitle(?string $shortTitle): self
{
$this->shortTitle = $shortTitle;
return $this;
}
public function getSubtitle(): ?string
{
return $this->subtitle;
}
public function setSubtitle(?string $subtitle): self
{
$this->subtitle = $subtitle;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getShortDescription(): ?string
{
return $this->shortDescription;
}
public function setShortDescription(?string $shortDescription): self
{
$this->shortDescription = $shortDescription;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDescriptionStart(): ?string
{
return $this->descriptionStart;
}
public function setDescriptionStart(?string $descriptionStart): self
{
$this->descriptionStart = $descriptionStart;
return $this;
}
public function getTags(): ?string
{
return $this->tags;
}
public function setTags(?string $tags): self
{
$this->tags = $tags;
return $this;
}
public function getVisibility(): ?bool
{
return $this->visibility;
}
public function setVisibility(?bool $visibility): self
{
$this->visibility = $visibility;
return $this;
}
public function getLanguage(): ?string
{
return $this->language;
}
public function setLanguage(?string $language): self
{
$this->language = $language;
return $this;
}
public function getCarousel(): ?bool
{
return $this->carousel;
}
public function setCarousel(?bool $carousel): self
{
$this->carousel = $carousel;
return $this;
}
public function getFeatured(): ?bool
{
return $this->featured;
}
public function setFeatured(?bool $featured): self
{
$this->featured = $featured;
return $this;
}
public function getAutopublishedAt(): ?\DateTimeInterface
{
return $this->autopublishedAt;
}
public function setAutopublishedAt(?\DateTimeInterface $autopublishedAt): self
{
$this->autopublishedAt = $autopublishedAt;
return $this;
}
public function getTranslation(): ?string
{
return $this->translation;
}
public function setTranslation(?string $translation): self
{
$this->translation = $translation;
return $this;
}
public function getSitemap(): ?bool
{
return $this->sitemap;
}
public function setSitemap(?bool $sitemap): self
{
$this->sitemap = $sitemap;
return $this;
}
public function getRobots(): ?string
{
return $this->robots;
}
public function setRobots(?string $robots): self
{
$this->robots = $robots;
return $this;
}
public function getTypeEditor(): ?bool
{
return $this->typeEditor;
}
public function setTypeEditor(?bool $typeEditor): self
{
$this->typeEditor = $typeEditor;
return $this;
}
public function getCanonical(): ?string
{
return $this->canonical;
}
public function setCanonical(?string $canonical): self
{
$this->canonical = $canonical;
return $this;
}
public function getAuthor(): ?string
{
return $this->author;
}
public function setAuthor(?string $author): self
{
$this->author = $author;
return $this;
}
public function getUrl(): ?string
{
return $this->url;
}
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
public function getCtaHTML(): ?string
{
return $this->ctaHTML;
}
public function setCtaHTML(?string $ctaHTML): self
{
$this->ctaHTML = $ctaHTML;
return $this;
}
public function isVisibility(): ?bool
{
return $this->visibility;
}
public function isCarousel(): ?bool
{
return $this->carousel;
}
public function isFeatured(): ?bool
{
return $this->featured;
}
public function isSitemap(): ?bool
{
return $this->sitemap;
}
public function isTypeEditor(): ?bool
{
return $this->typeEditor;
}
}