0

I have run a composer update on my Symfony 4.4 project and ran into an issue that will run throughout my project.

The following line:

$this->stadiumEntity = $this->getDoctrine()->getRepository('AppBundle:Stadium')

errors with:

Class AppBundle:Stadium does not exist

When I change it to the following it works, however there is clear some BC break in either Symfony itself or more likely one of the Doctrine packages. I just can't determine which one.

$this->stadiumEntity = $this->getDoctrine()->getRepository(Stadium::class)

I thought the issue was in doctrine/persistence, however the getRepository method hasn't really changed in 3 years.

composer show | grep doctrine                        
doctrine/annotations                 1.13.2             Docblock Annotations Parser
doctrine/cache                       2.2.0              PHP Doctrine Cache library is a popular cache implementation that supports many different drivers...
doctrine/collections                 1.6.8              PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                      3.3.0              PHP Doctrine Common project is a library that provides additional functionality that other Doctri...
doctrine/data-fixtures               1.5.3              Data Fixtures for all Doctrine Object Managers
doctrine/dbal                        2.13.9             Powerful PHP database abstraction layer (DBAL) with many features for database schema introspecti...
doctrine/deprecations                v0.5.3             A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable...
doctrine/doctrine-bundle             2.6.3              Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle    3.4.2              Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle  3.0.3              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 variou...
doctrine/inflector                   2.0.4              PHP Doctrine Inflector is a small library that can perform string manipulations with regard to up...
doctrine/instantiator                1.4.1              A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                       1.2.3              PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                  3.4.2              PHP Doctrine Migrations project offer additional functionality on top of the database abstraction...
doctrine/orm                         2.12.2             Object-Relational-Mapper for PHP
doctrine/persistence                 3.0.2              The Doctrine Persistence project is a set of shared interfaces and functionality that the differe...
doctrine/sql-formatter               1.1.2              a PHP SQL highlighting library
crmpicco
  • 16,605
  • 26
  • 134
  • 210
  • 1
    This was [deprecated in Doctrine ORM 2.10](https://github.com/doctrine/orm/blob/2.12.x/UPGRADE.md#deprecated-entity-namespace-aliases), but I’m surprised you are receiving an exception instead of just a warning. You might be able to [manually register](https://stackoverflow.com/a/20354122/231316) it with `addEntityNamespace` to get it working the old way for a bit – Chris Haas Jun 03 '22 at 11:07
  • You still have an AppBundle right? You did not remove it as part of the upgrade? It would of course had been a manual process with lots of namespace changes and what not. AppBundle is still in config/bundles.php? Or do you have a very old layout with stuff under app/config? – Cerad Jun 03 '22 at 13:50

0 Answers0