Implementing a NamingStrategy ============================== Using a naming strategy you can provide rules for automatically generating database identifiers, columns and tables names when the table/column name is not given. This feature helps reduce the verbosity of the mapping document, eliminating repetitive noise (eg: ``TABLE_``). Configuring a naming strategy ----------------------------- The default strategy used by Doctrine is quite minimal. By default the ``Doctrine\ORM\Mapping\DefaultNamingStrategy`` uses the simple class name and the attributes names to generate tables and columns You can specify a different strategy by calling ``Doctrine\ORM\Configuration#setNamingStrategy()`` : .. code-block:: php setNamingStrategy($namingStrategy); Underscore naming strategy --------------------------- ``\Doctrine\ORM\Mapping\UnderscoreNamingStrategy`` is a built-in strategy that might be a useful if you want to use a underlying convention. .. code-block:: php setNamingStrategy($namingStrategy); Then SomeEntityName will generate the table SOME_ENTITY_NAME when CASE_UPPER or some_entity_name using CASE_LOWER is given. Naming strategy interface ------------------------- The interface ``Doctrine\ORM\Mapping\NamingStrategy`` allows you to specify a "naming standard" for database tables and columns. .. code-block:: php referenceColumnName(); } public function joinTableName($sourceEntity, $targetEntity, $propertyName = null) { return strtolower($this->classToTableName($sourceEntity) . '_' . $this->classToTableName($targetEntity)); } public function joinKeyColumnName($entityName, $referencedColumnName = null) { return strtolower($this->classToTableName($entityName) . '_' . ($referencedColumnName ?: $this->referenceColumnName())); } } Configuring the namingstrategy is easy if. Just set your naming strategy calling ``Doctrine\ORM\Configuration#setNamingStrategy()`` :. .. code-block:: php setNamingStrategy($namingStrategy);