samples/PhotoAlbum/lib/rb.php
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_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;
	}
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_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;
	}
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_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 ; }
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
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 .