Symfony fragment rendering
stanislavprokopov opened this issue · comments
If you try to render a fragment {{ render(controller('Demo:Default:list') }}
, that renders a data-source with pagination, you will receive an error:
An exception has been thrown during the rendering of a template ("None of the routers in the chain matched url '/_fragment'")
The problem is in FSi\Bundle\DataSourceBundle\Twig\Extension\DataSourceExtension
.
The method getCurrentRoute
tries to match _fragment
and fails.
@chives ping
As @stanislavprokopov said its not possibile to use datasource twig extensions when controller is embedded in template.
IMHO https://github.com/fsi-open/datasource-bundle/blob/master/Twig/Extension/DataSourceExtension.php#L354 is the main problem because datasource cant depend on current url. Even if user will pass router
through twig function options the exception will still be throwen.
I think that this could be solved using RequestStack
from Symfony 2.4 . Before Symfony 2.4 we can modify widgets that they will not call getCurrentRequest()
in case of passing custom route
option.
@stanislavprokopov #20 should do the job. This feature is available from version 1.1 of datasource-bundle.