src/Entity/ItemCategory.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Component\HttpFoundation\File\File;
  6. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  7. #[Vich\Uploadable]
  8. #[ORM\Table(name'item_category')]
  9. #[ORM\Entity(repositoryClass"App\Repository\ItemCategoryRepository")]
  10. class ItemCategory
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\Column(name'id'type'integer')]
  14.     #[ORM\GeneratedValue(strategy'AUTO')]
  15.     private ?int $id;
  16.     #[ORM\Column(type'boolean')]
  17.     private bool $isDeleted false;
  18.     #[ORM\Column(name'name'type'string'length255)]
  19.     private string $name;
  20.     #[Vich\UploadableField(mapping'itemCategoryIcon'fileNameProperty'itemCategoryIconFileName'size'itemCategoryIconFileSize')]
  21.     private File $itemCategoryIconFile;
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private ?string $itemCategoryIconFileName;
  24.     #[ORM\Column(type'integer'nullabletrue)]
  25.     private ?int $itemCategoryIconFileSize;
  26.     #[ORM\Column(type'datetime'nullabletrue)]
  27.     private ?DateTime $itemCategoryIconFileUpdatedAt;
  28.     public function __toString() {
  29.         return "#" $this->id " - " $this->name;
  30.     }
  31.     /**
  32.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  33.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  34.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  35.      * must be able to accept an instance of 'File' as the bundle will inject one here
  36.      * during Doctrine hydration.
  37.      *
  38.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
  39.      */
  40.     public function setItemCategoryIconFile(File $image null) {
  41.         $this->itemCategoryIconFile $image;
  42.         if (null !== $image) {
  43. // It is required that at least one field changes if you are using doctrine
  44. // otherwise the event listeners won't be called and the file is lost
  45.             $this->itemCategoryIconFileUpdatedAt = new \DateTime();
  46.         }
  47.     }
  48.     public function getItemCategoryIconFile() {
  49.         return $this->itemCategoryIconFile;
  50.     }
  51.     /**
  52.      * Get id
  53.      *
  54.      * @return int
  55.      */
  56.     public function getId() {
  57.         return $this->id;
  58.     }
  59.     /**
  60.      * Set name
  61.      *
  62.      * @param string $name
  63.      *
  64.      * @return ItemCategory
  65.      */
  66.     public function setName($name) {
  67.         $this->name $name;
  68.         return $this;
  69.     }
  70.     /**
  71.      * Get name
  72.      *
  73.      * @return string
  74.      */
  75.     public function getName() {
  76.         return $this->name;
  77.     }
  78.     /**
  79.      * Set itemCategoryIconFileName
  80.      *
  81.      * @param string $itemCategoryIconFileName
  82.      *
  83.      * @return ItemCategory
  84.      */
  85.     public function setItemCategoryIconFileName($itemCategoryIconFileName) {
  86.         $this->itemCategoryIconFileName $itemCategoryIconFileName;
  87.         return $this;
  88.     }
  89.     /**
  90.      * Get itemCategoryIconFileName
  91.      *
  92.      * @return string
  93.      */
  94.     public function getItemCategoryIconFileName() {
  95.         return $this->itemCategoryIconFileName;
  96.     }
  97.     /**
  98.      * Set itemCategoryIconFileSize
  99.      *
  100.      * @param integer $itemCategoryIconFileSize
  101.      *
  102.      * @return ItemCategory
  103.      */
  104.     public function setItemCategoryIconFileSize($itemCategoryIconFileSize) {
  105.         $this->itemCategoryIconFileSize $itemCategoryIconFileSize;
  106.         return $this;
  107.     }
  108.     /**
  109.      * Get itemCategoryIconFileSize
  110.      *
  111.      * @return integer
  112.      */
  113.     public function getItemCategoryIconFileSize() {
  114.         return $this->itemCategoryIconFileSize;
  115.     }
  116.     /**
  117.      * Set itemCategoryIconFileUpdatedAt
  118.      *
  119.      * @param DateTime $itemCategoryIconFileUpdatedAt
  120.      *
  121.      * @return ItemCategory
  122.      */
  123.     public function setItemCategoryIconFileUpdatedAt($itemCategoryIconFileUpdatedAt) {
  124.         $this->itemCategoryIconFileUpdatedAt $itemCategoryIconFileUpdatedAt;
  125.         return $this;
  126.     }
  127.     /**
  128.      * Get itemCategoryIconFileUpdatedAt
  129.      *
  130.      * @return DateTime
  131.      */
  132.     public function getItemCategoryIconFileUpdatedAt() {
  133.         return $this->itemCategoryIconFileUpdatedAt;
  134.     }
  135.     /**
  136.      * Set isDeleted
  137.      *
  138.      * @param boolean $isDeleted
  139.      *
  140.      * @return ItemCategory
  141.      */
  142.     public function setIsDeleted($isDeleted)
  143.     {
  144.         $this->isDeleted $isDeleted;
  145.         return $this;
  146.     }
  147.     /**
  148.      * Get isDeleted
  149.      *
  150.      * @return boolean
  151.      */
  152.     public function getIsDeleted()
  153.     {
  154.         return $this->isDeleted;
  155.     }
  156. }