-
-
Notifications
You must be signed in to change notification settings - Fork 921
WIP - Subresource maxDepth #1512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Enable FOSUser support if the bundle is installed
Deprecate in the constructor
Deprecate NelmioApiDoc 2 support
Merge branch '2.1'
…formances Add a partial paginator to prevent SQL COUNT queries
Add payload to ConstraintViolationListNormalizer
2.1.x-dev is already taken by the 2.1 branch, and this should represent the next minor version anyway.
Bump branch alias to 2.2.x-dev
Parent class filters (needs test) Support for nested properties Tests Fix some comments and remove id=>id in compiler pass
Implement Annotation filters @APIFilter
Remove an unused var
Enable the coverage
If api-platform uses upstream libs in a deprecated way, we should be aware of it.
$maxDepth = $subresource->getMaxDepth(); | ||
} | ||
|
||
if(null !== $maxDepth && count($visited) >= $maxDepth) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use the $depth
counter instead of count or there is no point :p.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes my bad... I commit/push too quickly
@@ -154,7 +165,7 @@ private function computeSubresourceOperations(string $resourceClass, array &$tre | |||
|
|||
$tree[$operation['route_name']] = $operation; | |||
|
|||
$this->computeSubresourceOperations($subresourceClass, $tree, $rootResourceClass, $operation, $visited + [$visiting => true]); | |||
$this->computeSubresourceOperations($subresourceClass, $tree, $rootResourceClass, $operation, $visited + [$visiting => true], $counter+1, $maxDepth); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ++$depth
instead of $counter + 1
Try to use |
Wow button Update branch in Github create a real mess... Sorry about that... |
I can fix you branch if you want ? |
Yes if you can, I would really appreciate! Thanks |
e1c5e4b
to
f61b3d8
Compare
Fixed, please use the following:
|
Hey,
I just made my first PR to api-platform!
It adds the possibility to pass a maxDepth parameter to ApiSubresources in order to stop the route generation.
Because it's my first PR on api-platform, I don't know how all this works so I need some help.
I'm not sure about the annotation system, I think I am good with my code but if anyone have some advice it would be appreciated. Add to that, is there a modification for yaml and xml configuration to take into account the new parameter?
Finally, someone can validate my code on SubresourcesOperationFactory. Seems good to me and I created a test and it doesn't break other tests but like I said first PR on Api platform and I think I have a lots of thing to learn on this!
After this, I will update the documentation and create more test case.
Thanks in advance.
@soyuka