Weird entity naming in cli "orm:convert:mapping" #5358

Closed
opened 2026-01-22 15:05:23 +01:00 by admin · 3 comments
Owner

Originally created by @igorfialko on GitHub (Dec 21, 2016).

Originally assigned to: @Ocramius on GitHub.

Due to strtolower

in
protected function getClassNameForTable($tableName)
in
DatabaseDriver

table names from DB in camel case will be entities like "Userpasshistory"

Originally created by @igorfialko on GitHub (Dec 21, 2016). Originally assigned to: @Ocramius on GitHub. Due to strtolower in protected function getClassNameForTable($tableName) in DatabaseDriver table names from DB in camel case will be entities like "Userpasshistory"
admin added the ImprovementWon't Fix labels 2026-01-22 15:05:23 +01:00
admin closed this issue 2026-01-22 15:05:24 +01:00
Author
Owner

@Ocramius commented on GitHub (Dec 21, 2016):

That is normal when converting from snake case to StudlyCaps: seems
expected to me.

On 21 Dec 2016 2:41 p.m., "ifif14" notifications@github.com wrote:

Due to strtolower

in
protected function getClassNameForTable($tableName)
in
DatabaseDriver

table names from DB in camel case will be entities like "Userpasshistory"


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/doctrine/doctrine2/issues/6187, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJakFhmYGuwG2rFISKNNBdVKhbIaUaaks5rKSyggaJpZM4LS9RL
.

@Ocramius commented on GitHub (Dec 21, 2016): That is normal when converting from snake case to StudlyCaps: seems expected to me. On 21 Dec 2016 2:41 p.m., "ifif14" <notifications@github.com> wrote: > Due to strtolower > > in > protected function getClassNameForTable($tableName) > in > DatabaseDriver > > table names from DB in camel case will be entities like "Userpasshistory" > > — > You are receiving this because you are subscribed to this thread. > Reply to this email directly, view it on GitHub > <https://github.com/doctrine/doctrine2/issues/6187>, or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAJakFhmYGuwG2rFISKNNBdVKhbIaUaaks5rKSyggaJpZM4LS9RL> > . >
Author
Owner

@igorfialko commented on GitHub (Dec 22, 2016):

yes, table names in snake_case will be StudlyCaps, which is okay. but StudlyCase table names will be capitalized lower cases php class names. I would expect here, that table like ShopProduct will be class ShopProduct and not Shopproduct as current, since it's OOP convention.

At first I was looking at NamingStrategy to adjust this and ended up extending EntityGenerator and DatabaseDriver.
Maybe it makes sense to delegate this, alongside with column -> field conversion into NamingStrategy interface?

@igorfialko commented on GitHub (Dec 22, 2016): yes, table names in snake_case will be StudlyCaps, which is okay. but StudlyCase table names will be capitalized lower cases php class names. I would expect here, that table like ShopProduct will be class ShopProduct and not Shopproduct as current, since it's OOP convention. At first I was looking at NamingStrategy to adjust this and ended up extending EntityGenerator and DatabaseDriver. Maybe it makes sense to delegate this, alongside with column -> field conversion into NamingStrategy interface?
Author
Owner

@Ocramius commented on GitHub (Dec 23, 2016):

Seems unnecessary, when some manual tweaking on the mappings is sufficient.

Consider that mapping import operations are only to be applied once, when importing legacy schemas.

Closing as won't fix, since it is not primary focus.

@Ocramius commented on GitHub (Dec 23, 2016): Seems unnecessary, when some manual tweaking on the mappings is sufficient. Consider that mapping import operations are only to be applied once, when importing legacy schemas. Closing as `won't fix`, since it is not primary focus.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5358