/** Magic static methods (for db operations) * * @usage * * @todo * check sub classes method */ public static function __callStatic($name, $arguments) { // Call crud methods if (preg_match('/^(Select|Update|Insert|Delete|Count|Increase)([a-zA-Z0-9]+)$/', $name, $matches)) { // db_crud $crud = $matches[1]; $db_crud = 'db_' . strtolower($crud); // convert 'ClassName' to 'class_name' $table = MVC::StrUnderscore($matches[2]); // some action if ($crud == 'Select') { // todo } // add db & table arguments $args = array_merge(array(MVC::$DB, $table), $arguments); return call_user_func_array($db_crud, $args); } else { return FALSE; } }