本文整理匯總了PHP中RedBeanPHP\R::setAutoResolve方法的典型用法代碼示例。如果您正苦於以下問題:PHP R::setAutoResolve方法的具體用法?PHP R::setAutoResolve怎麽用?PHP R::setAutoResolve使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RedBeanPHP\R
的用法示例。
在下文中一共展示了R::setAutoResolve方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: register
public function register(Container $c)
{
$settings = $c["settings"];
$options = ['dsn' => null, 'username' => null, 'password' => null, 'frozen' => false];
if (isset($settings["redbean.setup"])) {
$options = array_merge($options, $settings["redbean.setup"]);
}
$c["redbean"] = R::setup($options["dns"], $options["username"], $options["password"], $options["frozen"]);
$c["redbean.helper"] = new \CodePasha\RedBean\Support\RedBeanHelper();
R::getRedBean()->setBeanHelper($c["redbean.helper"]);
R::setAutoResolve(true);
}
示例2: setDb
/**
* @param $name
* @return mixed
*/
public function setDb($name)
{
$this->options = $this->db[$name];
R::setAutoResolve(TRUE);
R::selectDatabase($name);
R::ext('xdispense', function ($type) {
return R::getRedBean()->dispense($type);
});
if ($this->cache) {
R::useWriterCache(true);
R::freeze(TRUE);
}
return $name;
}
示例3: exceptionHandler
require_once 'helpers.php';
// Must come after $jsonResponse exists.
// Catch Exception if connection to DB failed
function exceptionHandler($exception)
{
global $jsonResponse;
header('Content-Type: application/json');
http_response_code(503);
$jsonResponse->message = 'API Error.';
$jsonResponse->data = $exception->getMessage();
$jsonResponse->trace = $exception->getTrace();
echo $jsonResponse->asJson();
}
set_exception_handler('exceptionHandler');
R::setup('sqlite:' . __DIR__ . '/taskboard.db');
R::setAutoResolve(TRUE);
createInitialUser();
$app->notFound(function () use($app, $jsonResponse) {
$app->response->setStatus(404);
$jsonResponse->message = 'Matching API call Not found.';
$app->response->setBody($jsonResponse->asJson());
});
$app->get('/authenticate', function () use($app, $jsonResponse) {
if (validateToken()) {
$jsonResponse->message = 'Token is authenticated.';
}
$app->response->setBody($jsonResponse->asJson());
});
require_once 'mailFactory.php';
require_once 'userRoutes.php';
require_once 'boardRoutes.php';