Skip to content

Not working with symfony 3 #18

@asjustas

Description

@asjustas

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()
        );
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions