<?phpnamespace App\Entity;use App\Repository\ProductRepository;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;use Symfony\Component\Validator\Constraints as Assert;#[ORM\Entity(repositoryClass: ProductRepository::class)]#[Vich\Uploadable]class Product{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\Column(length: 255)] private ?string $sku = null; #[ORM\Column(type: Types::TEXT)] private ?string $description = null; #[ORM\Column(length: 255)] private ?string $shortDescription = null; #[ORM\Column(length: 255)] private ?string $metaTitle = null; #[ORM\Column(length: 255)] private ?string $metaDescription = null; #[ORM\Column] private ?int $category = null; // NOTE: This is not a mapped field of entity metadata, just a simple property. #[Vich\UploadableField(mapping: 'product_image', fileNameProperty: 'image',originalName:'nomInitial')] #[Assert\File( maxSize: '10M', mimeTypes: ['image/jpeg'], mimeTypesMessage: 'Veuillez télécharger une image valide en format JPG (10 Mo maximum)' )] private ?File $imageFile = null; #[ORM\Column(length: 255)] private ?string $image = null; #[ORM\Column(length: 255,nullable: true)] private ?string $nomInitial = null; #[ORM\Column(length: 255)] private ?string $tva = null; #[ORM\Column(length: 255)] private ?string $url = null; #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $notes = null; public function getId(): ?int { return $this->id; } public function setId(): ?string { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(string $name): self { $this->name = $name; return $this; } public function getSku(): ?string { return $this->sku; } public function setSku(string $sku): self { $this->sku = $sku; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } public function getShortDescription(): ?string { return $this->shortDescription; } public function setShortDescription(string $shortDescription): self { $this->shortDescription = $shortDescription; return $this; } public function getMetaTitle(): ?string { return $this->metaTitle; } public function setMetaTitle(string $metaTitle): self { $this->metaTitle = $metaTitle; return $this; } public function getMetaDescription(): ?string { return $this->metaDescription; } public function setMetaDescription(string $metaDescription): self { $this->metaDescription = $metaDescription; return $this; } public function getCategory(): ?int { return $this->category; } public function setCategory(int $category): self { $this->category = $category; return $this; } public function getImage(): ?string { return $this->image; } public function setImage(string $image): self { $this->image = $image; return $this; } public function getTva(): ?string { return $this->tva; } public function setTva(string $tva): self { $this->tva = $tva; return $this; } public function getUrl(): ?string { return $this->url; } public function setUrl(string $url): self { $this->url = $url; return $this; } /** * 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|null $imageFile */ 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 \DateTimeImmutable(); } } public function getImageFile(): ?File { return $this->imageFile; } public function getNomInitial(): ?string { return $this->nomInitial; } public function setNomInitial(string $nomInitial= null): self { $this->nomInitial = $nomInitial; return $this; } public function getNotes(): ?string { return $this->notes; } public function setNotes(?string $notes): self { $this->notes = $notes; return $this; }}