Pregunta

I need to get the redbean instacne and pass it to the model functions that I need to. This document says a way of doing it.

$toolbox = RedBean_Setup::kickstart('mysql:host=localhost;dbname=demo','root','');
$redbean = $toolbox->getRedBean();

But it dose not work. It gives me error

Fatal error: Call to a member function getRedBean() on a non-object in ...

I can see the method is there. How could I achive this ?

¿Fue útil?

Solución

I found the solution after little digging of source. It can be get in following way. It seams this should be added to the RedBean document.

R::setup('mysql:host=localhost;dbname=t2odemo','root','');
$toolbox = R::$toolbox;
$redbean = $toolbox->getRedBean();

Otros consejos

If someone is still out there trying to get the redBean instance, this works for me (version 4.3.2):

R::setup(...credentials stuff);
$redBean = R::getToolBox();
$rbInstance = $redBean->getDatabaseAdapter();
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top