예제 #1
0
파일: rb.php 프로젝트: tejdeeps/tejcs.com
 /**
  * Configures the facade, want to have a new Writer? A new Object Database or a new
  * Adapter and you want it on-the-fly? Use this method to hot-swap your facade with a new
  * toolbox.
  *
  * @param RedBean_ToolBox $tb toolbox
  *
  * @return RedBean_ToolBox $tb old, rusty, previously used toolbox
  */
 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);
     self::$tagManager = new RedBean_TagManager(self::$toolbox);
     self::$f = new RedBean_SQLHelper(self::$adapter);
     return $oldTools;
 }
예제 #2
0
파일: rb.php 프로젝트: abhikalotra/Samples1
 /**
  * Configures the facade, want to have a new Writer? A new Object Database or a new
  * Adapter and you want it on-the-fly? Use this method to hot-swap your facade with a new
  * toolbox.
  *
  * @param RedBean_ToolBox $tb toolbox
  *
  * @return RedBean_ToolBox
  */
 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::$finder = new RedBean_Finder(self::$toolbox);
     self::$associationManager = new RedBean_AssociationManager(self::$toolbox);
     self::$redbean->setAssociationManager(self::$associationManager);
     self::$labelMaker = new RedBean_LabelMaker(self::$toolbox);
     self::$extAssocManager = new RedBean_AssociationManager_ExtAssociationManager(self::$toolbox);
     $helper = new RedBean_ModelHelper();
     $helper->attachEventListeners(self::$redbean);
     self::$associationManager->addEventListener('delete', $helper);
     self::$duplicationManager = new RedBean_DuplicationManager(self::$toolbox);
     self::$tagManager = new RedBean_TagManager(self::$toolbox);
     self::$f = new RedBean_SQLHelper(self::$adapter);
     return $oldTools;
 }