instead of doing: $this->setDataSource('whatever'); you can do that: class MyModel extends AppModel { $useDbConfig = 'whatever'; //... }
On 24 mai, 17:37, shmit <[EMAIL PROTECTED]> wrote: > Because I like to answer my own questions, I found the solution to > this. > > Here's how you set up the map for your new service: > > name your file 'app/models/datasources/type_source.php' (e.g., > 'web_services_source.php') > your class name will be the StudlyCaps version of that (e.g., > 'WebServicesSource'), defined in the above file. > > Set up a map for that datasource to a name in database.php's > DATABASE_CONFIG class: > > var $whatever = array('datasource' => 'type'); (e.g.: var > $web_services => array('datasource' => 'web_services')) > > The datasource value is the name of your datasource file w/o the > '_source.php' at the end. The name of the variable ($web_services), > can be whatever you want. > > In your model, tell it to use your new data source. I did this in the > constructor with: > > $this->setDataSource('whatever'); > > Where 'whatever' is the name of your variable in the DATABASE_CONFIG > class. > > I'm probably doing that last part wrong, but it seems to work for me. > > On May 24, 11:01 am, shmit <[EMAIL PROTECTED]> wrote:> On May 23, 7:44 pm, > gwoo <[EMAIL PROTECTED]> wrote: > > > > then create a connection in database.php that can be used. > > > you could use the xml class to get the web service. > > > This is the part I'm missing. I can't for the life of me figure out > > how to get the data source loaded. The docs turn up nothing. Google > > turns up nothing, and I can't pick apart the source enough (yet) to > > figure out how to load it. > > > The only thing I've found was this comment: > > > * @param string $name The name of the DataSource, as defined in > > app/ > > config/connections > > > Of course, the file doesn't exist, and I can't even tell if its > > getting loaded at all, nor what format it's supposed to be in. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---