<?phpnamespace App\Entity;use App\Repository\WeatherRepository;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;use Gedmo\Timestampable\Traits\TimestampableEntity;use Symfony\Component\HttpFoundation\File\File;use Symfony\Component\HttpFoundation\File\UploadedFile;use Symfony\Component\Serializer\Annotation\Ignore;use Vich\UploaderBundle\Mapping\Annotation as Vich;use Symfony\Component\Validator\Constraints as Assert;use Symfony\Component\Serializer\Annotation\Groups;/** * @ORM\Entity(repositoryClass=WeatherRepository::class) * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true) * @Vich\Uploadable */class Weather{ use TimestampableEntity; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") * @Groups("weather:list", "weather:item") */ private $id; public function getId(): ?int { return $this->id; } /** * @Assert\File( * mimeTypes = {"application/pdf", "application/x-pdf"}, * mimeTypesMessage = "Please upload a valid PDF" * ) * @Vich\UploadableField(mapping="weather", fileNameProperty="pdfName", size="pdfSize") * @var File|null * @Ignore() */ private $pdfFile; /** * @param File|UploadedFile|null $pdfFile */ public function setPdfFile(?File $pdfFile = null): void { $this->pdfFile = $pdfFile; if (null !== $pdfFile) { $this->updatedAt = new \DateTimeImmutable(); } } public function getPdfFile(): ?File { return $this->pdfFile; } /** * @ORM\Column(type="string") * * @var string|null * @Groups("weather:list", "weather:item") */ private $pdfName; /** * @ORM\Column(type="integer") * * @var int|null */ private $pdfSize; /** * @ORM\Column(type="datetime", nullable=true) * @var \DateTime|null */ protected $deletedAt; /** * Set or clear the deleted at timestamp. * * @return self */ public function setDeletedAt(\DateTime $deletedAt = null) { $this->deletedAt = $deletedAt; return $this; } /** * Get the deleted at timestamp value. Will return null if * the entity has not been soft deleted. * * @return \DateTime|null */ public function getDeletedAt() { return $this->deletedAt; } public function setPdfName(?string $pdfName): void { $this->pdfName = $pdfName; } public function getPdfName(): ?string { return $this->pdfName; } public function setPdfSize(?int $pdfSize): void { $this->pdfSize = $pdfSize; } public function getPdfSize(): ?int { return $this->pdfSize; }}