当前位置: 首页>>代码示例>>PHP>>正文


PHP R::adapter方法代码示例

本文整理汇总了PHP中R::adapter方法的典型用法代码示例。如果您正苦于以下问题:PHP R::adapter方法的具体用法?PHP R::adapter怎么用?PHP R::adapter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在R的用法示例。


在下文中一共展示了R::adapter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: close

 public static function close()
 {
     // TODO - find out if there is a proper way.
     R::$toolboxes = array();
     R::$toolbox = null;
     R::$redbean = null;
     R::$writer = null;
     R::$adapter = null;
     R::$associationManager = null;
     R::$extAssocManager = null;
     R::$exporter = null;
     R::$tagManager = null;
     R::$currentDB = '';
     R::$f = null;
     self::$isSetup = false;
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:16,代码来源:RedBeanDatabase.php

示例2: configureFacadeWithToolbox

 public static function configureFacadeWithToolbox(RedBean_ToolBox $tb)
 {
     $oldTools = self::$toolbox;
     self::$toolbox = $tb;
     self::$writer = self::$toolbox->getWriter();
     self::$adapter = self::$toolbox->getDatabaseAdapter();
     self::$redbean = self::$toolbox->getRedBean();
     self::$associationManager = new RedBean_AssociationManager(self::$toolbox);
     self::$redbean->setAssociationManager(self::$associationManager);
     self::$extAssocManager = new RedBean_ExtAssociationManager(self::$toolbox);
     $helper = new RedBean_ModelHelper();
     self::$redbean->addEventListener("update", $helper);
     self::$redbean->addEventListener("open", $helper);
     self::$redbean->addEventListener("delete", $helper);
     self::$associationManager->addEventListener("delete", $helper);
     self::$redbean->addEventListener("after_delete", $helper);
     self::$redbean->addEventListener("after_update", $helper);
     self::$redbean->addEventListener("dispense", $helper);
     return $oldTools;
 }
开发者ID:bobseven,项目名称:Slim-Blog,代码行数:20,代码来源:rb.php

示例3: setup

 /**
  * Kickstarts redbean for you.
  * @param string $dsn
  * @param string $username
  * @param string $password
  */
 public static function setup($dsn = "sqlite:/tmp/red.db", $username = NULL, $password = NULL)
 {
     RedBean_Setup::kickstart($dsn, $username, $password);
     self::$toolbox = RedBean_Setup::getToolBox();
     self::$writer = self::$toolbox->getWriter();
     self::$adapter = self::$toolbox->getDatabaseAdapter();
     self::$redbean = self::$toolbox->getRedBean();
     self::$associationManager = new RedBean_AssociationManager(self::$toolbox);
     self::$treeManager = new RedBean_TreeManager(self::$toolbox);
     self::$linkManager = new RedBean_LinkManager(self::$toolbox);
     self::$extAssocManager = new RedBean_ExtAssociationManager(self::$toolbox);
     $helper = new RedBean_ModelHelper();
     self::$redbean->addEventListener("update", $helper);
     self::$redbean->addEventListener("open", $helper);
     self::$redbean->addEventListener("delete", $helper);
 }
开发者ID:nev3rm0re,项目名称:hondex,代码行数:22,代码来源:rb127lg.php

示例4: testTransactionInFacade

 /**
  * Test Facade transactions.
  * 
  * @return void
  * 
  * @throws Exception
  */
 public function testTransactionInFacade()
 {
     testpack('Test transaction in facade');
     $bean = R::dispense('bean');
     $bean->name = 'a';
     R::store($bean);
     R::trash($bean);
     R::freeze(TRUE);
     $bean = R::dispense('bean');
     $bean->name = 'a';
     R::store($bean);
     asrt(R::count('bean'), 1);
     R::trash($bean);
     asrt(R::count('bean'), 0);
     $bean = R::dispense('bean');
     $bean->name = 'a';
     $id = R::transaction(function () use(&$bean) {
         return R::transaction(function () use(&$bean) {
             return R::store($bean);
         });
     });
     asrt((int) $id, (int) $bean->id);
     R::trash($bean);
     $bean = R::dispense('bean');
     $bean->name = 'a';
     $id = R::transaction(function () use(&$bean) {
         return R::store($bean);
     });
     asrt((int) $id, (int) $bean->id);
     R::trash($bean);
     $bean = R::dispense('bean');
     $bean->name = 'a';
     try {
         R::transaction(function () use($bean) {
             R::store($bean);
             R::transaction(function () {
                 throw new Exception();
             });
         });
     } catch (Exception $e) {
         pass();
     }
     asrt(R::count('bean'), 0);
     $bean = R::dispense('bean');
     $bean->name = 'a';
     try {
         R::transaction(function () use($bean) {
             R::transaction(function () use($bean) {
                 R::store($bean);
                 throw new Exception();
             });
         });
     } catch (Exception $e) {
         pass();
     }
     asrt(R::count('bean'), 0);
     $bean = R::dispense('bean');
     $bean->name = 'a';
     try {
         R::transaction(function () use($bean) {
             R::transaction(function () use($bean) {
                 R::store($bean);
             });
         });
     } catch (Exception $e) {
         pass();
     }
     asrt(R::count('bean'), 1);
     R::freeze(FALSE);
     try {
         R::transaction('nope');
         fail();
     } catch (Exception $e) {
         pass();
     }
     testpack('Test Camelcase 2 underscore');
     $names = array('oneACLRoute' => 'one_acl_route', 'ALLUPPERCASE' => 'alluppercase', 'clientServerArchitecture' => 'client_server_architecture', 'camelCase' => 'camel_case', 'peer2peer' => 'peer2peer', 'fromUs4You' => 'from_us4_you', 'lowercase' => 'lowercase', 'a1A2b' => 'a1a2b');
     $bean = R::dispense('bean');
     foreach ($names as $name => $becomes) {
         $bean->{$name} = 1;
         asrt(isset($bean->{$becomes}), TRUE);
     }
     testpack('Test debugger check.');
     $old = R::$adapter;
     R::$adapter = NULL;
     try {
         R::debug(TRUE);
         fail();
     } catch (RedBean_Exception_Security $e) {
         pass();
     }
     R::$adapter = $old;
     R::debug(FALSE);
//.........这里部分代码省略.........
开发者ID:daviddeutsch,项目名称:redbean-adaptive,代码行数:101,代码来源:Misc.php


注:本文中的R::adapter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。