<?php
namespace App\Entity;
use App\Repository\TutorialRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: TutorialRepository::class)]
class Tutorial
{
#[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 $description;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $video;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private $photo;
#[ORM\OneToMany(targetEntity: Comment::class, mappedBy: 'tutorial')]
private $comments;
#[ORM\ManyToMany(targetEntity: TutorialCategory::class, mappedBy: 'tutorials')]
private $categories;
#[ORM\Column(type: 'datetime')]
private $createdAt;
#[ORM\Column(type: 'string', length: 255)]
private $slug;
#[ORM\Column(type: 'boolean')]
private $original;
#[ORM\Column(type: 'integer', nullable: true)]
private $unit;
#[ORM\ManyToOne(targetEntity: WebsiteLanguage::class, inversedBy: 'tutorials')]
private $websiteLanguage;
#[ORM\Column(type: 'string', length: 255)]
private $status;
public function __construct()
{
$this->comments = new ArrayCollection();
$this->categories = 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 getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getVideo(): ?string
{
return $this->video;
}
public function setVideo(?string $video): self
{
$this->video = $video;
return $this;
}
public function getPhoto()
{
return $this->photo;
}
public function setPhoto($photo): self
{
$this->photo = $photo;
return $this;
}
/**
* @return Collection|Comment[]
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): self
{
if (!$this->comments->contains($comment)) {
$this->comments[] = $comment;
$comment->setTutorial($this);
}
return $this;
}
public function removeComment(Comment $comment): self
{
if ($this->comments->removeElement($comment)) {
// set the owning side to null (unless already changed)
if ($comment->getTutorial() === $this) {
$comment->setTutorial(null);
}
}
return $this;
}
/**
* @return Collection|TutorialCategory[]
*/
public function getCategories(): Collection
{
return $this->categories;
}
public function addCategory(TutorialCategory $category): self
{
if (!$this->categories->contains($category)) {
$this->categories[] = $category;
$category->addTutorial($this);
}
return $this;
}
public function removeCategory(TutorialCategory $category): self
{
if ($this->categories->removeElement($category)) {
$category->removeTutorial($this);
}
return $this;
}
public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}
public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getOriginal(): ?bool
{
return $this->original;
}
public function setOriginal(bool $original): self
{
$this->original = $original;
return $this;
}
public function getUnit(): ?int
{
return $this->unit;
}
public function setUnit(?int $unit): self
{
$this->unit = $unit;
return $this;
}
public function getWebsiteLanguage(): ?WebsiteLanguage
{
return $this->websiteLanguage;
}
public function setWebsiteLanguage(?WebsiteLanguage $websiteLanguage): self
{
$this->websiteLanguage = $websiteLanguage;
return $this;
}
public function getStatus(): ?string
{
return $this->status;
}
public function setStatus(string $status): self
{
$this->status = $status;
return $this;
}
}