src/Entity/Website/Cms/Article.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Website\Cms;
  3. use App\Entity\BaseEntity;
  4. use App\Entity\Website\Website\Website;
  5. use App\Repository\Website\Cms\ArticleRepository;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\IdGenerator\UuidGenerator;
  9. use Doctrine\Common\Collections\Collection;
  10. #[ORM\Entity(repositoryClassArticleRepository::class)]
  11. class Article extends BaseEntity
  12. {
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue(strategy'CUSTOM')]
  15.     #[ORM\CustomIdGenerator(class: UuidGenerator::class)]
  16.     #[ORM\Column(type'guid'uniquetrue)]
  17.     private ?string $id null;
  18.     #[ORM\Column(length200)]
  19.     private string $title;
  20.     #[ORM\Column(length150uniquetrue)]
  21.     private string $slug;
  22.     #[ORM\Column(type'text')]
  23.     private string $content;
  24.     #[ORM\Column(length255nullabletrue)]
  25.     private ?string $excerpt null;
  26.     #[ORM\Column(length255nullabletrue)]
  27.     private ?string $coverImage null;
  28.     // SEO
  29.     #[ORM\Column(length255nullabletrue)]
  30.     private ?string $metaTitle null;
  31.     #[ORM\Column(type'text'nullabletrue)]
  32.     private ?string $metaDescription null;
  33.     #[ORM\Column(type'json'nullabletrue)]
  34.     private ?array $metaKeywords null;
  35.     #[ORM\Column(length255nullabletrue)]
  36.     private ?string $ogImage null;
  37.     #[ORM\Column(length255nullabletrue)]
  38.     private ?string $canonicalUrl null;
  39.     #[ORM\Column(nullabletrue)]
  40.     private ?bool $noIndex false;
  41.     #[ORM\Column(nullabletrue)]
  42.     private ?bool $noFollow false;
  43.     #[ORM\Column(length100nullabletrue)]
  44.     private ?string $schemaType 'BlogPosting';
  45.     #[ORM\Column(type'json'nullabletrue)]
  46.     private ?array $schemaData null;
  47.     #[ORM\Column(type'json'nullabletrue)]
  48.     private ?array $alternateLangs null;
  49.     #[ORM\Column(type'float'nullabletrue)]
  50.     private ?float $priorityInSitemap 0.7;
  51.     #[ORM\Column(length50nullabletrue)]
  52.     private ?string $changeFrequency 'weekly';
  53.     #[ORM\ManyToOne(inversedBy'articles')]
  54.     private ?Category $category null;
  55.     #[ORM\ManyToMany(targetEntityTag::class, inversedBy'articles')]
  56.     private Collection $tags;
  57.     #[ORM\ManyToOne(inversedBy'articles')]
  58.     #[ORM\JoinColumn(nullablefalse)]
  59.     private ?Website $website null;
  60.     public function __construct()
  61.     {
  62.         parent::__construct();
  63.         $this->tags = new ArrayCollection();
  64.     }
  65.     public function getId(): ?string
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function getTitle(): string
  70.     {
  71.         return $this->title;
  72.     }
  73.     public function setTitle(string $title): Article
  74.     {
  75.         $this->title $title;
  76.         return $this;
  77.     }
  78.     public function getSlug(): string
  79.     {
  80.         return $this->slug;
  81.     }
  82.     public function setSlug(string $slug): Article
  83.     {
  84.         $this->slug $slug;
  85.         return $this;
  86.     }
  87.     public function getContent(): string
  88.     {
  89.         return $this->content;
  90.     }
  91.     public function setContent(string $content): Article
  92.     {
  93.         $this->content $content;
  94.         return $this;
  95.     }
  96.     public function getExcerpt(): ?string
  97.     {
  98.         return $this->excerpt;
  99.     }
  100.     public function setExcerpt(?string $excerpt): Article
  101.     {
  102.         $this->excerpt $excerpt;
  103.         return $this;
  104.     }
  105.     public function getCoverImage(): ?string
  106.     {
  107.         return $this->coverImage;
  108.     }
  109.     public function setCoverImage(?string $coverImage): Article
  110.     {
  111.         $this->coverImage $coverImage;
  112.         return $this;
  113.     }
  114.     public function getMetaTitle(): ?string
  115.     {
  116.         return $this->metaTitle;
  117.     }
  118.     public function setMetaTitle(?string $metaTitle): Article
  119.     {
  120.         $this->metaTitle $metaTitle;
  121.         return $this;
  122.     }
  123.     public function getMetaDescription(): ?string
  124.     {
  125.         return $this->metaDescription;
  126.     }
  127.     public function setMetaDescription(?string $metaDescription): Article
  128.     {
  129.         $this->metaDescription $metaDescription;
  130.         return $this;
  131.     }
  132.     public function getMetaKeywords(): ?array
  133.     {
  134.         return $this->metaKeywords;
  135.     }
  136.     public function setMetaKeywords(?array $metaKeywords): Article
  137.     {
  138.         $this->metaKeywords $metaKeywords;
  139.         return $this;
  140.     }
  141.     public function getOgImage(): ?string
  142.     {
  143.         return $this->ogImage;
  144.     }
  145.     public function setOgImage(?string $ogImage): Article
  146.     {
  147.         $this->ogImage $ogImage;
  148.         return $this;
  149.     }
  150.     public function getCanonicalUrl(): ?string
  151.     {
  152.         return $this->canonicalUrl;
  153.     }
  154.     public function setCanonicalUrl(?string $canonicalUrl): Article
  155.     {
  156.         $this->canonicalUrl $canonicalUrl;
  157.         return $this;
  158.     }
  159.     public function getNoIndex(): ?bool
  160.     {
  161.         return $this->noIndex;
  162.     }
  163.     public function setNoIndex(?bool $noIndex): Article
  164.     {
  165.         $this->noIndex $noIndex;
  166.         return $this;
  167.     }
  168.     public function getNoFollow(): ?bool
  169.     {
  170.         return $this->noFollow;
  171.     }
  172.     public function setNoFollow(?bool $noFollow): Article
  173.     {
  174.         $this->noFollow $noFollow;
  175.         return $this;
  176.     }
  177.     public function getSchemaType(): ?string
  178.     {
  179.         return $this->schemaType;
  180.     }
  181.     public function setSchemaType(?string $schemaType): Article
  182.     {
  183.         $this->schemaType $schemaType;
  184.         return $this;
  185.     }
  186.     public function getSchemaData(): ?array
  187.     {
  188.         return $this->schemaData;
  189.     }
  190.     public function setSchemaData(?array $schemaData): Article
  191.     {
  192.         $this->schemaData $schemaData;
  193.         return $this;
  194.     }
  195.     public function getAlternateLangs(): ?array
  196.     {
  197.         return $this->alternateLangs;
  198.     }
  199.     public function setAlternateLangs(?array $alternateLangs): Article
  200.     {
  201.         $this->alternateLangs $alternateLangs;
  202.         return $this;
  203.     }
  204.     public function getPriorityInSitemap(): ?float
  205.     {
  206.         return $this->priorityInSitemap;
  207.     }
  208.     public function setPriorityInSitemap(?float $priorityInSitemap): Article
  209.     {
  210.         $this->priorityInSitemap $priorityInSitemap;
  211.         return $this;
  212.     }
  213.     public function getChangeFrequency(): ?string
  214.     {
  215.         return $this->changeFrequency;
  216.     }
  217.     public function setChangeFrequency(?string $changeFrequency): Article
  218.     {
  219.         $this->changeFrequency $changeFrequency;
  220.         return $this;
  221.     }
  222.     public function getCategory(): ?Category
  223.     {
  224.         return $this->category;
  225.     }
  226.     public function setCategory(?Category $category): static
  227.     {
  228.         $this->category $category;
  229.         return $this;
  230.     }
  231.     /**
  232.      * @return Collection<int, Tag>
  233.      */
  234.     public function getTags(): Collection
  235.     {
  236.         return $this->tags;
  237.     }
  238.     public function addTag(Tag $tag): static
  239.     {
  240.         if (!$this->tags->contains($tag)) {
  241.             $this->tags->add($tag);
  242.         }
  243.         return $this;
  244.     }
  245.     public function removeTag(Tag $tag): static
  246.     {
  247.         $this->tags->removeElement($tag);
  248.         return $this;
  249.     }
  250.     public function getWebsite(): ?Website
  251.     {
  252.         return $this->website;
  253.     }
  254.     public function setWebsite(?Website $website): static
  255.     {
  256.         $this->website $website;
  257.         return $this;
  258.     }
  259. }