2017 © Pedro Peláez
 

library doctrine2-namespace-namingstrategy

Doctrine2 naming strategy incorporating class namespace into names

image

creof/doctrine2-namespace-namingstrategy

Doctrine2 naming strategy incorporating class namespace into names

  • Thursday, November 7, 2013
  • by djlambert
  • Repository
  • 1 Watchers
  • 1 Stars
  • 15 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

doctrine2-namespace-namingstrategy

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)

Installion

composer

Add the "creof/doctrine2-namespace-namingstrategy" package into your composer.json file., (*2)

Other

Usage

Doctrine

To use the naming scheme a new instance will need to be created and passed to the entity manager configuration object., (*3)

Symfony

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)

Configuration

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)

Caveats

This is a work-in-progress and probably not production ready. Use at your own risk., (*19)

The Versions

07/11 2013

dev-master

9999999-dev

Doctrine2 naming strategy incorporating class namespace into names

  Sources   Download

MIT

The Requires

 

The Development Requires

by Derek Lambert

orm doctrine2 namespace namingstrategy