<?php
namespace App\Entity;
use App\Repository\BlogRepository;
use App\Traits\CommonTrt;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=BlogRepository::class)
*/
class Blog
{
use CommonTrt;
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $content;
/**
* @ORM\Column(type="datetime_immutable", nullable=true)
*/
private $publishedAt;
/**
* @ORM\Column(type="string", length=255)
*/
private $slug;
/**
* @ORM\ManyToOne(targetEntity=Lang::class, inversedBy="blogs")
*/
private $langue;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $author;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $illustration;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $bannerImg;
/**
* @ORM\Column(type="boolean")
*/
private $isActive;
/**
* @ORM\Column(type="boolean")
*/
private $isForHome;
/**
* @ORM\ManyToOne(targetEntity=BlogCategory::class, inversedBy="blog")
*/
private $category;
/**
* @ORM\Column(type="boolean")
*/
private $isPopular;
// /**
// * @ORM\ManyToMany(targetEntity=BlogCategory::class, inversedBy="blogs")
// */
// private $category;
public function __construct()
{
$this->category = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): self
{
$this->title = $title;
return $this;
}
// public function getSummary(): ?string
// {
// return $this->summary;
// }
//
// public function setSummary(?string $summary): self
// {
// $this->summary = $summary;
//
// return $this;
// }
public function getContent(): ?string
{
return $this->content;
}
public function setContent(?string $content): self
{
$this->content = $content;
return $this;
}
public function getPublishedAt(): ?\DateTimeImmutable
{
return $this->publishedAt;
}
public function setPublishedAt(?\DateTimeImmutable $publishedAt): self
{
$this->publishedAt = $publishedAt;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getLangue(): ?Lang
{
return $this->langue;
}
public function setLangue(?Lang $langue): self
{
$this->langue = $langue;
return $this;
}
public function getAuthor(): ?string
{
return $this->author;
}
public function setAuthor(?string $author): self
{
$this->author = $author;
return $this;
}
public function getIllustration(): ?string
{
return $this->illustration;
}
public function setIllustration(?string $illustration): self
{
$this->illustration = $illustration;
return $this;
}
public function getBannerImg(): ?string
{
return $this->bannerImg;
}
public function setBannerImg(?string $bannerImg): self
{
$this->bannerImg = $bannerImg;
return $this;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function isIsForHome(): ?bool
{
return $this->isForHome;
}
public function setIsForHome(bool $isForHome): self
{
$this->isForHome = $isForHome;
return $this;
}
// /**
// * @return Collection<int, BlogCategory>
// */
// public function getCategory(): Collection
// {
// return $this->category;
// }
//
// public function addCategory(BlogCategory $category): self
// {
// if (!$this->category->contains($category)) {
// $this->category[] = $category;
// }
//
// return $this;
// }
//
// public function removeCategory(BlogCategory $category): self
// {
// $this->category->removeElement($category);
//
// return $this;
// }
public function getCategory(): ?BlogCategory
{
return $this->category;
}
public function setCategory(?BlogCategory $category): self
{
$this->category = $category;
return $this;
}
public function isIsPopular(): ?bool
{
return $this->isPopular;
}
public function setIsPopular(bool $isPopular): self
{
$this->isPopular = $isPopular;
return $this;
}
}