Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Sep 12th, 2012  |  syntax: None  |  size: 0.78 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. namespace Seegno\Bundle\ToolkitBundle\Doctrine\ORM\Mapping;
  4.  
  5. use Doctrine\ORM\Mapping\DefaultNamingStrategy as BaseDefaultNamingStrategy;
  6. use Doctrine\Common\Util\Inflector;
  7.  
  8. class DefaultNamingStrategy extends BaseDefaultNamingStrategy
  9. {
  10.     /**
  11.      * {@inheritdoc}
  12.      */
  13.     public function classToTableName($className)
  14.     {
  15.         return Inflector::tableize(parent::classToTableName($className));
  16.     }
  17.  
  18.     /**
  19.      * {@inheritdoc}
  20.      */
  21.     public function propertyToColumnName($propertyName)
  22.     {
  23.         return Inflector::tableize(parent::propertyToColumnName($propertyName));
  24.     }
  25.  
  26.     /**
  27.      * {@inheritdoc}
  28.      */
  29.     public function joinColumnName($propertyName)
  30.     {
  31.         return Inflector::tableize($propertyName) . '_' . $this->referenceColumnName();
  32.     }
  33. }