src/Entity/DocumentManual.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DocumentManualRepository;
  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: DocumentManualRepository::class)]
  9. #[ORM\Table(name: 'document_manual')]
  10. class DocumentManual
  11. {
  12. #[ORM\Id]
  13. #[ORM\GeneratedValue(strategy: "AUTO")]
  14. #[ORM\Column(type: "integer")]
  15. private ?int $id = null;
  16. #[ORM\Column(type: "string", length: 255)]
  17. private ?string $name = null;
  18. #[ORM\Column(type: "text", nullable: true)]
  19. private ?string $description = null;
  20. #[ORM\Column(type: "string", length: 255, nullable: true)]
  21. private ?string $filename = null;
  22. #[Vich\UploadableField(mapping: "documents", fileNameProperty: "filename")]
  23. private ?File $file = null;
  24. #[ORM\Column(type: "datetime", nullable: true)]
  25. private ?\DateTime $updatedAt = null;
  26. #[ORM\Column(type: "boolean")]
  27. private bool $enabled = true;
  28. #[ORM\Column(type: "integer")]
  29. private int $sortOrder = 0;
  30. public function getId(): ?int
  31. {
  32. return $this->id;
  33. }
  34. public function getName(): ?string
  35. {
  36. return $this->name;
  37. }
  38. public function setName(string $name): self
  39. {
  40. $this->name = $name;
  41. return $this;
  42. }
  43. public function getDescription(): ?string
  44. {
  45. return $this->description;
  46. }
  47. public function setDescription(?string $description): self
  48. {
  49. $this->description = $description;
  50. return $this;
  51. }
  52. public function getFilename(): ?string
  53. {
  54. return $this->filename;
  55. }
  56. public function setFilename(?string $filename): self
  57. {
  58. $this->filename = $filename;
  59. return $this;
  60. }
  61. public function getFile(): ?File
  62. {
  63. return $this->file;
  64. }
  65. public function setFile(?File $file): self
  66. {
  67. $this->file = $file;
  68. if ($file) {
  69. $this->updatedAt = new \DateTime('now');
  70. }
  71. return $this;
  72. }
  73. public function getUpdatedAt(): ?\DateTime
  74. {
  75. return $this->updatedAt;
  76. }
  77. public function setUpdatedAt(?\DateTime $updatedAt): self
  78. {
  79. $this->updatedAt = $updatedAt;
  80. return $this;
  81. }
  82. public function isEnabled(): bool
  83. {
  84. return $this->enabled;
  85. }
  86. public function setEnabled(bool $enabled): self
  87. {
  88. $this->enabled = $enabled;
  89. return $this;
  90. }
  91. public function getSortOrder(): int
  92. {
  93. return $this->sortOrder;
  94. }
  95. public function setSortOrder(int $sortOrder): self
  96. {
  97. $this->sortOrder = $sortOrder;
  98. return $this;
  99. }
  100. public function __toString(): string
  101. {
  102. return $this->name ?? '';
  103. }
  104. }