File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ to a Resource in two ways:
23
23
24
24
1 . Through the resource declaration, as the ` filters ` attribute.
25
25
26
- For example having a filter service declaration:
26
+ For example having a filter service declaration in ` services.yaml ` :
27
27
28
28
``` yaml
29
29
# api/config/services.yaml
@@ -34,12 +34,23 @@ to a Resource in two ways:
34
34
arguments : [ { dateProperty: ~ } ]
35
35
tags : [ 'api_platform.filter' ]
36
36
# The following are mandatory only if a _defaults section is defined with inverted values.
37
- # You may want to isolate filters in a dedicated file to avoid adding the following lines (by adding them in the defaults section)
37
+ # You may want to isolate filters in a dedicated file to avoid adding the following lines.
38
38
autowire : false
39
39
autoconfigure : false
40
40
public : false
41
41
` ` `
42
42
43
+ Alternatively, you can choose to use a dedicated file to gather filters together:
44
+
45
+ ` ` ` yaml
46
+ # api/config/filters.yaml
47
+ services :
48
+ offer.date_filter :
49
+ parent : ' api_platform.doctrine.orm.date_filter'
50
+ arguments : [ { dateProperty: ~ } ]
51
+ tags : [ 'api_platform.filter' ]
52
+ ` ` `
53
+
43
54
We're linking the filter ` offer.date_filter` with the resource like this:
44
55
45
56
[codeSelector]
You can’t perform that action at this time.
0 commit comments