APY / APYDataGridBundle

Symfony Datagrid Bundle
MIT License
492 stars 344 forks source link

Controller deprecated on Symfony 4 #1034

Closed simon-rohart closed 5 years ago

simon-rohart commented 5 years ago

Hello,

With Symfony 4, the bundle works only with the old Symfony\Bundle\FrameworkBundle\Controller\Controller class which is now deprecated. How can we use the new Symfony\Bundle\FrameworkBundle\Controller\AbstractController ? Is it possible to fix that ?

Thank you very much for this great bundle

FlorianBourdoux commented 5 years ago

Hello, I have the same problem. I suppose we should override getSubscribedServices() of the AbstractController to be able to call the service, but I'm new on Symfony and I did not fund the solution to do it yet

rvanlaarhoven commented 5 years ago

You can just use the AbstractController, but you'll have to inject the grid service in your controller/action:

In services.yaml:

APY\DataGridBundle\Grid\Grid: '@grid'

In your controller:

use APY\DataGridBundle\Grid\Grid;

public function yourAction(Grid $grid)
{

}
simon-rohart commented 5 years ago

It works, thanks ;-)