You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
maxDepth on ApiSubresource annotation leads to FileLoaderLoadException #488
I'm trying the api-platform (v2.1.4) for the first time and i read something on maxDepth parameter to prevent something like circular reference.
In my sample i have 2 entities : Book (looks like something in documentation ;-)
and Editor
Book is provided by an many editor company (usually one, but during re-edition another editor may have bought the rights from the first editor, so a collection can be edited by a company and another collection, by another company)
Editor has many books in its inventory
I think you see what i mean. In that case i need an association table, but at the same time i would like to be able to retrreive the editor of a book, or all books of an editor.
I added the annotation ApiSubresource because i want to get the best resource routes ever ! But the problem is that now i have some stupid routes :
/api/books/{id}/serie/books
/api/series/{id}/books/{book}/serie
or even thos ones if i add a review entity which rely on a Book (reviews are link to 1 book, and a book can have many reviews) :
/api/series/{id}/books/{book}/reviews/{Reviews}/book/serie whereas only this one is useful : /api/series/{id}/books/{book}/reviews/{Reviews}
/api/reviews/{id}/book/serie/books/{book}/reviews : where i would prefer only this one /api/reviews/{id}/book/serie/
... WTF
So i tried the params maxDepth on the @ApiSubresource annotation, But each time i set this i have that error :
(4/4) FileLoaderLoadException[Creation Error] The annotation @ApiSubresource declared on property App\Entity\Library\Book::$serie does not have a property named "maxDepth". Available properties: in . (which is being imported from "/dev/php/projects/php-sf-flex-webpack-encore-vuejs/config/routes/api_platform.yaml"). Make sure there is a loader supporting the "api_platform" type.
--
in FileLoader.php (line 168)
sad to see it on documentation whereas it's not released... you should mark beta feature on the documentation.
I will try with branch master even if it's risky, to test it.
Thx
OFFTOPIC: in which way does Flex influences your ability to use a dev version? I have not yet used it extensively but only tried it during a process of migrating an existing app to SF4 (failed due to unavailability of some bundles for SF4, so an incomplete experience with it).
in fact the recipes is just a project with a composer.json (don't know if there is also other files to manage the Kernel and the config) that list all deps. So, using this package, you cannot specify a specific version for one deps.
Maybe the solution would be to remove the recipes package and add all deps manually with the wished version (for testing purpose i'll do this but i prefer using Flex).
Ok, you can fork api-platform/api-pack, edit its composer.json file and push to your fork, then require the forked version in your app instead of the original one in the mean time.
It's more work, but i like the idea, and i don't kow why i didn't get it because i already did it, sometime i feel stupid (and tired)... :-) Thx for the tips
Activity
soyuka commentedon Dec 12, 2017
maxDepthon subresources has been added recently as a new feature but hasn't landed in the release yet.Rebolon commentedon Dec 12, 2017
sad to see it on documentation whereas it's not released... you should mark beta feature on the documentation.
I will try with branch master even if it's risky, to test it.
Thx
soyuka commentedon Dec 12, 2017
Yes our mistake I'm not sure how it landed in the documentation, sorry about that.
Rebolon commentedon Dec 12, 2017
argh i used flex to install api-platform, i cannot easily override the version to dev-master.
Have to wait for a new release
Aerendir commentedon Dec 12, 2017
OFFTOPIC: in which way does Flex influences your ability to use a dev version? I have not yet used it extensively but only tried it during a process of migrating an existing app to SF4 (failed due to unavailability of some bundles for SF4, so an incomplete experience with it).
Rebolon commentedon Dec 13, 2017
in fact the recipes is just a project with a composer.json (don't know if there is also other files to manage the Kernel and the config) that list all deps. So, using this package, you cannot specify a specific version for one deps.
Maybe the solution would be to remove the recipes package and add all deps manually with the wished version (for testing purpose i'll do this but i prefer using Flex).
Aerendir commentedon Dec 13, 2017
I continue to not understand.
Flex is a Composer plugin, but all the deps are in
composer.json.Once installed using
composer req api-platform/api-platform, why you cannot simply change the version todev-masterin yourcomposer.json?Rebolon commentedon Dec 13, 2017
When you use Flex you will not require "api-platform/core": "dev-master"
but
"api-platform/api-pack": "^1.0"
this last one is the felx recipes, now look at its composer json
that way you cannot load a specific version of api-platform/core
Aerendir commentedon Dec 13, 2017
Ok, you can fork
api-platform/api-pack, edit itscomposer.jsonfile and push to your fork, then require the forked version in your app instead of the original one in the mean time.Rebolon commentedon Dec 13, 2017
It's more work, but i like the idea, and i don't kow why i didn't get it because i already did it, sometime i feel stupid (and tired)... :-) Thx for the tips
sandoche commentedon Jan 29, 2018
Do you know when "maxDepth" will be released, even in "dev-master"?
Rebolon commentedon Jan 30, 2018
maxDepth should already be available on master, and even in 2.2.0-beta1