Use table prefix with reverse enginering didn't works #6395

Open
opened 2026-01-22 15:32:23 +01:00 by admin · 0 comments
Owner

Originally created by @julienheroux on GitHub (Jan 31, 2020).

Bug Report

Q A
BC Break no
Version 2.x

Summary

Doctrine revers enginering don't work with tablePrefix ([https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/sql-table-prefixes.html])

Current behavior

If i defined a table prefixe or suffix , and try a reverse enginering, the entity are not generated correctly.

for exemple a table name pfx_article the generated article entity will be named PfxArticle
and the entity annotation will look like this

/**
 * PfxArticle
 *
 * @ORM\Table(name="PFX_PFX_ARTICLE",......
 * @ORM\Entity
 */

How to reproduce

Create a tablePrefix ([https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/sql-table-prefixes.html])
Generate entity from schema (bin/console doctrine:mapping:import "App\Entity" annotation --path=src/Entity)
open your entity class you will see the problem in the annotation

Expected behavior

I think that normally the article entity should be name Article and the entity annotation will look like this

/**
 * Article
 *
 * @ORM\Table(name="PFX_ARTICLE",......
 * @ORM\Entity
 */
Originally created by @julienheroux on GitHub (Jan 31, 2020). ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | no | Version | 2.x #### Summary <!-- Provide a summary describing the problem you are experiencing. --> Doctrine revers enginering don't work with tablePrefix ([https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/sql-table-prefixes.html]) #### Current behavior <!-- What is the current (buggy) behavior? --> If i defined a table prefixe or suffix , and try a reverse enginering, the entity are not generated correctly. for exemple a table name pfx_article the generated article entity will be named PfxArticle and the entity annotation will look like this ``` /** * PfxArticle * * @ORM\Table(name="PFX_PFX_ARTICLE",...... * @ORM\Entity */ ``` #### How to reproduce <!-- Provide steps to reproduce the bug. If possible, also add a code snippet with relevant configuration, entity mappings, DQL etc. Adding a failing Unit or Functional Test would help us a lot - you can submit one in a Pull Request separately, referencing this bug report. --> Create a tablePrefix ([https://www.doctrine-project.org/projects/doctrine-orm/en/2.6/cookbook/sql-table-prefixes.html]) Generate entity from schema (bin/console doctrine:mapping:import "App\Entity" annotation --path=src/Entity) open your entity class you will see the problem in the annotation #### Expected behavior <!-- What was the expected (correct) behavior? --> I think that normally the article entity should be name Article and the entity annotation will look like this ``` /** * Article * * @ORM\Table(name="PFX_ARTICLE",...... * @ORM\Entity */ ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6395