src/Entity/InsuranceCategory.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\Entity(repositoryClass"App\Repository\InsuranceCategoryRepository")]
  9. #[ORM\Table(name"insurance_category")]
  10. class InsuranceCategory
  11. {
  12.     #[ORM\Column(name"id"type"integer")]
  13.     #[ORM\Id]
  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"insuranceCategoryIcon"fileNameProperty"insuranceCategoryIconFileName"size"insuranceCategoryIconFileSize")]
  21.     private File $insuranceCategoryIconFile;
  22.     #[ORM\Column(type"string"length255nullabletrue)]
  23.     private ?string $insuranceCategoryIconFileName;
  24.     #[ORM\Column(type"integer"nullabletrue)]
  25.     private ?int $insuranceCategoryIconFileSize;
  26.     #[ORM\Column(type"datetime"nullabletrue)]
  27.     private ?DateTime $insuranceCategoryIconFileUpdatedAt;
  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 setInsuranceCategoryIconFile(File $image null) {
  41.         $this->insuranceCategoryIconFile $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->insuranceCategoryIconFileUpdatedAt = new \DateTime();
  46.         }
  47.     }
  48.     public function getInsuranceCategoryIconFile() {
  49.         return $this->insuranceCategoryIconFile;
  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 InsuranceCategory
  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 insuranceCategoryIconFileName
  80.      *
  81.      * @param string $insuranceCategoryIconFileName
  82.      *
  83.      * @return InsuranceCategory
  84.      */
  85.     public function setInsuranceCategoryIconFileName($insuranceCategoryIconFileName) {
  86.         $this->insuranceCategoryIconFileName $insuranceCategoryIconFileName;
  87.         return $this;
  88.     }
  89.     /**
  90.      * Get insuranceCategoryIconFileName
  91.      *
  92.      * @return string
  93.      */
  94.     public function getInsuranceCategoryIconFileName() {
  95.         return $this->insuranceCategoryIconFileName;
  96.     }
  97.     /**
  98.      * Set insuranceCategoryIconFileSize
  99.      *
  100.      * @param integer $insuranceCategoryIconFileSize
  101.      *
  102.      * @return InsuranceCategory
  103.      */
  104.     public function setInsuranceCategoryIconFileSize($insuranceCategoryIconFileSize) {
  105.         $this->insuranceCategoryIconFileSize $insuranceCategoryIconFileSize;
  106.         return $this;
  107.     }
  108.     /**
  109.      * Get insuranceCategoryIconFileSize
  110.      *
  111.      * @return integer
  112.      */
  113.     public function getInsuranceCategoryIconFileSize() {
  114.         return $this->insuranceCategoryIconFileSize;
  115.     }
  116.     /**
  117.      * Set insuranceCategoryIconFileUpdatedAt
  118.      *
  119.      * @param DateTime $insuranceCategoryIconFileUpdatedAt
  120.      *
  121.      * @return InsuranceCategory
  122.      */
  123.     public function setInsuranceCategoryIconFileUpdatedAt($insuranceCategoryIconFileUpdatedAt) {
  124.         $this->insuranceCategoryIconFileUpdatedAt $insuranceCategoryIconFileUpdatedAt;
  125.         return $this;
  126.     }
  127.     /**
  128.      * Get insuranceCategoryIconFileUpdatedAt
  129.      *
  130.      * @return DateTime
  131.      */
  132.     public function getInsuranceCategoryIconFileUpdatedAt() {
  133.         return $this->insuranceCategoryIconFileUpdatedAt;
  134.     }
  135.     /**
  136.      * Set isDeleted
  137.      *
  138.      * @param boolean $isDeleted
  139.      *
  140.      * @return InsuranceCategory
  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. }