<?phpnamespace App\Entity;use App\Repository\VehiclePhotoRepository;use DateTime;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;#[ORM\Entity(repositoryClass: VehiclePhotoRepository::class)]#[ORM\Table(name: 'vehicle_photo')]/** * @Vich\Uploadable */class VehiclePhoto{ #[ORM\Column(type: "boolean")] private bool $isDeleted = false; #[ORM\Column(name: "id", type: "integer")] #[ORM\Id] #[ORM\GeneratedValue(strategy: "AUTO")] private ?int $id; #[ORM\ManyToOne(targetEntity: "App\Entity\Vehicle", inversedBy: "vehiclePhotos", cascade: ["persist"])] #[ORM\JoinColumn(nullable: false)] private Vehicle $vehicle; /** * @Vich\UploadableField(mapping="vehiclePhoto", fileNameProperty="vehiclePhotoFileName", size="vehiclePhotoFileSize") */ private File $vehiclePhotoFile; #[ORM\Column(type: "string", length: 255, nullable: true)] private ?string $vehiclePhotoFileName = null; #[ORM\Column(type: "integer", nullable: true)] private ?int $vehiclePhotoFileSize = null; #[ORM\Column(type: "datetime", nullable: true)] private ?DateTime $vehiclePhotoFileUpdatedAt = null; public function __toString() { return "#" . $this->id . " - " . $this->vehiclePhotoFileName; } public function getVehiclePhotoFile() { return $this->vehiclePhotoFile; } /** * If manually uploading a file (i.e. not using Symfony Form) ensure an instance * of 'UploadedFile' is injected into this setter to trigger the update. If this * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter * must be able to accept an instance of 'File' as the bundle will inject one here * during Doctrine hydration. * * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image */ public function setVehiclePhotoFile(File $image = null) { $this->vehiclePhotoFile = $image; if (null !== $image) {// 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->vehiclePhotoFileUpdatedAt = new \DateTime(); } } /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Get vehiclePhotoFileName * * @return string */ public function getVehiclePhotoFileName() { return $this->vehiclePhotoFileName; } /** * Set vehiclePhotoFileName * * @param string $vehiclePhotoFileName * * @return VehiclePhoto */ public function setVehiclePhotoFileName($vehiclePhotoFileName) { $this->vehiclePhotoFileName = $vehiclePhotoFileName; return $this; } /** * Get vehiclePhotoFileSize * * @return integer */ public function getVehiclePhotoFileSize() { return $this->vehiclePhotoFileSize; } /** * Set vehiclePhotoFileSize * * @param integer $vehiclePhotoFileSize * * @return VehiclePhoto */ public function setVehiclePhotoFileSize($vehiclePhotoFileSize) { $this->vehiclePhotoFileSize = $vehiclePhotoFileSize; return $this; } /** * Get vehiclePhotoFileUpdatedAt * * @return \DateTime */ public function getVehiclePhotoFileUpdatedAt() { return $this->vehiclePhotoFileUpdatedAt; } /** * Set vehiclePhotoFileUpdatedAt * * @param \DateTime $vehiclePhotoFileUpdatedAt * * @return VehiclePhoto */ public function setVehiclePhotoFileUpdatedAt($vehiclePhotoFileUpdatedAt) { $this->vehiclePhotoFileUpdatedAt = $vehiclePhotoFileUpdatedAt; return $this; } /** * Get vehicle * * @return \App\Entity\Vehicle */ public function getVehicle() { return $this->vehicle; } /** * Set vehicle * * @param \App\Entity\Vehicle $vehicle * * @return VehiclePhoto */ public function setVehicle(\App\Entity\Vehicle $vehicle) { $this->vehicle = $vehicle; return $this; } /** * Get isDeleted * * @return boolean */ public function getIsDeleted() { return $this->isDeleted; } /** * Set isDeleted * * @param boolean $isDeleted * * @return VehiclePhoto */ public function setIsDeleted($isDeleted) { $this->isDeleted = $isDeleted; return $this; }}