File tree Expand file tree Collapse file tree 6 files changed +39
-15
lines changed
GraphQl/Tests/Fixtures/Serializer/NameConverter
Serializer/Tests/Fixtures/Serializer/NameConverter
tests/Fixtures/TestBundle/Serializer/NameConverter Expand file tree Collapse file tree 6 files changed +39
-15
lines changed Original file line number Diff line number Diff line change 42
42
restore-keys : ${{ runner.os }}-composer-
43
43
- name : Install project dependencies
44
44
working-directory : docs
45
- run : composer install --no-interaction --no-progress --ansi && composer require webonyx/graphql-php
45
+ run : |
46
+ composer update --no-interaction --no-progress --ansi
47
+ cp -r ../src ./vendor/api-platform/core/
46
48
- name : Test guides
47
49
working-directory : docs
48
50
env :
Original file line number Diff line number Diff line change 34
34
"zenstruck/foundry" : " ^1.31" ,
35
35
"symfony/http-client" : " ^6.4 || ^7.0" ,
36
36
"symfony/browser-kit" : " ^6.4 || ^7.0" ,
37
- "justinrainbow/json-schema" : " ^5.2"
37
+ "justinrainbow/json-schema" : " ^5.2" ,
38
+ "webonyx/graphql-php" : " ^15.11"
38
39
},
39
40
"config" : {
40
41
"allow-plugins" : {
43
44
},
44
45
"require-dev" : {
45
46
"phpunit/phpunit" : " ^10"
46
- },
47
- "minimum-stability" : " dev"
47
+ }
48
48
}
Original file line number Diff line number Diff line change @@ -7,9 +7,7 @@ api_platform:
7
7
json : ['application/json']
8
8
docs_formats :
9
9
jsonopenapi : ['application/vnd.openapi+json']
10
- event_listeners_backward_compatibility_layer : false
11
10
keep_legacy_inflector : false
12
11
defaults :
13
12
extra_properties :
14
- rfc_7807_compliant_errors : true
15
13
standard_put : true
Original file line number Diff line number Diff line change 14
14
namespace ApiPlatform \GraphQl \Tests \Fixtures \Serializer \NameConverter ;
15
15
16
16
use Symfony \Component \Serializer \NameConverter \CamelCaseToSnakeCaseNameConverter ;
17
+ use Symfony \Component \Serializer \NameConverter \NameConverterInterface ;
17
18
18
19
/**
19
20
* Custom converter that will only convert a property named "nameConverted"
20
21
* with the same logic as Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter.
21
22
*/
22
- class CustomConverter extends CamelCaseToSnakeCaseNameConverter
23
+ class CustomConverter implements NameConverterInterface
23
24
{
25
+ private NameConverterInterface $ nameConverter ;
26
+
27
+ public function __construct ()
28
+ {
29
+ $ this ->nameConverter = new CamelCaseToSnakeCaseNameConverter ();
30
+ }
31
+
24
32
public function normalize (string $ propertyName ): string
25
33
{
26
- return 'nameConverted ' === $ propertyName ? parent :: normalize ($ propertyName ) : $ propertyName ;
34
+ return 'nameConverted ' === $ propertyName ? $ this -> nameConverter -> normalize ($ propertyName ) : $ propertyName ;
27
35
}
28
36
29
37
public function denormalize (string $ propertyName ): string
30
38
{
31
- return 'name_converted ' === $ propertyName ? parent :: denormalize ($ propertyName ) : $ propertyName ;
39
+ return 'name_converted ' === $ propertyName ? $ this -> nameConverter -> denormalize ($ propertyName ) : $ propertyName ;
32
40
}
33
41
}
Original file line number Diff line number Diff line change 14
14
namespace ApiPlatform \Serializer \Tests \Fixtures \Serializer \NameConverter ;
15
15
16
16
use Symfony \Component \Serializer \NameConverter \CamelCaseToSnakeCaseNameConverter ;
17
+ use Symfony \Component \Serializer \NameConverter \NameConverterInterface ;
17
18
18
19
/**
19
20
* Custom converter that will only convert a property named "nameConverted"
20
21
* with the same logic as Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter.
21
22
*/
22
- final class CustomConverter extends CamelCaseToSnakeCaseNameConverter
23
+ class CustomConverter implements NameConverterInterface
23
24
{
25
+ private NameConverterInterface $ nameConverter ;
26
+
27
+ public function __construct ()
28
+ {
29
+ $ this ->nameConverter = new CamelCaseToSnakeCaseNameConverter ();
30
+ }
31
+
24
32
public function normalize (string $ propertyName ): string
25
33
{
26
- return 'nameConverted ' === $ propertyName ? parent :: normalize ($ propertyName ) : $ propertyName ;
34
+ return 'nameConverted ' === $ propertyName ? $ this -> nameConverter -> normalize ($ propertyName ) : $ propertyName ;
27
35
}
28
36
29
37
public function denormalize (string $ propertyName ): string
30
38
{
31
- return 'name_converted ' === $ propertyName ? parent :: denormalize ($ propertyName ) : $ propertyName ;
39
+ return 'name_converted ' === $ propertyName ? $ this -> nameConverter -> denormalize ($ propertyName ) : $ propertyName ;
32
40
}
33
41
}
Original file line number Diff line number Diff line change 14
14
namespace ApiPlatform \Tests \Fixtures \TestBundle \Serializer \NameConverter ;
15
15
16
16
use Symfony \Component \Serializer \NameConverter \CamelCaseToSnakeCaseNameConverter ;
17
+ use Symfony \Component \Serializer \NameConverter \NameConverterInterface ;
17
18
18
19
/**
19
20
* Custom converter that will only convert a property named "nameConverted"
20
21
* with the same logic as Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter.
21
22
*/
22
- class CustomConverter extends CamelCaseToSnakeCaseNameConverter
23
+ class CustomConverter implements NameConverterInterface
23
24
{
25
+ private NameConverterInterface $ nameConverter ;
26
+
27
+ public function __construct ()
28
+ {
29
+ $ this ->nameConverter = new CamelCaseToSnakeCaseNameConverter ();
30
+ }
31
+
24
32
public function normalize (string $ propertyName ): string
25
33
{
26
- return 'nameConverted ' === $ propertyName ? parent :: normalize ($ propertyName ) : $ propertyName ;
34
+ return 'nameConverted ' === $ propertyName ? $ this -> nameConverter -> normalize ($ propertyName ) : $ propertyName ;
27
35
}
28
36
29
37
public function denormalize (string $ propertyName ): string
30
38
{
31
- return 'name_converted ' === $ propertyName ? parent :: denormalize ($ propertyName ) : $ propertyName ;
39
+ return 'name_converted ' === $ propertyName ? $ this -> nameConverter -> denormalize ($ propertyName ) : $ propertyName ;
32
40
}
33
41
}
You can’t perform that action at this time.
0 commit comments