APYDataGridBundle icon indicating copy to clipboard operation
APYDataGridBundle copied to clipboard

Inject service instead of service container

Open qferr opened this issue 8 years ago • 5 comments

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.

qferr avatar Dec 16 '15 23:12 qferr

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.

clubdesarrolladores avatar Dec 17 '15 12:12 clubdesarrolladores

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.

qferr avatar Dec 17 '15 12:12 qferr

+1

ekkinox avatar Feb 02 '16 10:02 ekkinox

+1

giovkanata avatar Feb 02 '16 11:02 giovkanata

+1

hkulekci avatar Feb 03 '16 04:02 hkulekci