本文整理汇总了PHP中R::getToolBox方法的典型用法代码示例。如果您正苦于以下问题:PHP R::getToolBox方法的具体用法?PHP R::getToolBox怎么用?PHP R::getToolBox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类R
的用法示例。
在下文中一共展示了R::getToolBox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
if (!\R::getDatabaseAdapter()) {
$dbConfig = (require_once __DIR__ . '/cnf.php');
static::$_host = $dbConfig['host'];
static::$_dbname = $dbConfig['dbname'];
static::$_user = $dbConfig['user'];
static::$_password = $dbConfig['password'];
\R::setup('mysql:host=' . static::$_host . ';dbname=' . static::$_dbname, static::$_user, static::$_password, true);
//for both mysql or mariaDB
}
$this->_redbeans = \R::getToolBox()->getRedBean();
$this->_rbToolbox = \R::getToolBox();
}
示例2: function
return AMFUtil::addtypeown($data, $arrTypes);
});
// public static function getLog()
R::ext('getLog', function () {
$amf = new AMFUtil();
$amf->setToolbox(R::getToolBox());
return $amf::getLog();
});
// public static function arrayCastRecursive($array)
R::ext('arrayCastRecursive', function ($array) {
return AMFUtil::arrayCastRecursive($array);
});
// public static function deleteRBrelation($beans){
R::ext('deleteRBrelation', function ($beans) {
$amf = new AMFUtil();
$amf->setToolbox(R::getToolBox());
return $amf->deleteRBrelation($beans);
});
// public static function Create_Multiple_Dynamic_Classes()
R::ext('CreateMultipleDynamicClasses', function () {
$amf = new AMFUtil();
$amf->setConnection(R::getDatabaseAdapter()->getDatabase()->getPDO());
return $amf->CreateMultipleDynamicClasses();
});
//check PDO from RB
R::ext('getConnection', function () {
$amf = new AMFUtil();
$amf->setConnection(R::getDatabaseAdapter()->getDatabase()->getPDO());
return $amf->getConnection();
});
R::ext('checkDecaredClass', function ($class) {
示例3: initDB
/**
* Initialize RedBeanPHP ORM for mysql.
* Then returns the Toolbox, for more details see:
* @link http://redbeanphp.com/api/class-RedBeanPHP.ToolBox.html
*
*
* @return RedBeanPHP/ToolBox
*/
protected static function initDB()
{
global $config;
if (!class_exists('R')) {
Load::plugin("rb");
// Loads RedBeanPHP, our ORM
}
R::setup('mysql:host=' . $config['db_host'] . ';dbname=' . $config['db_name'], $config['db_username'], $config['db_password']);
// Setup RedBeanPHP
return R::getToolBox();
// Returns RedBeanPHP's toolbox
}