<?php
namespace App\Entity;
use App\Repository\CrewRepository;
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: CrewRepository::class)]
#[Vich\Uploadable]
class Crew
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\Column(length: 255)]
private ?string $name = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $city = null;
#[ORM\ManyToOne]
private ?Country $country = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $description = null;
#[Vich\UploadableField(mapping: 'crew_backround', fileNameProperty: 'backgroundFileName', size: 'backgroundSize')]
public ?File $backgroundFile = null;
#[ORM\Column(nullable: true)]
private ?string $backgroundFileName = null;
#[ORM\Column(nullable: true)]
private ?int $backgroundSize = null;
#[Vich\UploadableField(mapping: 'crew_image', fileNameProperty: 'imageName', size: 'imageSize')]
public ?File $imageFile = null;
#[ORM\Column(nullable: true)]
private ?string $imageName = null;
#[ORM\Column(nullable: true)]
private ?int $imageSize = null;
#[ORM\Column(nullable: true)]
private ?\DateTime $updatedAt = null;
#[ORM\Column(nullable: true)]
private ?\DateTime $createdAt = null;
#[ORM\OneToMany(mappedBy: 'crew', targetEntity: Rapper::class)]
private Collection $rappers;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tag = null;
#[ORM\OneToOne(inversedBy: 'crew', cascade: ['persist', 'remove'])]
private ?Client $createdBy = null;
#[ORM\Column(nullable: true)]
private ?int $rank = null;
public function __toString()
{
return (string)$this->getName();
}
public function __construct()
{
$this->rappers = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): static
{
$this->name = $name;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(string $city): static
{
$this->city = $city;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): static
{
$this->country = $country;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): static
{
$this->description = $description;
return $this;
}
public function setImageFile(?File $imageFile = null): void
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
// 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->updatedAt = new \DateTime();
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageName(?string $imageName): void
{
$this->imageName = $imageName;
}
public function getImageName(): ?string
{
return $this->imageName;
}
public function setImageSize(?int $imageSize): void
{
$this->imageSize = $imageSize;
}
public function getImageSize(): ?int
{
return $this->imageSize;
}
public function setBackgroundFile(?File $backgroundFile = null): void
{
$this->backgroundFile = $backgroundFile;
if (null !== $backgroundFile) {
// 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->updatedAt = new \DateTime();
}
}
public function getBackgroundFile(): ?File
{
return $this->backgroundFile;
}
public function setBackgroundFileName(?string $backgroundFileName): void
{
$this->backgroundFileName = $backgroundFileName;
}
public function getBackgroundFileName(): ?string
{
return $this->backgroundFileName;
}
public function setBackgroundSize(?int $backgroundSize): void
{
$this->backgroundSize = $backgroundSize;
}
public function getBackgroundSize(): ?int
{
return $this->backgroundSize;
}
public function getUpdatedAt(): ?\DateTime
{
return $this->updatedAt;
}
public function setUpdatedAt(\DateTime $updatedAt): static
{
$this->updatedAt = $updatedAt;
return $this;
}
public function getCreatedAt(): ?\DateTime
{
return $this->createdAt;
}
public function setCreatedAt(\DateTime $createdAt): static
{
$this->createdAt = $createdAt;
return $this;
}
/**
* @return Collection<int, Rapper>
*/
public function getRappers(): Collection
{
return $this->rappers;
}
public function addRapper(Rapper $rapper): static
{
if (!$this->rappers->contains($rapper)) {
$this->rappers->add($rapper);
$rapper->setCrew($this);
}
return $this;
}
public function removeRapper(Rapper $rapper): static
{
if ($this->rappers->removeElement($rapper)) {
// set the owning side to null (unless already changed)
if ($rapper->getCrew() === $this) {
$rapper->setCrew(null);
}
}
return $this;
}
public function getTag(): ?string
{
return $this->tag;
}
public function setTag(?string $tag): static
{
$this->tag = $tag;
return $this;
}
public function getCreatedBy(): ?Client
{
return $this->createdBy;
}
public function setCreatedBy(?Client $createdBy): static
{
$this->createdBy = $createdBy;
return $this;
}
public function getRank(): ?int
{
return $this->rank;
}
public function setRank(int $rank): static
{
$this->rank = $rank;
return $this;
}
}