src/Entity/Attachment.php line 15

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. /**
  7. * Photos
  8. *
  9. * @ORM\Table(name="attachments")
  10. * @ORM\Entity
  11. * @Vich\Uploadable
  12. */
  13. class Attachment
  14. {
  15. /**
  16. * @var int
  17. *
  18. * @ORM\Column(name="id", type="integer", nullable=false)
  19. * @ORM\Id
  20. * @ORM\GeneratedValue(strategy="IDENTITY")
  21. */
  22. private $id;
  23. /**
  24. * @Vich\UploadableField(mapping="attachments",fileNameProperty="image")
  25. */
  26. private $imageFile;
  27. /**
  28. * @var string
  29. *
  30. * @ORM\Column(type="string", length=250, nullable=true)
  31. */
  32. private $image;
  33. /**
  34. * @var \DateTime
  35. *
  36. * @ORM\Column(name="created", type="datetime", nullable=true)
  37. */
  38. private $created;
  39. /**
  40. * @ORM\ManyToOne(targetEntity=Projects::class, inversedBy="attachments")
  41. */
  42. private $project;
  43. /**
  44. * @ORM\ManyToOne(targetEntity=User::class, inversedBy="attachments")
  45. */
  46. private $user;
  47. public function getId(): ?int
  48. {
  49. return $this->id;
  50. }
  51. public function getCreated(): ?\DateTimeInterface
  52. {
  53. return $this->created;
  54. }
  55. public function setCreated(\DateTimeInterface $created): self
  56. {
  57. $this->created = $created;
  58. return $this;
  59. }
  60. /**
  61. * @return mixed
  62. */
  63. public function getImageFile()
  64. {
  65. return $this->imageFile;
  66. }
  67. /**
  68. * @param mixed $imageFile
  69. */
  70. public function setImageFile(File $imageFile)
  71. {
  72. $this->imageFile = $imageFile;
  73. return $this;
  74. }
  75. public function getImage(): ?string
  76. {
  77. return $this->image;
  78. }
  79. public function setImage(?string $image): self
  80. {
  81. $this->image = $image;
  82. return $this;
  83. }
  84. public function __toString()
  85. {
  86. return (string)$this->image;
  87. }
  88. public function getProject(): ?Projects
  89. {
  90. return $this->project;
  91. }
  92. public function setProject(?Projects $project): self
  93. {
  94. $this->project = $project;
  95. return $this;
  96. }
  97. public function getUser(): ?User
  98. {
  99. return $this->user;
  100. }
  101. public function setUser(?User $user): self
  102. {
  103. $this->user = $user;
  104. return $this;
  105. }
  106. }