/** * @return stdClass * * Returns a stdClass object with: * stdClass->error (an error array for each config name; empty if no errors) * stdClass->data (an MDO object with the fetched data) * */ public function request() { $obj = MDO::instance(); $err = array(); foreach ($this->defaults as $config) { $name = $config[0]; $default = $config[1]; $request = isset($config[2]) ? $config[2] : "clean"; $validate = isset($config[3]) ? $config[3] : null; $value = MRequest::_($request, $name, $default); if ($validate) { $valid = MValidate::_($validate, $value); if (!$valid) { $err[$name] = MText::_("validate_" . $validate); } } $obj->set($name, $value); } //EOF foreach $return = new stdClass(); $return->error = $err; $return->data = $obj; return $return; }