Example #1
0
 public static function getClassName($controller, $module = null)
 {
     $ns = App::getControllerNameSpace();
     if ($module) {
         $ns .= '\\' . implode('\\', array_map('Tale\\Util\\StringUtil::camelize', explode('.', $module)));
     }
     return "{$ns}\\" . StringUtil::camelize($controller) . 'Controller';
 }
Example #2
0
 public function resolveMethodName($methodName)
 {
     return sprintf($this->_methodNamePattern, strpos($this->_methodNamePattern, '%s') === 0 ? StringUtil::variablize($methodName) : StringUtil::camelize($methodName));
 }
Example #3
0
 public function getModelClassName()
 {
     $nameSpaces = $this->_database->getModelNameSpaces();
     if (empty($nameSpaces)) {
         return null;
     }
     foreach ($nameSpaces as $nameSpace) {
         $className = rtrim($nameSpace, '\\') . '\\' . StringUtil::camelize(StringUtil::singularize($this->getName()));
         if (!class_exists($className)) {
             continue;
         }
         if (!is_subclass_of($className, 'Tale\\Data\\Row')) {
             throw new \Exception("Failed to use {$className} as a model class: " . "The class needs to extend Tale\\Data\\Row");
         }
         return $className;
     }
     return null;
 }