66
77use Doctrine \ORM \Mapping as ORM ;
88use Exception ;
9- use GraphQL \Doctrine \Annotation as API ;
9+ use GraphQL \Doctrine \Attribute as API ;
1010use Psr \Http \Message \UploadedFileInterface ;
1111
1212/**
@@ -26,15 +26,11 @@ abstract protected function getBasePath(): string;
2626 */
2727 abstract protected function getAcceptedMimeTypes (): array ;
2828
29- /**
30- * @API\Exclude
31- * @ORM\Column(type="string", length=190, options={"default" = ""})
32- */
29+ #[ORM \Column(type: 'string ' , length: 190 , options: ['default ' => '' ])]
30+ #[API \Exclude]
3331 private string $ filename = '' ;
3432
35- /**
36- * @ORM\Column(type="string", length=255, options={"default" = ""})
37- */
33+ #[ORM \Column(type: 'string ' , length: 255 , options: ['default ' => '' ])]
3834 private string $ mime = '' ;
3935
4036 /**
@@ -55,19 +51,17 @@ public function setFile(UploadedFileInterface $file): void
5551
5652 /**
5753 * Set filename (without path).
58- *
59- * @API\Exclude
6054 */
55+ #[API \Exclude]
6156 public function setFilename (string $ filename ): void
6257 {
6358 $ this ->filename = $ filename ;
6459 }
6560
6661 /**
6762 * Get filename (without path).
68- *
69- * @API\Exclude
7063 */
64+ #[API \Exclude]
7165 public function getFilename (): string
7266 {
7367 return $ this ->filename ;
@@ -83,9 +77,8 @@ public function getMime(): string
8377
8478 /**
8579 * Get absolute path to file on disk.
86- *
87- * @API\Exclude
8880 */
81+ #[API \Exclude]
8982 public function getPath (): string
9083 {
9184 return realpath ('. ' ) . '/ ' . $ this ->getBasePath () . $ this ->getFilename ();
@@ -95,9 +88,8 @@ public function getPath(): string
9588 * Automatically called by Doctrine when the object is deleted
9689 * Is called after database update because we can have issues on remove operation (like integrity test)
9790 * and it's preferable to keep a related file on drive before removing it definitely.
98- *
99- * @ORM\PostRemove
10091 */
92+ #[ORM \PostRemove]
10193 public function deleteFile (): void
10294 {
10395 $ path = $ this ->getPath ();
0 commit comments