13
13
14
14
namespace ApiPlatform \Tests \Fixtures \TestBundle \Document ;
15
15
16
- use ApiPlatform \Core \Annotation \ApiFilter ;
17
16
use ApiPlatform \Doctrine \Odm \Filter \BooleanFilter ;
18
17
use ApiPlatform \Doctrine \Odm \Filter \DateFilter ;
19
18
use ApiPlatform \Doctrine \Odm \Filter \SearchFilter ;
19
+ use ApiPlatform \Metadata \ApiFilter ;
20
20
use ApiPlatform \Metadata \ApiResource ;
21
21
use ApiPlatform \Metadata \Delete ;
22
22
use ApiPlatform \Metadata \Get ;
31
31
32
32
/**
33
33
* @ODM\Document
34
- * @ApiFilter (DateFilter::class, strategy=DateFilter::EXCLUDE_NULL)
35
- * @ApiFilter (BooleanFilter::class)
36
- * @ApiFilter (PropertyFilter::class, arguments={"parameterName"="foobar"})
37
- * @ApiFilter (GroupFilter::class, arguments={"parameterName"="foobargroups"})
38
- * @ApiFilter (GroupFilter::class, arguments={"parameterName"="foobargroups_override"}, id="override")
39
34
*/
35
+ #[ApiFilter(DateFilter::class, strategy: DateFilter::EXCLUDE_NULL )]
36
+ #[ApiFilter(BooleanFilter::class)]
37
+ #[ApiFilter(PropertyFilter::class, arguments: ['parameterName ' => 'foobar ' ])]
38
+ #[ApiFilter(GroupFilter::class, arguments: ['parameterName ' => 'foobargroups ' ])]
39
+ #[ApiFilter(GroupFilter::class, arguments: ['parameterName ' => 'foobargroups_override ' ], id: 'override ' )]
40
40
#[ApiResource(operations: [new Get (openapiContext: ['tags ' => []]), new Put (), new Delete (), new Post (), new GetCollection ()], sunset: '2050-01-01 ' , normalizationContext: ['groups ' => ['colors ' ]])]
41
41
class DummyCar
42
42
{
@@ -50,42 +50,38 @@ class DummyCar
50
50
* @var mixed Something else
51
51
*
52
52
* @ODM\ReferenceMany(targetDocument=DummyCarColor::class, mappedBy="car")
53
- *
54
- * @ApiFilter(SearchFilter::class, properties={"colors.prop"="ipartial", "colors"="exact"})
55
53
*/
54
+ #[ApiFilter(SearchFilter::class, properties: ['colors.prop ' => 'ipartial ' , 'colors ' => 'exact ' ])]
56
55
#[Serializer \Groups(['colors ' ])]
57
56
private $ colors ;
58
57
/**
59
58
* @var mixed Something else
60
59
*
61
60
* @ODM\ReferenceMany(targetDocument=DummyCarColor::class, mappedBy="car")
62
- *
63
- * @ApiFilter(SearchFilter::class, strategy="exact")
64
61
*/
62
+ #[ApiFilter(SearchFilter::class, strategy: 'exact ' )]
65
63
#[Serializer \Groups(['colors ' ])]
66
- private ? mixed $ secondColors = null ;
64
+ private mixed $ secondColors = null ;
67
65
/**
68
66
* @var mixed Something else
69
67
*
70
68
* @ODM\ReferenceMany(targetDocument=DummyCarColor::class, mappedBy="car")
71
- *
72
- * @ApiFilter(SearchFilter::class, strategy="exact")
73
69
*/
70
+ #[ApiFilter(SearchFilter::class, strategy: 'exact ' )]
74
71
#[Serializer \Groups(['colors ' ])]
75
- private ? mixed $ thirdColors = null ;
72
+ private mixed $ thirdColors = null ;
76
73
/**
77
74
* @var mixed Something else
78
75
*
79
76
* @ODM\ReferenceMany(targetDocument=UuidIdentifierDummy::class)
80
- *
81
- * @ApiFilter(SearchFilter::class, strategy="exact")
82
77
*/
78
+ #[ApiFilter(SearchFilter::class, strategy: 'exact ' )]
83
79
#[Serializer \Groups(['colors ' ])]
84
- private ? mixed $ uuid = null ;
80
+ private mixed $ uuid = null ;
85
81
/**
86
82
* @ODM\Field(type="string")
87
- * @ApiFilter(SearchFilter::class, strategy="partial")
88
83
*/
84
+ #[ApiFilter(SearchFilter::class, strategy: 'partial ' )]
89
85
private ?string $ name = null ;
90
86
/**
91
87
* @ODM\Field(type="bool")
0 commit comments