dunglas / doctrine-json-odm

An object document mapper for Doctrine ORM using JSON types of modern RDBMS.
https://dunglas.fr
MIT License
580 stars 65 forks source link

Cannot use the bundle using Symfony4/Flex #32

Closed jdecool closed 5 years ago

jdecool commented 6 years ago

I try to use this library on a fresh project using SYmfony4/Flex.

I've an error You have requested a non-existent service "dunglas_doctrine_json_odm.serializer" on my project after install the package with Composer.

Step to reproduce :

$  composer create-project "symfony/skeleton:dev-master" my-project 4.0.0-RC1
$ cd my-project/
$ composer require orm
$ composer require dunglas/doctrine-json-odm
# Then I register the bundle into `config/bundles.php` because it was not detected by Flex
$ bin/console cache:clear

In Container.php line 263:

  You have requested a non-existent service "dunglas_doctrine_json_odm.serializer".  
dunglas commented 6 years ago

Thanks for the report! I'm working on it, weird problem.

dunglas commented 6 years ago

fc18ef0ea778ad90439b5838e4cb76aafd6e0000 should fix the problem. Can you try the master version @jdecool?

Another workaround is to install symfony/property-access.

jdecool commented 6 years ago

That's really strange.

If I try this :

$  composer create-project "symfony/skeleton:dev-master" my-project 4.0.0-RC1
$ cd my-project/
$ composer require orm
$ composer require "dunglas/doctrine-json-odm:dev-master"
# Then I register the bundle into `config/bundles.php` because it was not detected by Flex
$ bin/console cache:clear

I've got the same error.

But when I explicitly require symfony/property-access, it works.

jlemale commented 6 years ago

With symfony 4 I had to add symfony/property-info too

So manually :

jdecool commented 6 years ago

After some investigations, I'm not sure this an issue of the bundle.

This is why :

$  composer create-project "symfony/skeleton:dev-master" my-project
$ cd my-project/
$ composer require orm
$ composer require "dunglas/doctrine-json-odm:dev-master"
# Then I register the bundle into `config/bundles.php` because it was not detected by Flex
$ bin/console cache:clear

Here I've the issue You have requested a non-existent service "dunglas_doctrine_json_odm.serializer"..

But simply do composer install, this change nothing for the Composer configuration and installed packages, but the error disapear.

philippwaller commented 6 years ago

@dunglas: Your fix works well as long I am using the symfony dev environment. But if I switched to prod I getting the same error again:

bin/console cache:clear -e=prod

    You have requested a non-existent service "dunglas_doctrine_json_odm.serializer".

UPDATE: I was able to solve this issue by deleting the var/cache/prod folder manually.

Toflar commented 5 years ago

I guess this is resolved in the meantime? At least I can use it with Flex just fine. Let me know if the issue must be reopened.

xmindsabhilash commented 2 years ago

@jdecool noted the same error for me to in symfony6.1 and the above solutions are not solved me.