symfony / symfony/maker-bundle

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

Open
#302 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.4k
Forks
427
Avg merge
2d 22h
Merged PRs (30d)
20

Description

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with AppBundle/Resources/config/doctrine/User.orm.yml, AppBundle/Entity/User.php, and bin/console make:entity --regenerate. Compare the generated child entity with the deprecated doctrine:generate:entities behavior and inspect how inherited fields are handled. Done means regeneration no longer adds parent fields or produces the access-level compile error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
backend, database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.