symfony / symfony/maker-bundle

The maker generate my repositories in wrong folder with non standard project structure

Open
#769 3 comments 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

In my directories structure is something like this:

  • My entities are located in src/Infrastructure/Doctrine/Entity
  • Repositories in src/Infrastructure/Doctrine/Repository

My config:

doctrine:
    orm:
        auto_generate_proxy_classes: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
        mappings:
            VipGetzner:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Infrastructure/Doctrine/Entity/'
                prefix: 'VipGetzner\Infrastructure\Doctrine\Entity'
                alias: VipGetzner

with php bin/console make:entity \\VipGetzner\\Infrastructure\\Doctrine\\Entity\\Foo

I have my entity generated correctly.
but the generated repository is inside src/Repository/Infrastructure/Doctrine/Entity!

The createClassNameDetails() inside the EntityClassGenerator class use always "Repository\\" as namespace prefix.

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

Start in the EntityClassGenerator class at createClassNameDetails(), then reproduce the issue with the shown make:entity command and non-standard entity and repository directories. Confirm that the generated repository path follows the configured project structure rather than adding the fixed Repository namespace in the wrong location.

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
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.