<?php
namespace App\Entity;
use App\Repository\DocInfoRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Traits\Timestampable;
use JMS\Serializer\Annotation\Groups;
#[ORM\Table(name: "doc_info")]
#[ORM\Index(columns: ["title","content"], name: "doc_info",flags: ['fulltext'])]
#[ORM\HasLifecycleCallbacks]
#[ORM\Entity(repositoryClass: DocInfoRepository::class)]
class DocInfo
{
use Timestampable;
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
#[Groups(['getDoc'])]
private ?int $id = null;
#[ORM\Column(length: 255)]
#[Groups(['getDoc'])]
private ?string $title = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
#[Groups(['getDoc'])]
private ?string $content = null;
#[ORM\Column(length: 255, nullable: true)]
#[Groups(['getDoc'])]
private ?string $FileName = null;
#[ORM\ManyToOne(inversedBy: 'docInfos', cascade: ["persist"])]
private ?SchoolYear $year = null;
#[ORM\ManyToOne(inversedBy: 'docInfos', cascade: ["persist"])]
private ?User $author = null;
#[ORM\ManyToOne(inversedBy: 'docInfoUpdated', cascade: ["persist"])]
private ?User $editor = null;
#[ORM\Column(nullable: true)]
private ?bool $toAll = null;
#[ORM\ManyToOne(inversedBy: 'parentDocInfos', cascade: ["persist"])]
private ?User $parent = null;
#[ORM\ManyToMany(targetEntity: TheClass::class, inversedBy: 'docInfos', cascade: ['persist', 'remove'])]
private Collection $classes;
#[ORM\ManyToOne(inversedBy: 'docInfos', cascade: ["persist"])]
private ?School $school = null;
public function __construct()
{
$this->classes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getTitle(): ?string
{
return $this->title;
}
public function setTitle(string $title): static
{
$this->title = $title;
return $this;
}
public function getContent(): ?string
{
return $this->content;
}
public function setContent(string $content): static
{
$this->content = $content;
return $this;
}
public function getFileName(): ?string
{
return $this->FileName;
}
public function setFileName(?string $FileName): static
{
$this->FileName = $FileName;
return $this;
}
public function getYear(): ?SchoolYear
{
return $this->year;
}
public function setYear(?SchoolYear $year): static
{
$this->year = $year;
return $this;
}
public function getAuthor(): ?User
{
return $this->author;
}
public function setAuthor(?User $author): static
{
$this->author = $author;
return $this;
}
public function getEditor(): ?User
{
return $this->editor;
}
public function setEditor(?User $editor): static
{
$this->editor = $editor;
return $this;
}
public function isToAll(): ?bool
{
return $this->toAll;
}
public function setToAll(?bool $toAll): static
{
$this->toAll = $toAll;
return $this;
}
public function getParent(): ?User
{
return $this->parent;
}
public function setParent(?User $parent): static
{
$this->parent = $parent;
return $this;
}
/**
* @return Collection<int, TheClass>
*/
public function getClasses(): Collection
{
return $this->classes;
}
public function addClass(TheClass $class): static
{
if (!$this->classes->contains($class)) {
$this->classes->add($class);
}
return $this;
}
public function removeClass(TheClass $class): static
{
$this->classes->removeElement($class);
return $this;
}
public function getSchool(): ?School
{
return $this->school;
}
public function setSchool(?School $school): static
{
$this->school = $school;
return $this;
}
}