Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with symfony 3 #18

Open
asjustas opened this issue Feb 23, 2016 · 4 comments
Open

Not working with symfony 3 #18

asjustas opened this issue Feb 23, 2016 · 4 comments

Comments

@asjustas
Copy link
Contributor

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()
        );
    }
@pesektomas
Copy link

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.

@pesektomas
Copy link

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

@pedro-teixeira
Copy link
Owner

Hi @pesovo, yes, please send the pull request so we can code review it.

Thanks for the support!

@pesektomas
Copy link

OK, I sended it, but i apologize in advance if there is something incomprehensible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants