|
12 | 12 |
|
13 | 13 | namespace App\ApiResource; |
14 | 14 |
|
15 | | -use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
16 | 15 | use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
| 16 | +use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
17 | 17 | use ApiPlatform\Doctrine\Orm\State\Options; |
18 | 18 | use ApiPlatform\Metadata\ApiFilter; |
19 | 19 | use ApiPlatform\Metadata\ApiProperty; |
|
23 | 23 | use ApiPlatform\Metadata\Patch; |
24 | 24 | use ApiPlatform\Metadata\Post; |
25 | 25 | use ApiPlatform\OpenApi\Model\Operation; |
| 26 | +use App\Filter\CampagneNonArchiveeFilter; |
26 | 27 | use App\Filter\DemandeDisciplineSportiveFilter; |
27 | 28 | use App\Filter\DemandeFormatFilter; |
28 | 29 | use App\Filter\DerniereInscriptionSearchFilter; |
|
39 | 40 | use Symfony\Component\Validator\Constraints as Assert; |
40 | 41 |
|
41 | 42 | #[ApiResource( |
42 | | - operations : [ |
| 43 | + operations: [ |
43 | 44 | new Get( |
44 | | - uriTemplate : self::ITEM_URI, |
| 45 | + uriTemplate: self::ITEM_URI, |
45 | 46 | uriVariables: ['id'], |
46 | | - security : "is_granted('" . self::VOIR_DEMANDE . "', object)" |
| 47 | + security: "is_granted('" . self::VOIR_DEMANDE . "', object)" |
47 | 48 | ), |
48 | 49 | new GetCollection( |
49 | 50 | uriTemplate: self::COLLECTION_URI, |
50 | | - forceEager : false |
| 51 | + forceEager: false |
51 | 52 | ), |
52 | 53 | new GetCollection( |
53 | | - uriTemplate : self::COLLECTION_UTILISATEUR_URI, |
| 54 | + uriTemplate: self::COLLECTION_UTILISATEUR_URI, |
54 | 55 | uriVariables: ['uid'], |
55 | | - security : "is_granted('ROLE_GESTIONNAIRE') or request.get('uid') == user.getUid()", |
56 | | - forceEager : false, |
57 | | - provider : DemandesUtilisateurProvider::class, |
| 56 | + security: "is_granted('ROLE_GESTIONNAIRE') or request.get('uid') == user.getUid()", |
| 57 | + forceEager: false, |
| 58 | + provider: DemandesUtilisateurProvider::class, |
58 | 59 | ), |
59 | 60 | new Post( |
60 | | - uriTemplate : self::COLLECTION_URI, |
61 | | - denormalizationContext : ['groups' => [self::GROUP_IN]], |
| 61 | + uriTemplate: self::COLLECTION_URI, |
| 62 | + denormalizationContext: ['groups' => [self::GROUP_IN]], |
62 | 63 | securityPostDenormalize: "is_granted('ROLE_GESTIONNAIRE') or object.demandeur.uid == user.getUid()", |
63 | | - read : false, |
64 | | - processor : PostDemandeProcessor::class, |
| 64 | + read: false, |
| 65 | + processor: PostDemandeProcessor::class, |
65 | 66 | ), |
66 | 67 | new Patch( |
67 | | - uriTemplate : self::ITEM_URI, |
68 | | - uriVariables : ['id'], |
69 | | - denormalizationContext : ['groups' => [self::GROUP_CHANGEMENT_ETAT]], |
| 68 | + uriTemplate: self::ITEM_URI, |
| 69 | + uriVariables: ['id'], |
| 70 | + denormalizationContext: ['groups' => [self::GROUP_CHANGEMENT_ETAT]], |
70 | 71 | securityPostDenormalize: "is_granted('" . self::MAJ_DEMANDE . "', [previous_object, object])", |
71 | | - processor : PatchDemandeProcessor::class |
| 72 | + processor: PatchDemandeProcessor::class |
72 | 73 | ), |
73 | 74 | ], |
74 | | - normalizationContext : ['groups' => [self::GROUP_OUT]], |
| 75 | + normalizationContext: ['groups' => [self::GROUP_OUT]], |
75 | 76 | denormalizationContext: ['groups' => [self::GROUP_IN]], |
76 | | - openapi : new Operation(tags: ['Demandes']), |
77 | | - provider : DemandeProvider::class, |
78 | | - stateOptions : new Options(entityClass: \App\Entity\Demande::class), |
| 77 | + openapi: new Operation(tags: ['Demandes']), |
| 78 | + provider: DemandeProvider::class, |
| 79 | + stateOptions: new Options(entityClass: \App\Entity\Demande::class), |
79 | 80 | )] |
80 | 81 | #[ApiFilter(SearchFilter::class, properties: [ |
81 | 82 | 'demandeur.nom' => 'ipartial', |
|
118 | 119 | #[ApiFilter(DemandeDisciplineSportiveFilter::class)] |
119 | 120 | #[ApiFilter(OrderFilter::class, properties: ['demandeur.nom', 'dateDepot'])] |
120 | 121 | #[ApiFilter(DemandeFormatFilter::class)] |
| 122 | +#[ApiFilter(CampagneNonArchiveeFilter::class)] |
121 | 123 | #[DemandeUniqueParCampagneConstraint] |
122 | 124 | #[DemandeWorkflowConstraint] |
123 | 125 | class Demande |
|
0 commit comments