maker-bundle: [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.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 13
  • Comments: 31 (4 by maintainers)

Commits related to this issue

Most upvoted comments

This issue should be reopened or new one created. 1.45 has this bug, had to downgrade to 1.43.

composer update symfony/maker-bundle:1.43.0

Fixed now in 1.30.1 😃

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)

This new version, sorry guys, but a piece of shit. Has a number of issues and causes issues in previous Entities where annotations were used. This is not a development or improvement and doesn’t give us option to annotations. But if anyone has an idea how to use annotations over entity I’d like to know and learn.

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 Screenshot 2021-05-11 at 5 07 35 pm

Here is the simple Symfony app created using the above steps @jrushlow https://github.com/abul-wcse/maker-test

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…

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

This issue comes back again on maker bundle 1.45, downgrading to 1.43 solved the issue for me

I’m using PHP 8.1 and after upgrading to 1.44 this bug reappeared for me again. Downgrading to 1.43 fixed it.

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

This issue comes back again on maker bundle 1.45, downgrading to 1.43 solved the issue for me

Hello,

Work fine for me!

Php version 8.1.8 Composer version 2.3.7 Symfony CLI version 5.4.12

I have modified :

Composer.json :

“doctrine/doctrine-bundle”: “^2.7.0” -> v2.7.0 installed “symfony/maker-bundle”: “^1.43” -> 1.45 installed ==> replaced by “symfony/maker-bundle”: “1.43”

And all is fine!

Same issue on 1.36 with PHP 8 attributes for doctrine.

Same problem with v1.30.0

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

Remove type: annotation from doctrine.yaml

It is super frustrating when Symfony breaks core tooling outside of the promised version lifecycles

the problem persists, it doesn’t work anymore with maker bundle 1.43 too

What also worked for me:

  • I removed the type: attribute in my doctrine.yaml
  • ran the rector DoctrineSetList::ANNOTATIONS_TO_ATTRIBUTES set.
  • had to update some JoinTable configs in the updated annotations.
  • now I can work with 1.44

Still having the same issue. v1.33.0

I’m still having the same issue even with 1.31.0. my PHP version is 8 if that makes any difference