On Thu, Jul 8, 2010 at 10:57 AM, Melanie Sommer
<[email protected]> wrote:
> Hello,
>
> is there a way to access the database configuration that is saved in
> core/database.php form a behaviour?
>
> Background: I would like to get some information from the database in
> a behaviour. Unfortunately the database table does not belong to the
> current model and loading the model using ClassRegistry::init() does
> only work in my local installation but not on my webspace - not enough
> memory.
> Accessing the database directly using plain php works fine, but I
> would like to get the database information directly from the
> respective cake file.

Assuming the model was passed in to the behavior's method as $Model:

$ds = $Model->getDataSource();

This will return a DataSource object. See:
http://api.cakephp.org/class/data-source

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to