I'm deep looking in Grid/GridBundle but can't find the way to filter by using join.
:+1:
I think because DataSource is thought to be generic (ORM, ODM, PHPCR) it prevents us to access query builder.
Maybe introduce a OrmDataSourceInterface? Currently I'm using a very hackish way (reflection to access queryBuilder private property) to modify query builder!!
Anyway another problem I encounter is that Pagerfanta has problems with counting and forces you to do manual counting, and to do that you need to setHint on query! Which you don't have access to even with queryBuilder.
So more flexibility in Grid DataSource is crucial for more advanced usages. WDYT Sylius :) ?
\cc @pjedrzejewski
You have access to custom query builder - https://github.com/Sylius/Sylius/blob/master/src/Sylius/Bundle/AdminBundle/Resources/config/grids/order.yml#L9. What we are missing is entity filter type, that will use entity form to render the choices, then you can easily filter on joint entity. Should be simple to implement. (and actually implemented in old grids at "grids" branch of this repo)
I agree with @aramalipoor to introduce either OrmDataSourceInterface or OrmExpressionBuilderInterface for accessing to the query builder.
Done!
Well this pull request is quite useless ;/ What if I need some fancy joins to do the filtering? Simple getQueryBuilder() getter in the Sylius\Bundle\GridBundle\Doctrine\ORM\ExpressionBuilder would be sufficient. Now I have to use the dirty reflection hack.
Most helpful comment
Well this pull request is quite useless ;/ What if I need some fancy joins to do the filtering? Simple
getQueryBuilder()getter in theSylius\Bundle\GridBundle\Doctrine\ORM\ExpressionBuilderwould be sufficient. Now I have to use the dirty reflection hack.