src/Entity/News.php line 28

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Interfaces\DefaultLinkedEntity;
  4. use App\Entity\Traits\ActiveTrait;
  5. use App\Entity\Traits\DeleteTrait;
  6. use App\Entity\Traits\ImageUploadTrait;
  7. use App\Entity\Traits\LinkTrait;
  8. use App\Entity\Traits\MetaTrait;
  9. use App\Entity\Traits\SubTitleTrait;
  10. use App\Entity\Traits\TitleAndContentTrait;
  11. use App\Entity\Traits\TranslateTrait;
  12. use App\Repository\NewsRepository;
  13. use Doctrine\ORM\Mapping as ORM;
  14. use Gedmo\Mapping\Annotation as Gedmo;
  15. use Gedmo\Timestampable\Traits\TimestampableEntity;
  16. /**
  17.  * News.
  18.  *
  19.  * @Gedmo\Loggable
  20.  *
  21.  * @Gedmo\TranslationEntity(class="App\Entity\NewsTranslations")
  22.  */
  23. #[ORM\Entity(repositoryClassNewsRepository::class)]
  24. #[ORM\Table(name'news')]
  25. class News implements DefaultLinkedEntity
  26. {
  27.     use TitleAndContentTrait;
  28.     use SubTitleTrait;
  29.     use LinkTrait;
  30.     use MetaTrait;
  31.     use ActiveTrait;
  32.     use DeleteTrait;
  33.     use ImageUploadTrait;
  34.     use TimestampableEntity;
  35.     use TranslateTrait;
  36.     public $imageUpload;
  37.     #[ORM\Column(name'id'type'integer')]
  38.     #[ORM\Id]
  39.     #[ORM\GeneratedValue(strategy'AUTO')]
  40.     private int $id;
  41.     /**
  42.      * @Gedmo\Versioned
  43.      *
  44.      * @Gedmo\Translatable
  45.      */
  46.     #[ORM\Column(name'excerpt'type'text'nullabletrue)]
  47.     private ?string $excerpt null;
  48.     /**
  49.      * @Gedmo\Versioned
  50.      */
  51.     #[ORM\Column(name'publish_date'type'datetime')]
  52.     private ?\DateTimeInterface $publishDate null;
  53.     /**
  54.      * @Gedmo\Versioned
  55.      */
  56.     #[ORM\Column(name'thumbnail'type'string'length255nullabletrue)]
  57.     private ?string $thumbnail null;
  58.     #[ORM\ManyToOne(targetEntityUser::class, inversedBy'news')]
  59.     #[ORM\JoinColumn(nullablefalse)]
  60.     private ?\App\Entity\User $updatedBy null;
  61.     /**
  62.      * Get id.
  63.      *
  64.      * @return int
  65.      */
  66.     public function getId()
  67.     {
  68.         return $this->id;
  69.     }
  70.     /**
  71.      * Set excerpt.
  72.      *
  73.      * @param string $excerpt
  74.      *
  75.      * @return News
  76.      */
  77.     public function setExcerpt($excerpt)
  78.     {
  79.         $this->excerpt $excerpt;
  80.         return $this;
  81.     }
  82.     /**
  83.      * Get excerpt.
  84.      *
  85.      * @return string
  86.      */
  87.     public function getExcerpt()
  88.     {
  89.         return $this->excerpt;
  90.     }
  91.     /**
  92.      * Set publishDate.
  93.      *
  94.      * @param \DateTime|\DateTimeImmutable $publishDate
  95.      *
  96.      * @return News
  97.      */
  98.     public function setPublishDate(\DateTimeInterface $publishDate)
  99.     {
  100.         $this->publishDate $publishDate;
  101.         return $this;
  102.     }
  103.     /**
  104.      * Get publishDate.
  105.      *
  106.      * @return \DateTime
  107.      */
  108.     public function getPublishDate()
  109.     {
  110.         return $this->publishDate;
  111.     }
  112.     /**
  113.      * Set thumbnail.
  114.      *
  115.      * @param string $thumbnail
  116.      *
  117.      * @return News
  118.      */
  119.     public function setThumbnail($thumbnail)
  120.     {
  121.         $this->thumbnail $thumbnail;
  122.         return $this;
  123.     }
  124.     /**
  125.      * Get thumbnail.
  126.      *
  127.      * @return string
  128.      */
  129.     public function getThumbnail()
  130.     {
  131.         return $this->thumbnail;
  132.     }
  133.     // REQUIRED BY THE META LINKS TRAIT
  134.     public function getLinkedPageId(): int
  135.     {
  136.         return 3;
  137.     }
  138.     public function getUpdatedBy(): ?User
  139.     {
  140.         return $this->updatedBy;
  141.     }
  142.     public function setUpdatedBy(?User $updatedBy): self
  143.     {
  144.         $this->updatedBy $updatedBy;
  145.         return $this;
  146.     }
  147. }