<?phpnamespace App\Entity;use App\Repository\CompanyRepository;use DateTimeImmutable;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: CompanyRepository::class)]#[Vich\Uploadable]class Company{ #[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 $logo = null; #[Vich\UploadableField(mapping: 'company', fileNameProperty: 'logo')] private ?File $imageFile = null; #[ORM\OneToMany(mappedBy: 'company', targetEntity: Instrument::class, orphanRemoval: true)] private Collection $instruments; #[ORM\Column(nullable: true)] private ?\DateTimeImmutable $updatedAt = null; #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $description = null; #[ORM\Column(length: 255)] private ?string $slug = null; public function __construct() { $this->instruments = 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; } /** * @return File|null */ public function getImageFile(): ?File { return $this->imageFile; } /** * @param File|null $imageFile */ public function setImageFile(?File $imageFile): 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 DateTimeImmutable(); } } public function getLogo(): ?string { return $this->logo; } public function setLogo(?string $logo): self { $this->logo = $logo; return $this; } /** * @return Collection<int, Instrument> */ public function getInstruments(): Collection { return $this->instruments; } public function addInstrument(Instrument $instrument): self { if (!$this->instruments->contains($instrument)) { $this->instruments->add($instrument); $instrument->setCompany($this); } return $this; } public function removeInstrument(Instrument $instrument): self { if ($this->instruments->removeElement($instrument)) { // set the owning side to null (unless already changed) if ($instrument->getCompany() === $this) { $instrument->setCompany(null); } } return $this; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } public function setUpdatedAt(?\DateTimeImmutable $updatedAt): static { $this->updatedAt = $updatedAt; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): static { $this->description = $description; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(string $slug): static { $this->slug = $slug; return $this; }}