src/Entity/ModelExport.php line 20

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Entity;
  4. use App\Repository\ModelExportRepository;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Symfony\Component\Validator\Constraints as Assert;
  10. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  11. /**
  12. * @ORM\Entity(repositoryClass=ModelExportRepository::class)
  13. *
  14. * @Vich\Uploadable
  15. */
  16. class ModelExport
  17. {
  18. /**
  19. * @ORM\Id
  20. *
  21. * @ORM\GeneratedValue
  22. *
  23. * @ORM\Column(type="integer")
  24. */
  25. private $id;
  26. /**
  27. * @ORM\Column(type="integer")
  28. * @ORM\Column(name="sid", type="integer")
  29. */
  30. private $sid;
  31. /**
  32. * @ORM\Column(name="filename",type="string", length=255, nullable=true)
  33. *
  34. * @var string
  35. */
  36. private $filename;
  37. /**
  38. * @Vich\UploadableField(mapping="model_export", fileNameProperty="filename")
  39. */
  40. #[Assert\File(mimeTypes: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], mimeTypesMessage: 'Mettre uniquement des fichiers de type tableur')]
  41. private ?File $file = null;
  42. /**
  43. * @Vich\UploadableField(mapping="model_export", fileNameProperty="filenameStructure")
  44. */
  45. #[Assert\File(mimeTypes: ['application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'], mimeTypesMessage: 'Mettre uniquement des fichiers de type tableur')]
  46. private ?File $fileStructure = null;
  47. /**
  48. * @ORM\Column(name="updatedAt", type="datetime", nullable=true)
  49. *
  50. * @Gedmo\Timestampable(on="update")
  51. *
  52. * @var \DateTime
  53. */
  54. private $updatedAt;
  55. /**
  56. * @ORM\Column(name="filename_structure",type="string", length=255, nullable=true)
  57. */
  58. private $filenameStructure;
  59. public function getId(): ?int
  60. {
  61. return $this->id;
  62. }
  63. public function getSid(): ?int
  64. {
  65. return $this->sid;
  66. }
  67. public function setSid(int $sid): self
  68. {
  69. $this->sid = $sid;
  70. return $this;
  71. }
  72. public function getFile(): ?File
  73. {
  74. return $this->file;
  75. }
  76. public function setFile(?File $file = null): static
  77. {
  78. $this->file = $file;
  79. if ($file instanceof File) {
  80. $this->updatedAt = new \DateTime('now');
  81. }
  82. return $this;
  83. }
  84. /**
  85. * Set filename.
  86. *
  87. * @param string $filename
  88. *
  89. * @return Document
  90. */
  91. public function setFilename($filename): static
  92. {
  93. $this->filename = $filename;
  94. return $this;
  95. }
  96. /**
  97. * Get filename.
  98. *
  99. * @return string
  100. */
  101. public function getFilename()
  102. {
  103. return $this->filename;
  104. }
  105. public function getFileStructure(): ?File
  106. {
  107. return $this->fileStructure;
  108. }
  109. public function setFileStructure(?File $fileStructure = null): static
  110. {
  111. $this->fileStructure = $fileStructure;
  112. if ($fileStructure instanceof File) {
  113. $this->updatedAt = new \DateTime('now');
  114. }
  115. return $this;
  116. }
  117. public function getFilenameStructure(): ?string
  118. {
  119. return $this->filenameStructure;
  120. }
  121. public function setFilenameStructure(?string $filenameStructure): self
  122. {
  123. $this->filenameStructure = $filenameStructure;
  124. return $this;
  125. }
  126. public function getUpdatedAt(): ?\DateTimeInterface
  127. {
  128. return $this->updatedAt;
  129. }
  130. public function setUpdatedAt(?\DateTimeInterface $updatedAt): static
  131. {
  132. $this->updatedAt = $updatedAt;
  133. return $this;
  134. }
  135. }