Skip to content

Commit 9d1be2e

Browse files
committed
Migrate to PHP attributes #9606
1 parent 0dcf099 commit 9d1be2e

File tree

17 files changed

+120
-206
lines changed

17 files changed

+120
-206
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"cakephp/chronos": "^2.3",
4747
"doctrine/dbal": "^3.5",
4848
"doctrine/migrations": "^3.5",
49-
"ecodev/graphql-doctrine": "^7.3",
49+
"ecodev/graphql-doctrine": "^8.0",
5050
"imagine/imagine": "^1.3",
5151
"laminas/laminas-diactoros": "^2.21",
5252
"laminas/laminas-log": "^2.15",

composer.lock

Lines changed: 44 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Model/Message.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Ecodev\Felix\Model;
66

77
use Cake\Chronos\Chronos;
8+
use GraphQL\Doctrine\Attribute as API;
89

910
interface Message extends Model
1011
{
@@ -20,9 +21,8 @@ public function getDateSent(): ?Chronos;
2021

2122
/**
2223
* Set sent time.
23-
*
24-
* @API\Exclude
2524
*/
25+
#[Api\Exclude]
2626
public function setDateSent(?Chronos $dateSent): void;
2727

2828
/**

src/Model/Traits/AbstractFile.php

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use Doctrine\ORM\Mapping as ORM;
88
use Exception;
9-
use GraphQL\Doctrine\Annotation as API;
9+
use GraphQL\Doctrine\Attribute as API;
1010
use 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();

src/Model/Traits/HasDescription.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
trait HasDescription
1010
{
11-
/**
12-
* @ORM\Column(type="text", length=65535)
13-
*/
11+
#[ORM\Column(type: 'text', length: 65535)]
1412
private string $description = '';
1513

1614
/**

src/Model/Traits/HasInternalRemarks.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88

99
trait HasInternalRemarks
1010
{
11-
/**
12-
* @ORM\Column(type="text", length=65535)
13-
*/
11+
#[ORM\Column(type: 'text', length: 65535)]
1412
private string $internalRemarks = '';
1513

1614
/**

src/Model/Traits/HasName.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
*/
1212
trait HasName
1313
{
14-
/**
15-
* @ORM\Column(type="string", length=191)
16-
*/
14+
#[ORM\Column(type: 'string', length: 191)]
1715
private string $name = '';
1816

1917
/**

0 commit comments

Comments
 (0)