src/Entity/Actuality.php line 15

  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Repository\ActualityRepository;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use App\Entity\Trait\CreatedAtTrait;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. #[ORM\Entity(repositoryClassActualityRepository::class)]
  9. #[Vich\Uploadable]
  10. class Actuality
  11. {
  12.     use CreatedAtTrait;
  13.     #[ORM\Id]
  14.     #[ORM\GeneratedValue]
  15.     #[ORM\Column]
  16.     private ?int $id null;
  17.     #[Vich\UploadableField(mapping'blog_images'fileNameProperty'imageName')]
  18.     private ?File $imageFile null;
  19.     #[ORM\Column(nullabletrue)]
  20.     private ?string $imageName null;
  21.     #[ORM\Column(length1255)]
  22.     private ?string $title null;
  23.     #[ORM\Column(length1255)]
  24.     private ?string $text null;
  25.     
  26.     #[ORM\ManyToOne(inversedBy'actualities')]
  27.     #[ORM\JoinColumn(nullablefalse)]
  28.     private ?Categories $categories null;
  29.     #[ORM\Column(length1255)]
  30.     private ?string $subtitle null;
  31.     #[ORM\Column(length1255)]
  32.     private ?string $content null;
  33.     #[ORM\Column(length1255)]
  34.     private ?string $intro null;
  35.     public function __construct()
  36.     {
  37.         $this->created_at = new \DateTimeImmutable();
  38.     }
  39.     public function getCreatedAt(): ?\DateTimeInterface
  40.     {
  41.         return $this->created_at;
  42.     }
  43.     public function getId(): ?int
  44.     {
  45.         return $this->id;
  46.     }
  47.     public function getTitle(): ?string
  48.     {
  49.         return $this->title;
  50.     }
  51.     public function setTitle(string $title): self
  52.     {
  53.         $this->title $title;
  54.         return $this;
  55.     }
  56.     public function setImageFile(?File $imageFile null): void
  57.     {
  58.         $this->imageFile $imageFile;
  59.         if (null !== $imageFile) {
  60.             // It is required that at least one field changes if you are using doctrine
  61.             // otherwise the event listeners won't be called and the file is lost
  62.             $this->updatedAt = new \DateTimeImmutable();
  63.         }
  64.     }
  65.     public function getImageFile(): ?File
  66.     {
  67.         return $this->imageFile;
  68.     }
  69.     public function setImageName(?string $imageName): void
  70.     {
  71.         $this->imageName $imageName;
  72.     }
  73.     public function getImageName(): ?string
  74.     {
  75.         return $this->imageName;
  76.     }
  77.     public function getText(): ?string
  78.     {
  79.         return $this->text;
  80.     }
  81.     public function setText(string $text): self
  82.     {
  83.         $this->text $text;
  84.         return $this;
  85.     }
  86.  
  87.     public function getCategories(): ?Categories
  88.     {
  89.         return $this->categories;
  90.     }
  91.     public function setCategories(?Categories $categories): self
  92.     {
  93.         $this->categories $categories;
  94.         return $this;
  95.     }
  96.     public function getSubtitle(): ?string
  97.     {
  98.         return $this->subtitle;
  99.     }
  100.     public function setSubtitle(string $subtitle): static
  101.     {
  102.         $this->subtitle $subtitle;
  103.         return $this;
  104.     }
  105.     public function getContent(): ?string
  106.     {
  107.         return $this->content;
  108.     }
  109.     public function setContent(string $content): static
  110.     {
  111.         $this->content $content;
  112.         return $this;
  113.     }
  114.     public function getIntro(): ?string
  115.     {
  116.         return $this->intro;
  117.     }
  118.     public function setIntro(string $intro): static
  119.     {
  120.         $this->intro $intro;
  121.         return $this;
  122.     }
  123.    
  124.   
  125. }