symfony / symfony/maker-bundle

[make:entity] Error when linking a relation property with FQCN using command.

Open
#983 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

Normally we are using App\Entity namespace and folder in Symfony and the maker command can easily detect that.

But when i'm using a subfolder such as App\Entity\Product, it lose the auto detect/auto complete from the command (i think it is fine? Not sure though). And it is broken when i try to link a relation property using FQCN.

Example, linking a OneToOne relation using FQCN will lead to error:

Compile Error: Cannot declare class App\Entity\Product\Product, because the name is already in use

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 the make:entity command by placing an entity under the App\Entity\Product namespace and linking a OneToOne relation using its FQCN. Inspect the entity-generation path and verify that the command no longer declares App\Entity\Product\Product twice and completes the relation generation successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.