/** * Include class file as autoload * * @param string $className * @return boolean */ public static function autoload($className) { $snake = NameManager::convertToSnake($className); $parts = explode('_', $snake); if (count($parts) == 0) { return false; } $fileName = NameManager::toPhpFile($className); $included = false; foreach (self::$_autoloadDirs as $dir) { $res = false; if (defined('CURRY_PATH')) { $res = @(include_once rtrim(CURRY_PATH, '/') . '/' . $fileName); } if ($res == false) { $res = @(include_once $dir . '/' . $fileName); } if ($res == true) { $included = true; break; } } if ($included == false) { $res = @(include_once $fileName); if ($res == false) { return false; } } return true; }
/** * Overloading parent. * * If it starts with the beginning of the parameter values "selectBy", * Execute SELECT statement and return rows inforamtion * by specifying a value for the field was extracted from the subsequent part. * * If it starts with the beginning of the parameter values "findBy", * Execute SELECT statement and return single row information * by specifying a value for the field was extracted from the subsequent part. * * @return array */ public function __call($name, $args) { $snake = NameManager::convertToSnake($name); if (substr($snake, 0, 10) == 'select_by_') { $methodField = substr($snake, 10); $rows = $this->_selectByMethodName($methodField, $args); return $rows; } if (substr($snake, 0, 8) == 'find_by_') { $methodField = substr($snake, 8); $row = $this->_findByMethodName($methodField, $args); return $row; } parent::__call($name, $args); }