Example #1
0
 /**
  * Return the table name for a class name including the alias the assigned covention
  * handler is used to get the table name
  *
  * @param string $className [<Classname>|<Classname> <alias>]
  * @return string table name blank alias name
  */
 protected static function tableName($className)
 {
     $classParts = explode(' ', is_object($className) ? get_class($className) : $className);
     $alias = null;
     $class = $classParts[0];
     if (count($classParts) > 1) {
         $alias = $classParts[1];
     }
     $tmp = explode('\\', $class);
     $className = end($tmp);
     $table = null;
     if (class_exists($class) && property_exists($class, '__table')) {
         $table = ObjectProperty::getFromClass('__table', $class);
     }
     $result = static::$conventionHandler[static::$activeConnection]->tableName($className, $table);
     if ($alias) {
         $tableParts = explode(' ', $result);
         $result = $tableParts[0] . ' ' . $alias;
     }
     return $result;
 }