symfony / maker-bundle

Symfony Maker Bundle
https://symfony.com/
MIT License
3.35k stars 406 forks source link

make:entity --regenerate includes fields from parent class, with wrong acces level #302

Open franbenz opened 5 years ago

franbenz commented 5 years ago

I'm extending my own User class from FOS\UserBundle\Model\User. I'm using src/AppBundle/Resources/config/doctrine/User.orm.yml for mappings. When I regenerate the entity with bin/console make:entity --regenerate in my file AppBundle/Entity/User.php new getters and setters for fields like email and group appear(These two fields belong to the parent class).

If I make new changes to my entity in the yml mapping and execute bin/console make:entity --regenerate I get the following error:

Fatal Compile Error: Access level to AppBundle\Entity\User::$email must be protected (as in class FOS\UserBundle\Model\User) or weaker

When I used bin/console doctrine:generate:entities, which is now deprecated, parent fields weren't mentioned in child classes. Could you help me?

stof commented 5 years ago

I don't think make:entity --regenerate was implemented with inheritance in mind, and so it might fail to detect that the method is there in the parent class.