dev-master
9999999-devDoctrine2 naming strategy incorporating class namespace into names
MIT
The Requires
- doctrine/orm >=2.3
- php >=5.3.2
The Development Requires
by Derek Lambert
orm doctrine2 namespace namingstrategy
Wallogit.com
2017 © Pedro Peláez
Doctrine2 naming strategy incorporating class namespace into names
Highly configurable Doctrine2 naming strategy incorporating class namespace into names. This class generates names in a predictable fashion, eliminating the need to take database schema into account when naming objects. This is especially useful when dealing with large hierarchical entity graphs with class name duplication., (*1)
Add the "creof/doctrine2-namespace-namingstrategy" package into your composer.json file., (*2)
To use the naming scheme a new instance will need to be created and passed to the entity manager configuration object., (*3)
Create a service in your app config and pass the service to the Doctrine entity manager:, (*4)
# Doctrine Configuration
doctrine:
orm:
naming_strategy: namespace_naming_strategy
services:
namespace_naming_strategy:
class: CrEOF\Doctrine\ORM\Mapping\NamespaceNamingStrategy
arguments:
config:
entityNamespaces:
- "Acme\Bundle\AcmeBundle"
trimAbstract: true
To use the class constants you'll need to define the service in XML or lookup the integer values in the code., (*5)
The NamespaceNamingStrategy constructor accepts an array containing one or more of the following options:, (*6)
trimAbstract - Remove "Abstract" from all class names beginning with it. Default false., (*7)
entityNamespaces - Array containing the root(s) of entity classes. These roots will be removed from generated names., (*8)
namespaceSeparator - String used to separate namespace path components when generating names. Default is "_" (underscore)., (*9)
joinColumnSeparator - String used to separate the reference column name from the property name. Default is "" (empty)., (*10)
joinTableSeparator - String used to separate entity names when generating join table names. Default is "_" (underscore)., (*11)
trimFallback - One of the two FALLBACK class constants. This setting defines the behavior when no matching namespace in entityNamespaces can be found for a class., (*12)
case - One of the three CASE class constants. This setting defines whether names are generated in mixed, lower, or upper case., (*13)
referenceColumnName - This defines the name used/concatenated when generating reference column names. Default is "id"., (*14)
joinColumnOrder - One of the two ORDER class constants. This defines whether the reference column name is prepended or appended to the entity name., (*15)
joinTableOrder - same as joinColumnOrder but for join tables., (*16)
splitCamelCase - Use in conjunction with camelCaseSeparator. When true camel cased names will be split using the separator. Default false., (*17)
camelCaseSeparator - String used to split camel cased words when splitCamelCase is true. Default is "" (empty)., (*18)
This is a work-in-progress and probably not production ready. Use at your own risk., (*19)
Doctrine2 naming strategy incorporating class namespace into names
MIT
orm doctrine2 namespace namingstrategy