src/Entity/Blog.php line 12

  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\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassBlogRepository::class)]
  9. class Blog
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  16.     private ?\DateTimeInterface $publishDate null;
  17.     #[ORM\Column(length555)]
  18.     private ?string $title null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $listImage null;
  21.     #[ORM\Column(nullabletrue)]
  22.     private ?\DateTimeImmutable $createdAt null;
  23.     #[ORM\ManyToOne(inversedBy'createdBlogs')]
  24.     private ?User $createdBy null;
  25.     #[ORM\Column(nullabletrue)]
  26.     private ?\DateTimeImmutable $modifiedAt null;
  27.     #[ORM\ManyToOne(inversedBy'modifiedBlogs')]
  28.     private ?User $modifiedBy null;
  29.     #[ORM\OneToMany(mappedBy'blog'targetEntityBlogDetails::class, cascade: ['persist''remove''detach'])]
  30.     private Collection $blogDetails;
  31.     #[ORM\Column(length555nullabletrue)]
  32.     private ?string $slug null;
  33.     public function __construct()
  34.     {
  35.         $this->blogDetails = new ArrayCollection();
  36.     }
  37.     public function getId(): ?int
  38.     {
  39.         return $this->id;
  40.     }
  41.     public function getPublishDate(): ?\DateTimeInterface
  42.     {
  43.         return $this->publishDate;
  44.     }
  45.     public function setPublishDate(\DateTimeInterface $publishDate): self
  46.     {
  47.         $this->publishDate $publishDate;
  48.         return $this;
  49.     }
  50.     public function getTitle(): ?string
  51.     {
  52.         return $this->title;
  53.     }
  54.     public function setTitle(string $title): self
  55.     {
  56.         $this->title $title;
  57.         return $this;
  58.     }
  59.     public function getListImage(): ?string
  60.     {
  61.         return $this->listImage;
  62.     }
  63.     public function setListImage(?string $listImage): self
  64.     {
  65.         $this->listImage $listImage;
  66.         return $this;
  67.     }
  68.     public function getCreatedAt(): ?\DateTimeImmutable
  69.     {
  70.         return $this->createdAt;
  71.     }
  72.     public function setCreatedAt(?\DateTimeImmutable $createdAt): self
  73.     {
  74.         $this->createdAt $createdAt;
  75.         return $this;
  76.     }
  77.     public function getCreatedBy(): ?User
  78.     {
  79.         return $this->createdBy;
  80.     }
  81.     public function setCreatedBy(?User $createdBy): self
  82.     {
  83.         $this->createdBy $createdBy;
  84.         return $this;
  85.     }
  86.     public function getModifiedAt(): ?\DateTimeImmutable
  87.     {
  88.         return $this->modifiedAt;
  89.     }
  90.     public function setModifiedAt(?\DateTimeImmutable $modifiedAt): self
  91.     {
  92.         $this->modifiedAt $modifiedAt;
  93.         return $this;
  94.     }
  95.     public function getModifiedBy(): ?User
  96.     {
  97.         return $this->modifiedBy;
  98.     }
  99.     public function setModifiedBy(?User $modifiedBy): self
  100.     {
  101.         $this->modifiedBy $modifiedBy;
  102.         return $this;
  103.     }
  104.     /**
  105.      * @return Collection<int, BlogDetails>
  106.      */
  107.     public function getBlogDetails(): Collection
  108.     {
  109.         return $this->blogDetails;
  110.     }
  111.     public function addBlogDetail(BlogDetails $blogDetail): self
  112.     {
  113.         if (!$this->blogDetails->contains($blogDetail)) {
  114.             $this->blogDetails->add($blogDetail);
  115.             $blogDetail->setBlog($this);
  116.         }
  117.         return $this;
  118.     }
  119.     public function removeBlogDetail(BlogDetails $blogDetail): self
  120.     {
  121.         if ($this->blogDetails->removeElement($blogDetail)) {
  122.             // set the owning side to null (unless already changed)
  123.             if ($blogDetail->getBlog() === $this) {
  124.                 $blogDetail->setBlog(null);
  125.             }
  126.         }
  127.         return $this;
  128.     }
  129.     public function getSlug(): ?string
  130.     {
  131.         return $this->slug;
  132.     }
  133.     public function setSlug(?string $slug): self
  134.     {
  135.         $this->slug $slug;
  136.         return $this;
  137.     }
  138. }