. */ namespace Doctrine\ORM\Mapping; /** * The default NamingStrategy * * * @link www.doctrine-project.org * @since 2.3 * @author Fabio B. Silva */ class DefaultNamingStrategy implements NamingStrategy { /** * {@inheritdoc} */ public function classToTableName($className) { if (strpos($className, '\\') !== false) { return substr($className, strrpos($className, '\\') + 1); } return $className; } /** * {@inheritdoc} */ public function propertyToColumnName($propertyName, $className = null) { return $propertyName; } /** * {@inheritdoc} */ public function referenceColumnName() { return 'id'; } /** * {@inheritdoc} */ public function joinColumnName($propertyName) { return $propertyName . '_' . $this->referenceColumnName(); } /** * {@inheritdoc} */ public function joinTableName($sourceEntity, $targetEntity, $propertyName = null) { return strtolower($this->classToTableName($sourceEntity) . '_' . $this->classToTableName($targetEntity)); } /** * {@inheritdoc} */ public function joinKeyColumnName($entityName, $referencedColumnName = null) { return strtolower($this->classToTableName($entityName) . '_' . ($referencedColumnName ?: $this->referenceColumnName())); } }