src/Entity/TechnicalDataSheet.php line 12

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