<?phpnamespace App\Entity;use DateTime;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\HttpFoundation\File\File;use Vich\UploaderBundle\Mapping\Annotation as Vich;#[Vich\Uploadable]#[ORM\Table(name: 'item_category')]#[ORM\Entity(repositoryClass: "App\Repository\ItemCategoryRepository")]class ItemCategory{ #[ORM\Id] #[ORM\Column(name: 'id', type: 'integer')] #[ORM\GeneratedValue(strategy: 'AUTO')] private ?int $id; #[ORM\Column(type: 'boolean')] private bool $isDeleted = false; #[ORM\Column(name: 'name', type: 'string', length: 255)] private string $name; #[Vich\UploadableField(mapping: 'itemCategoryIcon', fileNameProperty: 'itemCategoryIconFileName', size: 'itemCategoryIconFileSize')] private File $itemCategoryIconFile; #[ORM\Column(type: 'string', length: 255, nullable: true)] private ?string $itemCategoryIconFileName; #[ORM\Column(type: 'integer', nullable: true)] private ?int $itemCategoryIconFileSize; #[ORM\Column(type: 'datetime', nullable: true)] private ?DateTime $itemCategoryIconFileUpdatedAt; public function __toString() { return "#" . $this->id . " - " . $this->name; } /** * 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 setItemCategoryIconFile(File $image = null) { $this->itemCategoryIconFile = $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->itemCategoryIconFileUpdatedAt = new \DateTime(); } } public function getItemCategoryIconFile() { return $this->itemCategoryIconFile; } /** * Get id * * @return int */ public function getId() { return $this->id; } /** * Set name * * @param string $name * * @return ItemCategory */ public function setName($name) { $this->name = $name; return $this; } /** * Get name * * @return string */ public function getName() { return $this->name; } /** * Set itemCategoryIconFileName * * @param string $itemCategoryIconFileName * * @return ItemCategory */ public function setItemCategoryIconFileName($itemCategoryIconFileName) { $this->itemCategoryIconFileName = $itemCategoryIconFileName; return $this; } /** * Get itemCategoryIconFileName * * @return string */ public function getItemCategoryIconFileName() { return $this->itemCategoryIconFileName; } /** * Set itemCategoryIconFileSize * * @param integer $itemCategoryIconFileSize * * @return ItemCategory */ public function setItemCategoryIconFileSize($itemCategoryIconFileSize) { $this->itemCategoryIconFileSize = $itemCategoryIconFileSize; return $this; } /** * Get itemCategoryIconFileSize * * @return integer */ public function getItemCategoryIconFileSize() { return $this->itemCategoryIconFileSize; } /** * Set itemCategoryIconFileUpdatedAt * * @param DateTime $itemCategoryIconFileUpdatedAt * * @return ItemCategory */ public function setItemCategoryIconFileUpdatedAt($itemCategoryIconFileUpdatedAt) { $this->itemCategoryIconFileUpdatedAt = $itemCategoryIconFileUpdatedAt; return $this; } /** * Get itemCategoryIconFileUpdatedAt * * @return DateTime */ public function getItemCategoryIconFileUpdatedAt() { return $this->itemCategoryIconFileUpdatedAt; } /** * Set isDeleted * * @param boolean $isDeleted * * @return ItemCategory */ public function setIsDeleted($isDeleted) { $this->isDeleted = $isDeleted; return $this; } /** * Get isDeleted * * @return boolean */ public function getIsDeleted() { return $this->isDeleted; }}