UnderscoreNamingStrategy
in package
implements
NamingStrategy
Naming strategy implementing the underscore naming convention.
Converts 'MyEntity' to 'my_entity' or 'MY_ENTITY'.
Tags
Table of Contents
Interfaces
- NamingStrategy
- A set of rules for determining the physical column and table names
Constants
- DEFAULT_PATTERN = '/(?<=[a-z])([A-Z])/'
- NUMBER_AWARE_PATTERN = '/(?<=[a-z0-9])([A-Z])/'
Properties
Methods
- __construct() : mixed
- Underscore naming strategy construct.
- classToTableName() : string
- Returns a table name for an entity class.
- embeddedFieldToColumnName() : string
- Returns a column name for an embedded property.
- getCase() : int
- joinColumnName() : string
- Returns a join column name for a property.
- joinKeyColumnName() : string
- Returns the foreign key column name for the given parameters.
- joinTableName() : string
- Returns a join table name.
- propertyToColumnName() : string
- Returns a column name for a property.
- referenceColumnName() : string
- Returns the default reference column name.
- setCase() : void
- Sets string case CASE_LOWER | CASE_UPPER.
- underscore() : string
Constants
DEFAULT_PATTERN
private
mixed
DEFAULT_PATTERN
= '/(?<=[a-z])([A-Z])/'
NUMBER_AWARE_PATTERN
private
mixed
NUMBER_AWARE_PATTERN
= '/(?<=[a-z0-9])([A-Z])/'
Properties
$case
private
int
$case
$pattern
private
string
$pattern
Methods
__construct()
Underscore naming strategy construct.
public
__construct([int $case = CASE_LOWER ][, bool $numberAware = false ]) : mixed
Parameters
- $case : int = CASE_LOWER
-
CASE_LOWER | CASE_UPPER
- $numberAware : bool = false
classToTableName()
Returns a table name for an entity class.
public
classToTableName(mixed $className) : string
Parameters
- $className : mixed
Return values
string —A table name.
embeddedFieldToColumnName()
Returns a column name for an embedded property.
public
embeddedFieldToColumnName(mixed $propertyName, mixed $embeddedColumnName[, mixed $className = null ][, mixed $embeddedClassName = null ]) : string
Parameters
- $propertyName : mixed
- $embeddedColumnName : mixed
- $className : mixed = null
- $embeddedClassName : mixed = null
Return values
stringgetCase()
public
getCase() : int
Return values
int —CASE_LOWER | CASE_UPPER
joinColumnName()
Returns a join column name for a property.
public
joinColumnName(string $propertyName[, class-string $className = null ]) : string
Parameters
- $propertyName : string
- $className : class-string = null
Return values
string —A join column name.
joinKeyColumnName()
Returns the foreign key column name for the given parameters.
public
joinKeyColumnName(mixed $entityName[, mixed $referencedColumnName = null ]) : string
Parameters
- $entityName : mixed
-
An entity.
- $referencedColumnName : mixed = null
-
A property name or null in case of a self-referencing entity with join columns defined in the mapping
Return values
string —A join column name.
joinTableName()
Returns a join table name.
public
joinTableName(mixed $sourceEntity, mixed $targetEntity[, mixed $propertyName = null ]) : string
Parameters
- $sourceEntity : mixed
-
The source entity.
- $targetEntity : mixed
-
The target entity.
- $propertyName : mixed = null
-
A property name.
Return values
string —A join table name.
propertyToColumnName()
Returns a column name for a property.
public
propertyToColumnName(mixed $propertyName[, mixed $className = null ]) : string
Parameters
- $propertyName : mixed
-
A property name.
- $className : mixed = null
-
The fully-qualified class name.
Return values
string —A column name.
referenceColumnName()
Returns the default reference column name.
public
referenceColumnName() : string
Return values
string —A column name.
setCase()
Sets string case CASE_LOWER | CASE_UPPER.
public
setCase(int $case) : void
Alphabetic characters converted to lowercase or uppercase.
Parameters
- $case : int
underscore()
private
underscore(string $string) : string
Parameters
- $string : string