-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Also check for id in assertObjectExists #7240
Conversation
src/Controller/CRUDController.php
Outdated
)); | ||
} | ||
$adminObject = $admin->getObject($objectId); | ||
if (null === $adminObject) { |
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.
why do you need an extra assert if you are checking here? Maybe make this method final fixes it?
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.
The method is already final.
But phpstan/psalm doesn't know what's happening in the method.
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.
Plus (next commit), the check cannot be done for list and create actions.
@@ -1658,23 +1671,27 @@ protected function handleXmlHttpRequestSuccessResponse(Request $request, object | |||
], Response::HTTP_OK); | |||
} | |||
|
|||
final protected function assertObjectExists(Request $request): void | |||
final protected function assertObjectExists(Request $request, bool $strict = false): void |
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.
In which cases you want to call it with false?
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.
For listAction and createAction.
There is no id in the request for the current admin.
But if it's a childAdmin, there will be id for the parent admin, grand-parent admin, and so on.
Thanks @VincentLanglet |
Changelog