本文整理汇总了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';