omines / datatables-bundle

DataTables bundle for Symfony
https://omines.github.io/datatables-bundle/
MIT License
252 stars 113 forks source link

ORMAdapter Error #148

Closed Xeyos88 closed 4 years ago

Xeyos88 commented 4 years ago

Hello, after following the various steps, and also having some problems in managing client dependencies with webpack. I have the following error:

Argument 1 passed to Omines\DataTablesBundle\Adapter\Doctrine\ORMAdapter::__construct() must be an instance of Symfony\Bridge\Doctrine\RegistryInterface or null, instance of Doctrine\Bundle\DoctrineBundle\Registry given

And this is my code:

$table = $dataTableFactory->create()
            ->add('title', TextColumn::class)
            ->add('created_at', DateTimeColumn::class)
            ->createAdapter(ORMAdapter::class, [
                'entity' => Article::class,
            ]);

Where am i wrong?

giovannialbero1992 commented 4 years ago

I think that it is a problem with Symfony's Dependency Injection. Check if it is declared a service Symfony\Bridge\Doctrine\RegistryInterface .

curry684 commented 4 years ago

Which versions of Symfony and our bundle are you using?

This stems from a deprecation in Symfony which was fixed in 0.4.0 4 months ago.

curry684 commented 4 years ago

Specifically it was fixed by https://github.com/omines/datatables-bundle/pull/110 and first reported in https://github.com/omines/datatables-bundle/issues/108 as Symfony 5.0 was entering RC phase.

Xeyos88 commented 4 years ago

I use symfony 4.4.4

curry684 commented 4 years ago

and our bundle

With Symfony 4.4 and bundle 0.4.1 you shouldn't be having this issue.

curry684 commented 4 years ago

You may actually be using a f*bar combination of symfony/doctrine-bridge, doctrine/doctrine-bundle and omines/datatables-bundle versions which we cannot easily fix (problem on Symfony's end). Please list versions of all those 3 dependencies.

And ensure a simple composer upgrade does not fix your issue, your Symfony version is also 3 minors behind.

curry684 commented 4 years ago

No feedback, assuming fixed.