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
When typing argument with the admin interface instead of the exact admin type the admin is not found.
Code example
class Admin implements \Sonata\AdminBundle\Admin\AdminInterface
{
}
class Action
{
publicfunctionfailingAction(\Sonata\AdminBundle\Admin\AdminInterface$admin)
{
// Will not found the admin parameter
}
publicfunctionworkingAction(Admin$admin)
{
// Everything is ok
}
}
How to fix
This is because the is_subclass_of function use in AdminValueResolver does check if the class is the same as requested. Also the is_a function have a different behaviour base on a class string or an object, probably a bug in PHP, so it cannot be use of the first check.
@VincentLanglet You should check this one as well before releasing. It's easy to fix I just want to make sure it will be accepted.
Behaviour of the Admin Fetcher is not base on the specific class so calling it manually it a controller would work that why I was expecting the AdminValueResolver to work the same way.
Subject
When typing argument with the admin interface instead of the exact admin type the admin is not found.
Code example
How to fix
This is because the is_subclass_of function use in AdminValueResolver does check if the class is the same as requested. Also the is_a function have a different behaviour base on a class string or an object, probably a bug in PHP, so it cannot be use of the first check.
Recommendation would be the check if $type === AdminInterface::class or is_subclass_of.
The text was updated successfully, but these errors were encountered: