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

[ERROR] Only annotation mapping is supported by make:entity after upgrading bundles #841

Closed
thomas2411 opened this issue Mar 20, 2021 · 31 comments · Fixed by #844
Closed

Comments

@thomas2411
Copy link

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.

@cpoint-eu
Copy link

cpoint-eu commented Mar 20, 2021

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...

@connorhu
Copy link

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

@bechir
Copy link
Contributor

bechir commented Mar 21, 2021

Same problem with v1.30.0

@dcognata
Copy link

dcognata commented Mar 21, 2021

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

@Geekimo
Copy link
Contributor

Geekimo commented Mar 21, 2021

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.

@Geekimo
Copy link
Contributor

Geekimo commented Mar 21, 2021

Just pushed PR #843 to fix this issue, but will need #1304 from doctrine bundle to be merged.

@weaverryan
Copy link
Member

Fixed now in 1.30.1 :)

@abul-wcse
Copy link

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

@dsentker
Copy link

I can confirm that 1.30.2 has fixed the problem (PHP 7.4)

@jrushlow
Copy link
Collaborator

@abul-wcse Can you create a simple Symfony App that reproduces this problem?

@abul-wcse
Copy link

abul-wcse commented May 11, 2021

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

@BarelyCoded
Copy link

Still having the same issue. v1.33.0

@bastien70
Copy link

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

@reksc
Copy link

reksc commented Dec 3, 2021

Same issue on 1.36 with PHP 8 attributes for doctrine.

@planet17
Copy link

planet17 commented Mar 9, 2022

Same issue on 1.38 with PHP 8.1 with custom root_namespace.

@thomas2411
Copy link
Author

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)

@ShiNoSenshi
Copy link

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

@jrushlow
Copy link
Collaborator

Are u using attributes for you're entity mapping?

@ShiNoSenshi
Copy link

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?

@UtechtDustin
Copy link

UtechtDustin commented Jul 22, 2022

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 ! :-)

@ShiNoSenshi
Copy link

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

@ahmadsajid1989
Copy link

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

@olegrand1976
Copy link

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!

@kasteckis
Copy link

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

@hugoderre
Copy link

Same here, have to downgrade maker-bundle from 1.45 to 1.43

@RobertIacoveciuc
Copy link

RobertIacoveciuc commented Aug 14, 2022

Same here, have to downgrade maker-bundle from 1.45 to 1.43

Can Confirm.

@imajim
Copy link

imajim commented Aug 17, 2022

Same here, have to downgrade maker-bundle from 1.45 to 1.43

Can Confirm.

I confirm, it's working.

php8 composer.phar update  symfony/maker-bundle:1.43.0
Loading composer repositories with package information
Updating dependencies
Lock file operations: 0 installs, 1 update, 0 removals
  - Downgrading symfony/maker-bundle (v1.45.0 => v1.43.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
  - Downloading symfony/maker-bundle (v1.43.0)
  - Downgrading symfony/maker-bundle (v1.45.0 => v1.43.0): Extracting archive

@snipershady
Copy link

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

@imreg
Copy link

imreg commented Aug 26, 2022

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.

@NetworkDevHead
Copy link

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

@vipinbose
Copy link

Remove type: annotation from doctrine.yaml

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