src/Entity/ComplaintXPhoto.php line 15

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. /**
  8.  * @Vich\Uploadable
  9.  */
  10. #[ORM\Entity(repositoryClass"App\Repository\ComplaintXPhotoRepository")]
  11. #[ORM\Table(name"complaint_x_photo")]
  12. class ComplaintXPhoto
  13. {
  14.     #[ORM\Column(type"boolean")]
  15.     private bool $isDeleted false;
  16.     #[ORM\Column(type"datetime")]
  17.     private DateTime $createdAt;
  18.     #[ORM\Column(type"integer")]
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue(strategy"AUTO")]
  21.     private ?int $id;
  22.     #[ORM\ManyToOne(targetEntityComplaintX::class, inversedBy"complaintXPhotos")]
  23.     #[ORM\JoinColumn(nullablefalse)]
  24.     private ComplaintX $complaintX;
  25.     /**
  26.      * @Vich\UploadableField(mapping="complaintXPhoto", fileNameProperty="complaintXPhotoFileName", size="complaintXPhotoFileSize")
  27.      */
  28.     private File $complaintXPhotoFile;
  29.     #[ORM\Column(type"string"length255nullabletrue)]
  30.     private ?string $complaintXPhotoFileName;
  31.     #[ORM\Column(type"integer"nullabletrue)]
  32.     private ?int $complaintXPhotoFileSize;
  33.     #[ORM\Column(type"datetime"nullabletrue)]
  34.     private DateTime $complaintXPhotoFileUpdatedAt;
  35.     public function __construct()
  36.     {
  37.         $this->createdAt = new DateTime();
  38.     }
  39.     public function __toString()
  40.     {
  41.         return "#" $this->id " - " $this->complaintXPhotoFileName;
  42.     }
  43.     /**
  44.      * If manually uploading a file (i.e. not using Symfony Form) ensure an instance
  45.      * of 'UploadedFile' is injected into this setter to trigger the  update. If this
  46.      * bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
  47.      * must be able to accept an instance of 'File' as the bundle will inject one here
  48.      * during Doctrine hydration.
  49.      *
  50.      * @param File|\Symfony\Component\HttpFoundation\File\UploadedFile $image
  51.      */
  52.     public function setComplaintXPhotoFile(File $image null)
  53.     {
  54.         $this->complaintXPhotoFile $image;
  55.         if (null !== $image) {
  56.             // It is required that at least one field changes if you are using doctrine
  57.             // otherwise the event listeners won't be called and the file is lost
  58.             $this->complaintXPhotoFileUpdatedAt = new \DateTime();
  59.         }
  60.     }
  61.     public function getComplaintXPhotoFile()
  62.     {
  63.         return $this->complaintXPhotoFile;
  64.     }
  65.     /**
  66.      * Get id
  67.      *
  68.      * @return int
  69.      */
  70.     public function getId()
  71.     {
  72.         return $this->id;
  73.     }
  74.     /**
  75.      * Set createdAt
  76.      *
  77.      * @param DateTime $createdAt
  78.      *
  79.      * @return ComplaintXPhoto
  80.      */
  81.     public function setCreatedAt($createdAt)
  82.     {
  83.         $this->createdAt $createdAt;
  84.         return $this;
  85.     }
  86.     /**
  87.      * Get createdAt
  88.      *
  89.      * @return DateTime
  90.      */
  91.     public function getCreatedAt()
  92.     {
  93.         return $this->createdAt;
  94.     }
  95.     /**
  96.      * Set complaintXPhotoFileName
  97.      *
  98.      * @param string $complaintXPhotoFileName
  99.      *
  100.      * @return ComplaintXPhoto
  101.      */
  102.     public function setComplaintXPhotoFileName($complaintXPhotoFileName)
  103.     {
  104.         $this->complaintXPhotoFileName $complaintXPhotoFileName;
  105.         return $this;
  106.     }
  107.     /**
  108.      * Get complaintXPhotoFileName
  109.      *
  110.      * @return string
  111.      */
  112.     public function getComplaintXPhotoFileName()
  113.     {
  114.         return $this->complaintXPhotoFileName;
  115.     }
  116.     /**
  117.      * Set complaintXPhotoFileSize
  118.      *
  119.      * @param integer $complaintXPhotoFileSize
  120.      *
  121.      * @return ComplaintXPhoto
  122.      */
  123.     public function setComplaintXPhotoFileSize($complaintXPhotoFileSize)
  124.     {
  125.         $this->complaintXPhotoFileSize $complaintXPhotoFileSize;
  126.         return $this;
  127.     }
  128.     /**
  129.      * Get complaintXPhotoFileSize
  130.      *
  131.      * @return integer
  132.      */
  133.     public function getComplaintXPhotoFileSize()
  134.     {
  135.         return $this->complaintXPhotoFileSize;
  136.     }
  137.     /**
  138.      * Set complaintXPhotoFileUpdatedAt
  139.      *
  140.      * @param DateTime $complaintXPhotoFileUpdatedAt
  141.      *
  142.      * @return ComplaintXPhoto
  143.      */
  144.     public function setComplaintXPhotoFileUpdatedAt($complaintXPhotoFileUpdatedAt)
  145.     {
  146.         $this->complaintXPhotoFileUpdatedAt $complaintXPhotoFileUpdatedAt;
  147.         return $this;
  148.     }
  149.     /**
  150.      * Get complaintXPhotoFileUpdatedAt
  151.      *
  152.      * @return DateTime
  153.      */
  154.     public function getComplaintXPhotoFileUpdatedAt()
  155.     {
  156.         return $this->complaintXPhotoFileUpdatedAt;
  157.     }
  158.     /**
  159.      * Set complaintX
  160.      *
  161.      * @param \App\Entity\ComplaintX $complaintX
  162.      *
  163.      * @return ComplaintXPhoto
  164.      */
  165.     public function setComplaintX(\App\Entity\ComplaintX $complaintX)
  166.     {
  167.         $this->complaintX $complaintX;
  168.         return $this;
  169.     }
  170.     /**
  171.      * Get complaintX
  172.      *
  173.      * @return \App\Entity\ComplaintX
  174.      */
  175.     public function getComplaintX()
  176.     {
  177.         return $this->complaintX;
  178.     }
  179.     /**
  180.      * Set isDeleted
  181.      *
  182.      * @param boolean $isDeleted
  183.      *
  184.      * @return ComplaintXPhoto
  185.      */
  186.     public function setIsDeleted($isDeleted)
  187.     {
  188.         $this->isDeleted $isDeleted;
  189.         return $this;
  190.     }
  191.     /**
  192.      * Get isDeleted
  193.      *
  194.      * @return boolean
  195.      */
  196.     public function getIsDeleted()
  197.     {
  198.         return $this->isDeleted;
  199.     }
  200. }