src/Entity/Blog.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\BlogRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=BlogRepository::class)
  11.  * @UniqueEntity("slug")
  12.  */
  13. class Blog
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column
  19.      */
  20.     private ?int $id null;
  21.     /**
  22.      * @ORM\Column(length=255)
  23.      */
  24.     private ?string $title null;
  25.     /**
  26.      * @ORM\Column(length=255)
  27.      */
  28.     private ?string $breadcrumb null;
  29.     public function getBreadcrumb(): ?string
  30.     {
  31.         return $this->breadcrumb;
  32.     }
  33.     public function setBreadcrumb(?string $breadcrumb): void
  34.     {
  35.         $this->breadcrumb $breadcrumb;
  36.     }
  37.     /**
  38.      * @ORM\Column(length=255, unique=true)
  39.      *
  40.      */
  41.     private ?string $slug null;
  42.     /**
  43.      * @ORM\Column(length=255)
  44.      */
  45.     private ?string $keywords null;
  46.     /**
  47.      * @ORM\Column(length=255)
  48.      */
  49.     private ?string $description null;
  50.     public function getRtTime(): ?int
  51.     {
  52.         return $this->rtTime;
  53.     }
  54.     public function setRtTime(?int $rtTime): void
  55.     {
  56.         $this->rtTime $rtTime;
  57.     }
  58.     public function getView(): ?int
  59.     {
  60.         return $this->view;
  61.     }
  62.     public function setView(?int $view): void
  63.     {
  64.         $this->view $view;
  65.     }
  66.     /**
  67.      * @ORM\Column (type="integer")
  68.      */
  69.     private ?int $rtTime 0;
  70.     /**
  71.      * @ORM\Column (type="integer")
  72.      */
  73.     private ?int $view 0;
  74.     /**
  75.      * @ORM\Column(type="text")
  76.      */
  77.     private ?string $content null;
  78.     /**
  79.      * @ORM\Column
  80.      */
  81.     private ?\DateTimeImmutable $created_at null;
  82.     /**
  83.      * @ORM\Column(type="datetime_immutable", nullable=true)
  84.      */
  85.     private $updated_at ;
  86.     /**
  87.      * @ORM\Column(length=255)
  88.      * @Assert\NotBlank(message="Le champ titre ne peut pas ĂȘtre vide")
  89.      */
  90.     private  $bigtitle ;
  91.      /**
  92.      * @ORM\ManyToOne(targetEntity=PublicationImage::class)
  93.      * @ORM\JoinColumn(name="blogimage_id", referencedColumnName="id", nullable=true)
  94.      */
  95.     private ?PublicationImage $blogimage null;
  96.     /**
  97.      * @ORM\ManyToMany(targetEntity=Thematique::class, inversedBy="blogs")
  98.      */
  99.     private Collection $thematique;
  100.     /**
  101.      * @ORM\ManyToMany(targetEntity=SousThematique::class, inversedBy="blogs")
  102.      */
  103.     private Collection $sous_thematique;
  104.     public function __construct()
  105.     {
  106.         $this->thematique = new ArrayCollection();
  107.         $this->sous_thematique = new ArrayCollection();
  108.     }
  109.     public function getId(): ?int
  110.     {
  111.         return $this->id;
  112.     }
  113.     public function getTitle(): ?string
  114.     {
  115.         return $this->title;
  116.     }
  117.     public function setTitle(?string $title)
  118.     {
  119.         $this->title $title;
  120.         return $this;
  121.     }
  122.     public function getSlug(): ?string
  123.     {
  124.         return $this->slug;
  125.     }
  126.     public function setSlug(?string $slug)
  127.     {
  128.         $this->slug $slug;
  129.         return $this;
  130.     }
  131.     public function getKeywords(): ?string
  132.     {
  133.         return $this->keywords;
  134.     }
  135.     public function setKeywords(?string $keywords)
  136.     {
  137.         $this->keywords $keywords;
  138.         return $this;
  139.     }
  140.     public function getContent(): ?string
  141.     {
  142.         return $this->content;
  143.     }
  144.     public function setContent(?string $content)
  145.     {
  146.         $this->content $content;
  147.         return $this;
  148.     }
  149.     public function getCreatedAt(): ?\DateTimeImmutable
  150.     {
  151.         return $this->created_at;
  152.     }
  153.     public function setCreatedAt(\DateTimeImmutable $created_at)
  154.     {
  155.         $this->created_at $created_at;
  156.         return $this;
  157.     }
  158.     public function getUpdatedAt(): ?\DateTimeImmutable
  159.     {
  160.         return $this->updated_at;
  161.     }
  162.     public function setUpdatedAt(\DateTimeImmutable $updated_at)
  163.     {
  164.         $this->updated_at $updated_at;
  165.         return $this;
  166.     }
  167.     public function getBigtitle(): ?string
  168.     {
  169.         return $this->bigtitle;
  170.     }
  171.     public function setBigtitle(?string $bigtitle)
  172.     {
  173.         $this->bigtitle $bigtitle;
  174.         return $this;
  175.     }
  176.     public function getBlogimage(): ?PublicationImage
  177.     {
  178.         return $this->blogimage;
  179.     }
  180.     public function setBlogimage(?PublicationImage $blogimage)
  181.     {
  182.         $this->blogimage $blogimage;
  183.         return $this;
  184.     }
  185.     /**
  186.      * @return Collection<int, Thematique>
  187.      */
  188.     public function getThematique(): Collection
  189.     {
  190.         return $this->thematique;
  191.     }
  192.     public function addThematique(Thematique $thematique)
  193.     {
  194.         if (!$this->thematique->contains($thematique)) {
  195.             $this->thematique->add($thematique);
  196.         }
  197.         return $this;
  198.     }
  199.     public function removeThematique(Thematique $thematique)
  200.     {
  201.         $this->thematique->removeElement($thematique);
  202.         return $this;
  203.     }
  204.     /**
  205.      * @return Collection<int, SousThematique>
  206.      */
  207.     public function getSousThematique(): Collection
  208.     {
  209.         return $this->sous_thematique;
  210.     }
  211.     public function addSousThematique(SousThematique $sousThematique): static
  212.     {
  213.         if (!$this->sous_thematique->contains($sousThematique)) {
  214.             $this->sous_thematique->add($sousThematique);
  215.         }
  216.         return $this;
  217.     }
  218.     public function removeSousThematique(SousThematique $sousThematique): static
  219.     {
  220.         $this->sous_thematique->removeElement($sousThematique);
  221.         return $this;
  222.     }
  223.     public function getDescription(): ?string
  224.     {
  225.         return $this->description;
  226.     }
  227.     public function setDescription(?string $description): void
  228.     {
  229.         $this->description $description;
  230.     }
  231. }