<?php
namespace App\Entity;
use App\Repository\TeamRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\HttpFoundation\File\File;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
#[ORM\Entity(repositoryClass: TeamRepository::class)]
#[Vich\Uploadable]
class Team
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(type: Types::TEXT)]
private ?string $internal_description = null;
#[ORM\ManyToMany(targetEntity: Jury::class, mappedBy: 'team')]
private Collection $juries;
#[ORM\Column]
private ?bool $enabled = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 255)]
private ?string $name_en = null;
#[ORM\OneToMany(mappedBy: 'team', targetEntity: Result::class, orphanRemoval: true)]
private Collection $results;
#[ORM\OneToMany(mappedBy: 'team', targetEntity: Comment::class, orphanRemoval: true)]
private Collection $comments;
#[ORM\Column]
private ?float $file_rating = null;
#[ORM\Column(length: 255)]
private ?string $pizza_name = '';
private ?bool $isCompletelyRated = null;
#[Vich\UploadableField(mapping: 'candidates', fileNameProperty: 'docName', size: 'docSize')]
private ?File $document = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $docName = null;
#[ORM\Column(nullable: true)]
private ?int $docSize = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $docUpdatedAt = null;
#[Vich\UploadableField(mapping: 'candidates', fileNameProperty: 'docNameEn', size: 'docSizeEn')]
private ?File $documentEn = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $docNameEn = null;
#[ORM\Column(nullable: true)]
private ?int $docSizeEn = null;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $docUpdatedAtEn = null;
public function getFileRating(): ?float
{
return $this->file_rating;
}
public function setFileRating(float $file_rating): self
{
$this->file_rating = $file_rating;
return $this;
}
public function __construct()
{
$this->juries = new ArrayCollection();
$this->results = new ArrayCollection();
$this->comments = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getInternalDescription(): ?string
{
return $this->internal_description;
}
public function setInternalDescription(string $internal_description): self
{
$this->internal_description = $internal_description;
return $this;
}
/**
* @return Collection<int, Jury>
*/
public function getJuries(): Collection
{
return $this->juries;
}
public function addJury(Jury $jury): self
{
if (!$this->juries->contains($jury)) {
$this->juries->add($jury);
$jury->addTeam($this);
}
return $this;
}
public function removeJury(Jury $jury): self
{
if ($this->juries->removeElement($jury)) {
$jury->removeTeam($this);
}
return $this;
}
public function isEnabled(): ?bool
{
return $this->enabled;
}
public function setEnabled(bool $enabled): self
{
$this->enabled = $enabled;
return $this;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getNameEn(): ?string
{
return $this->name_en;
}
public function setNameEn(string $name_en): self
{
$this->name_en = $name_en;
return $this;
}
/**
* @return Collection<int, Result>
*/
public function getResults(): Collection
{
return $this->results;
}
public function addResult(Result $result): self
{
if (!$this->results->contains($result)) {
$this->results->add($result);
$result->setTeam($this);
}
return $this;
}
public function removeResult(Result $result): self
{
if ($this->results->removeElement($result)) {
// set the owning side to null (unless already changed)
if ($result->getTeam() === $this) {
$result->setTeam(null);
}
}
return $this;
}
/**
* @return Collection<int, Comment>
*/
public function getComments(): Collection
{
return $this->comments;
}
public function addComment(Comment $comment): self
{
if (!$this->comments->contains($comment)) {
$this->comments->add($comment);
$comment->setTeam($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->getTeam() === $this) {
$comment->setTeam(null);
}
}
return $this;
}
public function isCompletelyRated(): ?bool
{
return $this->isCompletelyRated;
}
public function setCompletelyRated(bool $isCompletelyRated): self
{
$this->isCompletelyRated = $isCompletelyRated;
return $this;
}
public function getPizzaName(): ?string
{
return $this->pizza_name;
}
public function setPizzaName(string $pizza_name): self
{
$this->pizza_name = $pizza_name;
return $this;
}
public function setDocument(?File $document = null): void
{
$this->document = $document;
if (null !== $document) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->docUpdatedAt = new \DateTimeImmutable();
}
}
public function getDocument(): ?File
{
return $this->document;
}
public function getDocName(): ?string
{
return $this->docName;
}
public function setDocName(?string $docName): static
{
$this->docName = $docName;
return $this;
}
public function getDocSize(): ?int
{
return $this->docSize;
}
public function setDocSize(?int $docSize): static
{
$this->docSize = $docSize;
return $this;
}
public function getDocUpdatedAt(): ?\DateTimeImmutable
{
return $this->docUpdatedAt;
}
public function setDocUpdatedAt(?\DateTimeImmutable $docUpdatedAt): static
{
$this->docUpdatedAt = $docUpdatedAt;
return $this;
}
public function setDocumentEn(?File $documentEn = null): void
{
$this->documentEn = $documentEn;
if (null !== $documentEn) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->docUpdatedAtEn = new \DateTimeImmutable();
}
}
public function getDocumentEn(): ?File
{
return $this->documentEn;
}
public function getDocNameEn(): ?string
{
return $this->docNameEn;
}
public function setDocNameEn(?string $docNameEn): static
{
$this->docNameEn = $docNameEn;
return $this;
}
public function getDocSizeEn(): ?int
{
return $this->docSizeEn;
}
public function setDocSizeEn(?int $docSizeEn): static
{
$this->docSizeEn = $docSizeEn;
return $this;
}
public function getDocUpdatedAtEn(): ?\DateTimeImmutable
{
return $this->docUpdatedAtEn;
}
public function setDocUpdatedAtEn(?\DateTimeImmutable $docUpdatedAtEn): static
{
$this->docUpdatedAtEn = $docUpdatedAtEn;
return $this;
}
}