ControleOnline /
api-platform-common
| 1 | <?php |
||
| 2 | |||
| 3 | namespace ControleOnline\Entity; |
||
| 4 | |||
| 5 | use Symfony\Component\Serializer\Attribute\Groups; |
||
|
0 ignored issues
–
show
|
|||
| 6 | |||
| 7 | use ApiPlatform\Metadata\ApiResource; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 8 | use ApiPlatform\Metadata\Delete; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\Delete was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 9 | use ApiPlatform\Metadata\Get; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\Get was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 10 | use ApiPlatform\Metadata\GetCollection; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\GetCollection was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 11 | use ApiPlatform\Metadata\Post; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\Post was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 12 | use ApiPlatform\Metadata\Put; |
||
|
0 ignored issues
–
show
The type
ApiPlatform\Metadata\Put was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 13 | use ControleOnline\Listener\LogListener; |
||
| 14 | use ControleOnline\Repository\NotificationRepository; |
||
| 15 | use Doctrine\ORM\Mapping as ORM; |
||
|
0 ignored issues
–
show
The type
Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 16 | |||
| 17 | #[ApiResource( |
||
| 18 | operations: [ |
||
| 19 | new Get(security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\') and previous_object.canAccess(user))'), |
||
| 20 | new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 21 | new Put( |
||
| 22 | security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))', |
||
| 23 | validationContext: ['groups' => ['notifications:write']], |
||
| 24 | denormalizationContext: ['groups' => ['notifications:write']] |
||
| 25 | ), |
||
| 26 | new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 27 | new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
||
| 28 | ], |
||
| 29 | formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
||
| 30 | normalizationContext: ['groups' => ['notifications:read']], |
||
| 31 | denormalizationContext: ['groups' => ['notifications:write']] |
||
| 32 | )] |
||
| 33 | #[ORM\Table(name: 'notification')] |
||
| 34 | #[ORM\Index(name: 'people_id', columns: ['people_id'])] |
||
| 35 | #[ORM\EntityListeners([LogListener::class])] |
||
| 36 | #[ORM\Entity(repositoryClass: NotificationRepository::class)] |
||
| 37 | class Notification |
||
| 38 | { |
||
| 39 | #[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
||
| 40 | #[ORM\Id] |
||
| 41 | #[ORM\GeneratedValue(strategy: 'IDENTITY')] |
||
| 42 | #[Groups(['notifications:read'])] |
||
| 43 | private $id; |
||
| 44 | |||
| 45 | #[ORM\Column(name: 'notification', type: 'text', length: 65535, nullable: false)] |
||
| 46 | #[Groups(['notifications:read', 'notifications:write'])] |
||
| 47 | private $notification; |
||
| 48 | |||
| 49 | #[ORM\Column(name: 'route', type: 'string', length: 50, nullable: false)] |
||
| 50 | #[Groups(['notifications:read', 'notifications:write'])] |
||
| 51 | private $route; |
||
| 52 | |||
| 53 | #[ORM\Column(name: 'route_id', type: 'integer', nullable: false)] |
||
| 54 | #[Groups(['notifications:read', 'notifications:write'])] |
||
| 55 | private $routeId; |
||
| 56 | |||
| 57 | #[ORM\Column(name: 'read', type: 'boolean', nullable: false)] |
||
| 58 | #[Groups(['notifications:read', 'notifications:write'])] |
||
| 59 | private $read; |
||
| 60 | |||
| 61 | #[ORM\JoinColumn(name: 'people_id', referencedColumnName: 'id')] |
||
| 62 | #[ORM\ManyToOne(targetEntity: People::class)] |
||
| 63 | #[Groups(['notifications:read', 'notifications:write'])] |
||
| 64 | private $people; |
||
| 65 | |||
| 66 | public function getId() |
||
| 67 | { |
||
| 68 | return $this->id; |
||
| 69 | } |
||
| 70 | |||
| 71 | public function setNotification($notification): self |
||
| 72 | { |
||
| 73 | $this->notification = $notification; |
||
| 74 | return $this; |
||
| 75 | } |
||
| 76 | |||
| 77 | public function getNotification() |
||
| 78 | { |
||
| 79 | return $this->notification; |
||
| 80 | } |
||
| 81 | |||
| 82 | public function setRoute($route): self |
||
| 83 | { |
||
| 84 | $this->route = $route; |
||
| 85 | return $this; |
||
| 86 | } |
||
| 87 | |||
| 88 | public function getRoute() |
||
| 89 | { |
||
| 90 | return $this->route; |
||
| 91 | } |
||
| 92 | |||
| 93 | public function setRouteId($routeId): self |
||
| 94 | { |
||
| 95 | $this->routeId = $routeId; |
||
| 96 | return $this; |
||
| 97 | } |
||
| 98 | |||
| 99 | public function getRouteId() |
||
| 100 | { |
||
| 101 | return $this->routeId; |
||
| 102 | } |
||
| 103 | |||
| 104 | public function setRead($read): self |
||
| 105 | { |
||
| 106 | $this->read = $read; |
||
| 107 | return $this; |
||
| 108 | } |
||
| 109 | |||
| 110 | public function getRead() |
||
| 111 | { |
||
| 112 | return $this->read; |
||
| 113 | } |
||
| 114 | |||
| 115 | public function setPeople($people): self |
||
| 116 | { |
||
| 117 | $this->people = $people; |
||
| 118 | return $this; |
||
| 119 | } |
||
| 120 | |||
| 121 | public function getPeople() |
||
| 122 | { |
||
| 123 | return $this->people; |
||
| 124 | } |
||
| 125 | } |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths