APYDataGridBundle
APYDataGridBundle copied to clipboard
Inject service instead of service container
The Grid
should not be dependent on the service container, only on the services it needs. The service can be used in an environment which is not using the Symfony service container (for standalone component). The code would be easier to read, maintain and unit test.
The bigger dependency is the session component?, its possible rewrite the grid to implement a "Post Redirect Get pattern". Post take the filter's parameters, and redirect with these filters in the query string, later a GET controller make the sql query and renderize the template. The paginator and header columns order, can use the GET controller directly. No session is needed.
The grid class has more than 2000 lines and too many responsabilities, we must explode this class in several classes (and make these testables!).
+1 for this issue.
I agree, for which reason I developed a Grid::handleRequest
(like symfony form component) method for manage filters and sorts. For now, it just calls the method Grid::isReadyForRedirect
but must be rewritten. To reduce the coupling, we could handle requests in a RequestHandler
object for example.
+1
+1
+1