Search added databases

9 views
Skip to first unread message

Nicholas Mannie

unread,
Oct 16, 2015, 2:21:23 PM10/16/15
to redbeanphp
Hi

I have a web application that has many databases. If a user accesses a certain plugin, it will reference a different database.
Is there a way that I can search all the databases that has been added to RedBeanPHP database list.
This way I can check if the database connection exists in the list before trying to add the same key to the list.
Or is there a different way of doing this.

I hope this makes sense.

Regards

Nicholas

gabor

unread,
Oct 17, 2015, 9:07:43 AM10/17/15
to redbeanphp

Hi,

You can use the toolboxes array if you want:

R
::setup();
R
::addDatabase('a', 'sqlite:/tmp/db_a.sql');
R
::addDatabase('b', 'sqlite:/tmp/db_b.sql');
var_dump
(isset(R::$toolboxes['a']));
var_dump
(isset(R::$toolboxes['c']));

It's public.

cheers
Gabor
Reply all
Reply to author
Forward
0 new messages