src/Entity/Blog.php line 12
<?php
namespace App\Entity;
use App\Repository\BlogRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: BlogRepository::class)]
class Blog
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::DATE_MUTABLE)]
private ?\DateTimeInterface $publishDate = null;
#[ORM\Column(length: 555)]
private ?string $title = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $listImage = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $createdAt = null;
#[ORM\ManyToOne(inversedBy: 'createdBlogs')]
private ?User $createdBy = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $modifiedAt = null;
#[ORM\ManyToOne(inversedBy: 'modifiedBlogs')]
private ?User $modifiedBy = null;
#[ORM\OneToMany(mappedBy: 'blog', targetEntity: BlogDetails::class, cascade: ['persist', 'remove', 'detach'])]
private Collection $blogDetails;
#[ORM\Column(length: 555, nullable: true)]
private ?string $slug = null;
public function __construct()
{
$this->blogDetails = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getPublishDate(): ?\DateTimeInterface
{
return $this->publishDate;
}
public function setPublishDate(\DateTimeInterface $publishDate): self
{
$this->publishDate = $publishDate;
return $this;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
public function getListImage(): ?string
{
return $this->listImage;
}
public function setListImage(?string $listImage): self
{
$this->listImage = $listImage;
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->createdAt;
}
public function setCreatedAt(?\DateTimeImmutable $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getCreatedBy(): ?User
{
return $this->createdBy;
}
public function setCreatedBy(?User $createdBy): self
{
$this->createdBy = $createdBy;
return $this;
}
public function getModifiedAt(): ?\DateTimeImmutable
{
return $this->modifiedAt;
}
public function setModifiedAt(?\DateTimeImmutable $modifiedAt): self
{
$this->modifiedAt = $modifiedAt;
return $this;
}
public function getModifiedBy(): ?User
{
return $this->modifiedBy;
}
public function setModifiedBy(?User $modifiedBy): self
{
$this->modifiedBy = $modifiedBy;
return $this;
}
/**
* @return Collection<int, BlogDetails>
*/
public function getBlogDetails(): Collection
{
return $this->blogDetails;
}
public function addBlogDetail(BlogDetails $blogDetail): self
{
if (!$this->blogDetails->contains($blogDetail)) {
$this->blogDetails->add($blogDetail);
$blogDetail->setBlog($this);
}
return $this;
}
public function removeBlogDetail(BlogDetails $blogDetail): self
{
if ($this->blogDetails->removeElement($blogDetail)) {
// set the owning side to null (unless already changed)
if ($blogDetail->getBlog() === $this) {
$blogDetail->setBlog(null);
}
}
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
}