src/Entity/Attachment.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  4. use Symfony\Component\HttpFoundation\File\File;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Table(name: 'attachments')]
  7. #[ORM\Entity]
  8. #[Vich\Uploadable]
  9. class Attachment
  10. {
  11. #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
  12. #[ORM\Id]
  13. #[ORM\GeneratedValue(strategy: 'IDENTITY')]
  14. private $id;
  15. #[Vich\UploadableField(mapping: 'attachments', fileNameProperty: 'image')]
  16. private $imageFile;
  17. #[ORM\Column(type: 'string', length: 250, nullable: true)]
  18. private $image;
  19. #[ORM\Column(name: 'created', type: 'datetime', nullable: true)]
  20. private $created;
  21. #[ORM\ManyToOne(targetEntity: Projects::class, inversedBy: 'attachments')]
  22. private $project;
  23. #[ORM\ManyToOne(targetEntity: User::class, inversedBy: 'attachments')]
  24. private $user;
  25. #[ORM\ManyToOne(targetEntity: Quotes::class, inversedBy: 'attachments')]
  26. private $quote;
  27. public function getId(): ?int
  28. {
  29. return $this->id;
  30. }
  31. public function getCreated(): ?\DateTimeInterface
  32. {
  33. return $this->created;
  34. }
  35. public function setCreated(\DateTimeInterface $created): self
  36. {
  37. $this->created = $created;
  38. return $this;
  39. }
  40. /**
  41. * @return mixed
  42. */
  43. public function getImageFile()
  44. {
  45. return $this->imageFile;
  46. }
  47. /**
  48. * @param mixed $imageFile
  49. */
  50. public function setImageFile(File $imageFile)
  51. {
  52. $this->imageFile = $imageFile;
  53. return $this;
  54. }
  55. public function getImage(): ?string
  56. {
  57. return $this->image;
  58. }
  59. public function setImage(?string $image): self
  60. {
  61. $this->image = $image;
  62. return $this;
  63. }
  64. public function __toString()
  65. {
  66. return (string)$this->image;
  67. }
  68. public function getProject(): ?Projects
  69. {
  70. return $this->project;
  71. }
  72. public function setProject(?Projects $project): self
  73. {
  74. $this->project = $project;
  75. return $this;
  76. }
  77. public function getUser(): ?User
  78. {
  79. return $this->user;
  80. }
  81. public function setUser(?User $user): self
  82. {
  83. $this->user = $user;
  84. return $this;
  85. }
  86. public function getQuote(): ?Quotes
  87. {
  88. return $this->quote;
  89. }
  90. public function setQuote(?Quotes $quote): self
  91. {
  92. $this->quote = $quote;
  93. return $this;
  94. }
  95. }