-
-
Notifications
You must be signed in to change notification settings - Fork 921
fix #1479 allow to override SubresourceOperations through metadata #1483
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
fix #1479 allow to override SubresourceOperations through metadata #1483
Conversation
@@ -87,6 +87,9 @@ public function load($data, $type = null): RouteCollection | |||
|
|||
if (null !== $collectionOperations = $resourceMetadata->getCollectionOperations()) { | |||
foreach ($collectionOperations as $operationName => $operation) { | |||
if ('subresource' === substr($operationName, -11)) { |
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.
Either this or we add a SubresourceOperations
in the resource metadata declarations. Lmk.
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.
I think subresourceOperations would make more sense.
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.
done
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.
Nice, thank you!
3a8c6c7
to
683d6fc
Compare
/** | ||
* Returns a new instance with the given subresource operations. | ||
* | ||
* @param array $subresourceOperations |
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.
You can remove those annotations (it's already documented by typehints).
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.
copy pasted, why don't we remove the other ones then?
@@ -193,6 +220,21 @@ public function getItemOperationAttribute(string $operationName = null, string $ | |||
} | |||
|
|||
/** | |||
* Gets a subresource operation attribute, optionally fallback to a resource attribute. | |||
* | |||
* @param string|null $operationName |
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.
Same here
97ef0bc
to
94a420a
Compare
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.
Minor change
'', | ||
[], | ||
['GET'] | ||
] + ($operation['defaults'] ?? []), |
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.
All parenthesis are useless here.
94a420a
to
17c321f
Compare
Thanks @soyuka |
…ride-operation fix api-platform#1479 allow to override SubresourceOperations through metadata
Also backported #1472 to subresources