src/Entity/ComplaintXDocument.php line 16

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