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

Type mismatch in DoctrineConnectionFactoryFactory #1085

Closed
agluh opened this issue Aug 31, 2020 · 8 comments · Fixed by #1089
Closed

Type mismatch in DoctrineConnectionFactoryFactory #1085

agluh opened this issue Aug 31, 2020 · 8 comments · Fixed by #1089

Comments

@agluh
Copy link

agluh commented Aug 31, 2020

Hello!

Got an error while running command 'enqueue:consume':

Argument 1 passed to Enqueue\Doctrine\DoctrineConnectionFactoryFactory::__construct() must be an instance of Doctrine\Common\Persistence\ManagerRegistry, instance of Doctrine\Bundle\DoctrineBundle\Registry given, called in /var/www/test/var/cache/dev/ContainerBP8prHE/getEnqueue_Transport_Default_ConnectionFactoryService.php on line 25

How to reproduce

$ composer create-project symfony/skeleton test
$ cd test
$ composer req enqueue/enqueue-bundle symfony/orm-pack
$ php bin/console enqueue:consume
$ composer show
brick/math                           0.9.1   Arbitrary-precision arithmetic library
composer/package-versions-deprecated 1.11.99 Composer plugin that provides efficient querying for installed package versions (no runtime IO)
doctrine/annotations                 1.10.4  Docblock Annotations Parser
doctrine/cache                       1.10.2  PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache,...
doctrine/collections                 1.6.7   PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                      3.0.2   PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on suc...
doctrine/dbal                        2.10.2  Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/doctrine-bundle             2.1.2   Symfony DoctrineBundle
doctrine/doctrine-migrations-bundle  3.0.1   Symfony DoctrineMigrationsBundle
doctrine/event-manager               1.1.1   The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                   1.4.3   PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singula...
doctrine/instantiator                1.3.1   A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       1.2.1   PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                  3.0.1   PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for version...
doctrine/orm                         v2.7.3  Object-Relational-Mapper for PHP
doctrine/persistence                 2.0.0   The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mapper...
doctrine/reflection                  1.2.1   The Doctrine Reflection project is a simple library used by the various Doctrine projects which adds some additional funct...
doctrine/sql-formatter               1.1.1   a PHP SQL highlighting library
enqueue/dsn                          0.10.1  Parse DSN
enqueue/enqueue                      0.10.3  Message Queue Library
enqueue/enqueue-bundle               0.10.3  Message Queue Bundle
enqueue/null                         0.10.1  Enqueue Null transport
laminas/laminas-code                 3.4.1   Extensions to the PHP Reflection API, static code scanning, and code generation
laminas/laminas-eventmanager         3.3.0   Trigger and listen to events within a PHP application
laminas/laminas-zendframework-bridge 1.1.0   Alias legacy ZF class names to Laminas Project equivalents.
ocramius/proxy-manager               2.8.0   A library providing utilities to generate, instantiate and generally operate with Object Proxies
psr/cache                            1.0.1   Common interface for caching libraries
psr/container                        1.0.0   Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                 1.0.0   Standard interfaces for event handling.
psr/log                              1.1.3   Common interface for logging libraries
queue-interop/amqp-interop           0.8.1
queue-interop/queue-interop          0.8.0   Promoting the interoperability of MQs objects. Based on Java JMS
ramsey/collection                    1.1.0   A PHP 7.2+ library for representing and manipulating collections.
ramsey/uuid                          4.1.1   A PHP library for generating and working with universally unique identifiers (UUIDs).
symfony/cache                        v5.1.4  Symfony Cache component with PSR-6, PSR-16, and tags
symfony/cache-contracts              v2.1.3  Generic abstractions related to caching
symfony/config                       v5.1.4  Symfony Config Component
symfony/console                      v5.1.4  Symfony Console Component
symfony/dependency-injection         v5.1.4  Symfony DependencyInjection Component
symfony/deprecation-contracts        v2.1.3  A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge              v5.1.4  Symfony Doctrine Bridge
symfony/dotenv                       v5.1.4  Registers environment variables from a .env file
symfony/error-handler                v5.1.4  Symfony ErrorHandler Component
symfony/event-dispatcher             v5.1.4  Symfony EventDispatcher Component
symfony/event-dispatcher-contracts   v2.1.3  Generic abstractions related to dispatching event
symfony/filesystem                   v5.1.4  Symfony Filesystem Component
symfony/finder                       v5.1.4  Symfony Finder Component
symfony/flex                         v1.9.2  Composer plugin for Symfony
symfony/framework-bundle             v5.1.4  Symfony FrameworkBundle
symfony/http-foundation              v5.1.4  Symfony HttpFoundation Component
symfony/http-kernel                  v5.1.4  Symfony HttpKernel Component
symfony/polyfill-intl-grapheme       v1.18.1 Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-normalizer     v1.18.1 Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring            v1.18.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php73               v1.18.1 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80               v1.18.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/routing                      v5.1.4  Symfony Routing Component
symfony/service-contracts            v2.1.3  Generic abstractions related to writing services
symfony/stopwatch                    v5.1.4  Symfony Stopwatch Component
symfony/string                       v5.1.4  Symfony String component
symfony/var-dumper                   v5.1.4  Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter                 v5.1.4  A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/yaml                         v5.1.4  Symfony Yaml Component
webimpress/safe-writer               2.1.0   Tool to write files safely, to avoid race conditions
@agluh
Copy link
Author

agluh commented Aug 31, 2020

I figured out, that if in the file DoctrineConnectionFactoryFactory.php replace

use Doctrine\Common\Persistence\ManagerRegistry;

with

use Symfony\Bridge\Doctrine\ManagerRegistry;

or with

use Doctrine\Persistence\ManagerRegistry;

then error goes away.

I'm not sure which option to use though.

@Steveb-p
Copy link
Contributor

@agluh this is because this library does not strictly depend on doctrine/persistence at version 1.x. Version 2 has some classes in different namespaces as you can see, because doctrine/common was removed.

@kdefives
Copy link
Contributor

kdefives commented Sep 4, 2020

Hi @Steveb-p !

Do you know if a patch will be done soon? Or do we have to downgrade from doctrine v3 to v2?

Thx in advance.

@celosauro
Copy link

celosauro commented Sep 8, 2020

Related#1 doctrine/DoctrineBundle#1204

@celosauro
Copy link

Related#2 sroze/messenger-enqueue-transport#102

@stale
Copy link

stale bot commented Oct 10, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Oct 10, 2020
@vittore
Copy link

vittore commented Oct 13, 2020

Same error.
Workaround with #1085 (comment)

@stale stale bot removed the wontfix label Oct 13, 2020
makasim added a commit that referenced this issue Oct 14, 2020
@makasim
Copy link
Member

makasim commented Oct 16, 2020

Tagged 0.10.6 with the fix

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

Successfully merging a pull request may close this issue.

6 participants