symfony / symfony/maker-bundle

make:entity with multiple mappings fails

Open
#783 13 comments 2 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

Using bundle v. 1.26.1 with symfony 4.4

doctrine:
    dbal:
        url: '%env(resolve:DATABASE_URL)%'

        # IMPORTANT: You MUST configure your server version,
        # either here or in the DATABASE_URL env var (see .env file)
        #server_version: '13'
    orm:
        auto_generate_proxy_classes: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
        mappings:
            AppCommon:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Common/Entity'
                prefix: 'App\Common\Entity'
                alias: AppCommon
            AppApi:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Api/Entity'
                prefix: 'App\Api\Entity'
                alias: AppApi
            AppDb:
                is_bundle: false
                type: annotation
                dir: '%kernel.project_dir%/src/Db/Entity'
                prefix: 'App\Db\Entity'
                alias: AppDb

The following configuration is a valid one, but make:entity does not allow for files to be generated in those mappings, falling back to an unconfigured one which exists by default.
It creates new folders under src/ (entity and repository) for any class I type in
Something like bin/console make:entity AppDb\Something also fails.

It should generate the entity in src/Db/Entity and it just makes it in /src

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 with the make:entity command and reproduce the issue using the three Doctrine mappings shown in the report. Compare entity generation with and without an explicit AppDb\Something class name. Done means generated entity and repository files are placed in src/Db/Entity and its configured repository location rather than a default src/ directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.