grid-bundle
grid-bundle copied to clipboard
Not working with symfony 3
In symfony 3 you cant get request
from DI container (https://github.com/symfony/symfony/blob/master/UPGRADE-3.0.md). So if you want to make your library to work with symfony 3 you must provide request when creating grid. I wanted to make pull request but don`t get time.
public function indexAction(Request $request)
{
/** @var \Doctrine\ORM\EntityRepository $repository */
$repository = $this->getDoctrine()->getRepository('PedroTeixeiraTestBundle:TestEntity');
$queryBuilder = $repository->createQueryBuilder('r');
/** @var \PedroTeixeira\Bundle\TestBundle\Grid\TestGrid $grid */
$grid = $this->get('pedroteixeira.grid')->createGrid(TestGrid::class, $request);
$grid->setQueryBuilder($queryBuilder);
if ($grid->isResponseAnswer()) {
return $grid->render();
}
return array(
'grid' => $grid->render()
);
}
Moreover, it is necessary to change the namespace in the class FullTransformer.
Original: Symfony\Component\Locale\Stub\DateFormat\FullTransformer New: use Symfony\Component\Intl\DateFormatter\DateFormat\FullTransformer
It is possible to solve as own filters and renderers. I am new in symfony, so I dont know ideal reason how to keep compatibility.
Sorry for my english.
I forked this repository and update code for symfony3 compatibility. Please, check my commits in repo and give me feedback. I dont know if i should do pull request before someone checks it.
Thenks
Hi @pesovo, yes, please send the pull request so we can code review it.
Thanks for the support!
OK, I sended it, but i apologize in advance if there is something incomprehensible