src/Entity/Product.php line 14
<?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 Gedmo\Mapping\Annotation as Gedmo;#[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 $quality = null;#[ORM\Column]private ?int $code = null;#[ORM\Column]private ?float $price = null;#[ORM\Column(length: 10)]private ?string $currency = null;#[ORM\Column]private ?int $min = null;#[ORM\Column(nullable: true)]private ?bool $actif = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;// NOTE: This is not a mapped field of entity metadata, just a simple property.#[Vich\UploadableField(mapping: 'product_image', fileNameProperty: 'image',originalName:'nomInitial')]private ?File $imageFile = null;#[ORM\Column(length: 255, nullable: true)]private ?string $image = null;#[ORM\Column(nullable: true)]private ?int $discount = null;#[ORM\ManyToOne(inversedBy: 'products')]private ?Category $category = null;#[ORM\Column(length: 255,nullable: true)]private ?string $nomInitial = null;#[Gedmo\Slug(fields: ['quality'])]#[ORM\Column(length: 255,unique: true)]private ?string $slug = null;#[ORM\Column(length: 255, nullable: true)]private ?string $description_url = null;public function __construct(){$this->createdAt = new \DateTimeImmutable('now');}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;}public function getQuality(): ?string{return $this->quality;}public function setQuality(string $quality): self{$this->quality = $quality;return $this;}public function getCode(): ?int{return $this->code;}public function setCode(int $code): self{$this->code = $code;return $this;}public function getPrice(): ?float{return $this->price;}public function setPrice(float $price): self{$this->price = $price;return $this;}public function getCurrency(): ?string{return $this->currency;}public function setCurrency(string $currency): self{$this->currency = $currency;return $this;}public function getMin(): ?int{return $this->min;}public function setMin(int $min): self{$this->min = $min;return $this;}public function isActif(): ?bool{return $this->actif;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): self{$this->description = $description;return $this;}public function getImage(): ?string{return $this->image;}public function setImage(?string $image): self{$this->image = $image;return $this;}public function getDiscount(): ?int{return $this->discount;}public function setDiscount(?int $discount): self{$this->discount = $discount;return $this;}public function getCategory(): ?Category{return $this->category;}public function setCategory(?Category $category): self{$this->category = $category;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 getSlug(): ?string{return $this->slug;}public function getDescriptionUrl(): ?string{return $this->description_url;}public function setDescriptionUrl(?string $description_url): self{$this->description_url = $description_url;return $this;}}