The documentation says that there is file api/config/api_platform/resources.yaml
where I can map entities using yml. But neither in the distribution nor when I install API-platform as a package I can't find this file. Creation of the directory and file manually doesn't help.
Asked
Active
Viewed 2,004 times
1

A.L
- 10,259
- 10
- 67
- 98

Nikita Pimoshenko
- 155
- 7
1 Answers
3
In the context of a Symfony 4 project, the file can be located at config/api_platform/resources.yaml
. If it doesn't exist, simply create it.
You can also use several files in order to define your mappings:
config/api_platform/resources/entity1.yaml
config/api_platform/resources/entity2.yaml
I suggest to use separate files since it's simpler to maintain than one big file.
You'll have to configure these paths in the config/packages/api_platform.yaml
file:
api_platform:
mapping:
paths: ['%kernel.project_dir%/config/api_platform/resources']
See Nek's answer for a complete example.
I find the documentation a little bit confusing about this, because in a Symfony project there's no api/
directory at the root of the project.

A.L
- 10,259
- 10
- 67
- 98
-
@NikitaPimoshenko I updated my answer. You may need to modify the `paths` value, depending where you put your configuration files. – A.L May 10 '18 at 14:31
-
Maybe u know why i can't make POST/PUT overriden request the same URI as subresource's one? – Nikita Pimoshenko May 10 '18 at 14:41
-
Ok i found that it;s unavaialble now. – Nikita Pimoshenko May 10 '18 at 14:43
-
I'm sorry but I can help you about subresources. – A.L May 10 '18 at 14:43
-
You can? Or you can't? =) As far as i understoud subresources are now only readable and to create them differently each endpoint should be served via Custom Operation class as example in docs. – Nikita Pimoshenko May 10 '18 at 21:14
-
Yes, sorry for the typo but I never used subresources so I can't help you. But feel free to add another question about this issue! – A.L May 11 '18 at 08:50