src/Entity/Publication.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PublicationRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  7. /**
  8.  * @ORM\Entity(repositoryClass=PublicationRepository::class)
  9.  * @UniqueEntity(fields={"slug"}, message="url déja utilisé")
  10.  */
  11. class Publication
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255)
  21.      */
  22.     private $title;
  23.     /**
  24.      * @ORM\Column(type="string", length=255)
  25.      */
  26.     private $description;
  27.     /**
  28.      * @ORM\Column(type="string", length=255, unique=true)
  29.      */
  30.     private $slug;
  31.     /**
  32.      * @ORM\Column(type="string", length=255, nullable=true)
  33.      */
  34.     private $keywodrs;
  35.     /**
  36.      * @ORM\Column(type="text")
  37.      */
  38.     private $content;
  39.     /**
  40.      * @ORM\Column(type="datetime_immutable")
  41.      */
  42.     private $created_at;
  43.     /**
  44.      * @ORM\Column(type="datetime_immutable", nullable=true)
  45.      */
  46.     private $updated_at;
  47.     /**
  48.      * @ORM\ManyToOne(targetEntity=PublicationImage::class, inversedBy="publications")
  49.      */
  50.     private $publicationImage;
  51.     /**
  52.      * @ORM\Column(type="string", length=190, nullable=true)
  53.      */
  54.     private $bigtitle;
  55.     /**
  56.      * @ORM\Column(type="string", length=150, nullable=true)
  57.      */
  58.     private $breadcrumbs;
  59.     public function getRtTime(): ?int
  60.     {
  61.         return $this->rtTime;
  62.     }
  63.     public function setRtTime(?int $rtTime): void
  64.     {
  65.         $this->rtTime $rtTime;
  66.     }
  67.     public function getView(): ?int
  68.     {
  69.         return $this->view;
  70.     }
  71.     public function setView(?int $view): void
  72.     {
  73.         $this->view $view;
  74.     }
  75.     /**
  76.      * @ORM\Column (type="integer")
  77.      */
  78.     private ?int $rtTime 0;
  79.     /**
  80.      * @ORM\Column (type="integer")
  81.      */
  82.     private ?int $view 0;
  83.     /**
  84.      * @ORM\Column(type="boolean")
  85.      */
  86.     private $template;
  87.     
  88.     // ---------------------------------------------------------------------
  89.     public function getTemplate(): ?bool
  90.     {
  91.         return $this->template;
  92.     }
  93.     public function setTemplate(bool $template): self
  94.     {
  95.         $this->template $template;
  96.         return $this;
  97.     }
  98.     public function getDateAffiche(){
  99.         if($this->updated_at){
  100.             return $this->updated_at;
  101.         }
  102.         return $this->created_at;
  103.     }
  104.     // ---------------------------------------------------------------------
  105.     public function getId(): ?int
  106.     {
  107.         return $this->id;
  108.     }
  109.     public function getTitle(): ?string
  110.     {
  111.         return $this->title;
  112.     }
  113.     public function setTitle(string $title): self
  114.     {
  115.         $this->title $title;
  116.         return $this;
  117.     }
  118.     public function getDescription(): ?string
  119.     {
  120.         return $this->description;
  121.     }
  122.     public function setDescription(string $description): self
  123.     {
  124.         $this->description $description;
  125.         return $this;
  126.     }
  127.     public function getSlug(): ?string
  128.     {
  129.         return $this->slug;
  130.     }
  131.     public function setSlug(string $slug): self
  132.     {
  133.         $this->slug $slug;
  134.         return $this;
  135.     }
  136.     public function getKeywodrs(): ?string
  137.     {
  138.         return $this->keywodrs;
  139.     }
  140.     public function setKeywodrs(?string $keywodrs): self
  141.     {
  142.         $this->keywodrs $keywodrs;
  143.         return $this;
  144.     }
  145.     public function getContent(): ?string
  146.     {
  147.         return $this->content;
  148.     }
  149.     public function setContent(string $content): self
  150.     {
  151.         $this->content $content;
  152.         return $this;
  153.     }
  154.     public function getCreatedAt(): ?\DateTimeImmutable
  155.     {
  156.         return $this->created_at;
  157.     }
  158.     public function setCreatedAt(\DateTimeImmutable $created_at): self
  159.     {
  160.         $this->created_at $created_at;
  161.         return $this;
  162.     }
  163.     public function getUpdatedAt(): ?\DateTimeImmutable
  164.     {
  165.         return $this->updated_at;
  166.     }
  167.     public function setUpdatedAt(?\DateTimeImmutable $updated_at): self
  168.     {
  169.         $this->updated_at $updated_at;
  170.         return $this;
  171.     }
  172.     public function getPublicationImage(): ?PublicationImage
  173.     {
  174.         return $this->publicationImage;
  175.     }
  176.     public function setPublicationImage(?PublicationImage $publicationImage): self
  177.     {
  178.         $this->publicationImage $publicationImage;
  179.         return $this;
  180.     }
  181.     public function getBigtitle(): ?string
  182.     {
  183.         return $this->bigtitle;
  184.     }
  185.     public function setBigtitle(?string $bigtitle): self
  186.     {
  187.         $this->bigtitle $bigtitle;
  188.         return $this;
  189.     }
  190.     public function getBreadcrumbs(): ?string
  191.     {
  192.         return $this->breadcrumbs;
  193.     }
  194.     public function setBreadcrumbs(?string $breadcrumbs): self
  195.     {
  196.         $this->breadcrumbs $breadcrumbs;
  197.         return $this;
  198.     }
  199. }