Closed phansys closed 2 years ago
You mean AdminInterface<object, ProxyQueryInterface>
?
I understand the idea and why you want to do this. But I feel like it will be a mess.
For instance, getDatagrid
is returning a DatagridInterface<ProxyQueryInterface>
, it will be DatagridInterface<P>
.
But someone could ask the same for Datagrid, and we'll have to add a Generic D for the DatagridInterface.
Also same could be done for the ModelManagerInterface, and it will require a Generic M for this.
And we could add the ProxyQueryInterface
in the Generic of ModelManager since there is this method https://github.com/sonata-project/SonataAdminBundle/blob/4.x/src/Model/ModelManagerInterface.php#L87...
And don't know where we should stop if we start this. And since it's a BC-break for static analysis users, this should be thought a lot before.
As a workaround, I use the annotation
/**
* @method Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQueryInterface createQuery()
*/
On top on the admin class
Feature Request
Add generics for implementations of
ProxyQueryInterface
atAdminInterface
and its related classes.My personal use case with the ORM model manager is the following:
Currently, I have to call
\assert($proxyQuery instanceof \Sonata\DoctrineORMAdminBundle\Datagrid\ProxyQueryInterface)
in order to make explicit the type for the proxy query.