Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Symfony 5.3: autoloader error with DoctrineTransportFactory #41727

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

Closed
craue opened this issue Jun 17, 2021 · 7 comments
Closed

Symfony 5.3: autoloader error with DoctrineTransportFactory #41727

craue opened this issue Jun 17, 2021 · 7 comments

Comments

@craue
Copy link
Contributor

craue commented Jun 17, 2021

Symfony version(s) affected: >= 5.3.0 (just tested 5.3.0, 5.3.1, 5.3.2-dev#9485292)

Description
While running tests with Symfony 5.3 I'm getting this error:
RuntimeException: The autoloader expected class "Symfony\Component\Messenger\Transport\Doctrine\DoctrineTransportFactory" to be defined in file "/home/travis/build/craue/CraueGeoBundle/vendor/composer/../symfony/symfony/src/Symfony/Component/Messenger/Transport/Doctrine/DoctrineTransportFactory.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

I'm not actively using the Messenger component.

How to reproduce
Run the test suite of that bundle with latest dependencies.

Possible Solution
I could work around the issue by removing symfony/symfony from the require-dev section in composer.json and explicitly defining the needed deps instead, but that would require further modifications to my test setup (to work with a range of Symfony versions) I'd like to avoid.

@Warxcell
Copy link
Contributor

Got something similar here: https://travis-ci.org/github/Warxcell/files/jobs/773978302

ReflectionException: Class Symfony\Component\Messenger\Bridge\Amqp\Transport\AmqpReceivedStamp does not exist

Not sure if it's connected.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jun 21, 2021

@Warxcell unrelated indeed, and already reported as #41748 and fixed by #41751

@craue you need to require symfony/doctrine-messenger, which is not "replaced" by symfony/symfony.

@craue
Copy link
Contributor Author

craue commented Jun 21, 2021

@nicolas-grekas, I'm not using the messenger. So why would I need to add it as a dependency?

@nicolas-grekas
Copy link
Member

I don't know honeslty. I just can tell you that for some reason, the test suite is trying to load this class, and that the failure can be worked around by adding this dependency...

@craue
Copy link
Contributor Author

craue commented Jun 21, 2021

This line seems to trigger loading it.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Jun 21, 2021

Thanks for investigating.
I'd suggest replacing this class_exists() check by if (!$container->getReflectionClass(the-class, false)) {.
PR welcome on DoctrineBundle

@craue
Copy link
Contributor Author

craue commented Jun 21, 2021

@nicolas-grekas, thank you. This change would indeed fix the issue.

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

Successfully merging a pull request may close this issue.

5 participants