Details
-
Type:
New Feature
-
Status:
Resolved
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: 2.0-BETA1
-
Fix Version/s: 2.3
-
Component/s: Mapping Drivers
-
Security Level: All
-
Labels:None
Description
With the annotation mapping driver, table names default to the same as the class name, and table columns default to the same name as the field (class property) name.
/** @Entity */
class MyEntity // db table will by default be "MyEntity"
{
// ...
/**
* @Column(type="string")
*/
protected $myProperty; // defaults to table column "myProperty"
}
It would be great if we could override this behavior by passing in a custom inflector. So for example you could default all camelCase fields to be underscore_separated as column names in the database without needing to manually specify this in the annotations.
I think Hibernate, for example, has naming strategies for this and you can implement your own custom NamingStrategy that implements a specific (default) naming convention. Maybe we want a similar approach.