<?phpnamespace App\Entity;use Vich\UploaderBundle\Mapping\Annotation as Vich;use Symfony\Component\HttpFoundation\File\File;use Doctrine\ORM\Mapping as ORM;#[ORM\Table(name: 'photos')]#[ORM\Entity]#[Vich\Uploadable]class Photo{ #[ORM\Column(name: 'id', type: 'integer', nullable: false)] #[ORM\Id] #[ORM\GeneratedValue(strategy: 'IDENTITY')] private $id; #[Vich\UploadableField(mapping: 'photos', fileNameProperty: 'image')] private $imageFile; #[ORM\Column(type: 'string', length: 250, nullable: true)] private $image; #[ORM\Column(name: 'created', type: 'datetime', nullable: true)] private $created; #[ORM\ManyToOne(targetEntity: Projects::class, inversedBy: 'photos')] private $project; #[ORM\ManyToOne(targetEntity: User::class)] private $user; public function getId(): ?int { return $this->id; } public function getCreated(): ?\DateTimeInterface { return $this->created; } public function setCreated(\DateTimeInterface $created): self { $this->created = $created; return $this; } /** * @return mixed */ public function getImageFile() { return $this->imageFile; } /** * @param mixed $imageFile */ public function setImageFile(File $imageFile) { $this->imageFile = $imageFile; return $this; } public function getPreview(): ?string { return $this->getProject()->getCustomer()->getId()."/".$this->image; } public function getImage(): ?string { return $this->image; } public function setImage(?string $image): self { $this->image = $image; return $this; } public function __toString() { return (string)$this->image; } public function getProject(): ?Projects { return $this->project; } public function setProject(?Projects $project): self { $this->project = $project; return $this; } public function getUser(): ?User { return $this->user; } public function setUser(?User $user): self { $this->user = $user; return $this; }}