[ERROR] Only annotation mapping is supported by make:entity after upgrading bundles
After upgrading bundles like this:
Upgrading doctrine/doctrine-bundle (2.2.3 => 2.3.0)
Upgrading doctrine/migrations (3.1.0 => 3.1.1)
Upgrading symfony/doctrine-bridge (v5.2.4 => v5.2.5)
Upgrading symfony/maker-bundle (v1.29.1 => v1.30.0)
when I try to change or add a new entity like:
php bin/console make:entity MyEntity I get error
Only annotation mapping is supported by make:entity, but the <info>App\Entity\MyEntity</info>
class uses a different format. If you would like this command to generate the properties & getter/setter
methods, add your mapping configuration, and then re-run this command with the <info>--regenerate</info>
flag.
When I have downgraded to previous version it works OK.
Same problem here:
- Upgrading doctrine/doctrine-bundle (2.2.4 => 2.3.0)
- Upgrading symfony/maker-bundle (v1.29.1 => v1.30.0)
After downgrading doctrine/doctrine-bundle to 2.2.4 maker works fine...
The getMetadataDriverImpl method returns different things in the two versions.
In v2.2.4 it returns Doctrine\Persistence\Mapping\Driver\MappingDriverChain In v2.3.0 it returns Doctrine\Bundle\DoctrineBundle\Mapping\MappingDriver
https://github.com/symfony/maker-bundle/blob/main/src/Doctrine/DoctrineHelper.php#L98-L110
Same problem with v1.30.0
Same problem with clean project:
doctrine/doctrine-bundle 2.3.0
symfony/maker-bundle 1.30.0
Work fine with doctrine/doctrine-bundle 2.2.4 and symfony/maker-bundle 1.30.0
Found problem and fix. PR 1284 in DoctrineBundle added a new MappingDriver, that adds a new step to access the MappingDriverChain from the MakeEntity command. I'm doing a PR right now.
Just pushed PR #843 to fix this issue, but will need #1304 from doctrine bundle to be merged.
Fixed now in 1.30.1 :)
I'm still having the same issue even with 1.31.0. my PHP version is 8 if that makes any difference
I can confirm that 1.30.2 has fixed the problem (PHP 7.4)
@abul-wcse Can you create a simple Symfony App that reproduces this problem?
steps to reproduce
- symfony new --dir=~/Working/personal/maker-test --no-git --full
- cd symfony-test
- Replace the App in name to Custom
- Update the PSR4 settings in composer.json
- composer dump-autoload
- create a new file in the config/package directory called maker.yaml and add
maker:
root_namespace: 'Custom'
- bin/console make:entity NewEntity
I get the following error

Here is the simple Symfony app created using the above steps @jrushlow https://github.com/abul-wcse/maker-test
Still having the same issue. v1.33.0
We still have the issue with latest symfony version and doctrine version. When using PHP 8 attributes for doctrine, we can not use the maker to add/modify entity
Same issue on 1.36 with PHP 8 attributes for doctrine.
Same issue on 1.38 with PHP 8.1 with custom root_namespace.
Problem reappeared. I have just upgraded all bundles and with version 1.38 error appears again (PHP 8.1). Tweaking a little bit with versions showed that the reason is upgrading doctrine/orm (2.11.3 => 2.12.0)
I'm using PHP 8.1 and after upgrading to 1.44 this bug reappeared for me again. Downgrading to 1.43 fixed it.
Are u using attributes for you're entity mapping?
I debugged into the error message and found out, that it uses AnnotationDriver instead of the expected AttributeDriver. Can you tell me where in my config I have to change the setting?
I'm using PHP 8.1 and after upgrading to 1.44 this bug reappeared for me again. Downgrading to 1.43 fixed it.
Thanks, works for me ! :-)