The manual for RedBean suggests a method for integrating the ORM into Zend Framework.
From the manual:-
open your Zend bootstrap file and add:
public function run() { $loader = Zend_Loader_Autoloader::getInstance()->registerNamespace("RedBean_"); require_once( APPLICATION_PATH . "/../library/RedBean/redbean.inc.php"); //or rb.php R::setup( "mysql:host=localhost;dbname=timereg", "root" ); Zend_Registry::set("tools", R::$toolbox); Zend_Registry::set("db", R::$adapter); Zend_Registry::set("redbean", R::$redbean); parent::run(); }
This method does not strike me as being the most efficient as the ORM is being set up in every controller, whether it is needed or not. It is also using Zend_Registry which I don't like.
There are also certain features of RedBean that need integrating properly and that may benefit from configuration via application.ini:-
- Set as frozen/fluid
- Set location of models for Fuse to allow custom models to work.
- Setup the connection to the RDBMS
- Set Debug mode.
How can RedBean ORM be integrated into the Zend Framework in a more efficient Zend like manner?