Login | Register
My pages Projects Community openCollabNet

Discussions > dev > Peer::DATABASE_NAME > Reply to message

Reply to message

* = Required fields
* Subject
* Body
Send reply to
Author (directly in email)
Please type the letters in the image above.

Original message

Author Robert Bruce <rob@thirddimensiondesign.co.uk>
Full name Robert Bruce <rob@thirddimensiondesign.co.uk>
Date 2007-04-03 15:34:34 PDT
Message I recently came up against something that was causing a problem, I may
have been doing this incorrectly, so please correct me if that's the case.

I want to reuse the generated classes for multiple databases, so
effectively they exist as part of a shared library for instances of my
application. However because the DATABASE_NAME constant in the Peer
classes is set to the name of the database against which they were
originally built, I can't (to my knowledge) dynamically use a different

I have created a static method getDatabaseName which reads the
Propel::getConfiguration, then have gone through all the code in the
engine/builder/om/php5 replacing ::DATABASE_NAME with
::getDatabaseName(). Everything seems to be working fine now, but is
there another way I could have done this?