<?php
namespace App\Entity;
use App\Repository\BlogRepository;
use DateTime;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=BlogRepository::class)
*/
class Blog
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @Gedmo\Slug(fields={"name"})
* @ORM\Column(type="string", length=128, unique=true)
*/
private $slug;
/**
* @ORM\OneToOne(targetEntity=Templates::class, cascade={"persist", "remove"})
* @ORM\JoinColumn(nullable=false)
*/
private $template;
/**
* @ORM\Column(type="boolean")
*/
private $published;
/**
* @ORM\Column(type="json")
*/
private $setting = [];
/**
* @ORM\ManyToOne(targetEntity=User::class, inversedBy="blogs")
*/
private $created_by;
/**
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
private $created_at;
/**
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime")
*/
private $updated_at;
public function __construct()
{
$this->created_by = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSlug()
{
return $this->slug;
}
public function getPublished(): ?bool
{
return $this->published;
}
public function setPublished(bool $published): self
{
$this->published = $published;
return $this;
}
public function getSetting(): ?array
{
return $this->setting;
}
public function setSetting(array $setting): self
{
$this->setting = [];
return $this;
}
public function getCreatedAt(): ?DateTime
{
return $this->created_at;
}
public function getUpdatedAt(): ?DateTime
{
return $this->updated_at;
}
public function getCreatedBy(): ?User
{
return $this->created_by;
}
public function setCreatedBy(?User $created_by): self
{
$this->created_by = $created_by;
return $this;
}
public function getTemplate(): ?Templates
{
return $this->template;
}
public function setTemplate(Templates $template): self
{
$this->template = $template;
return $this;
}
}