Is this something you can define at the database level rather than at the application level? If I were designing an application I would try and present a coherent and consistent view of the data to the application layer. I'd have to ask you why you have invoices stored in different databases according to country?
On Aug 24, 10:19 am, Marco Pietschmann <[email protected]> wrote: > Hi, > > got the following problem. > > Need to combine several tables from different datasources that are > associated to each other. So far so good. > > But I've got the following problem: > The data retreived from the default database defines which datasource > should be used. > > Example: > > Project belongsTo Customer belongsTo Address belongsTo Country > Project hasMany Invoices > > The Invoices are stored in different databases depending on the > Customers country. > > I tried different things with changing the datasource of the invoice > model, but since I set it with beforeFind the change only effects the > next query, not the current one and I had to start additional queries. > > Since also a list of projects on one view is needed I need a solution > that changes the datasource easily during runtime, not only once at > the beginning of the lifecycle. I need a possibility to change the > models datasource after loading the default data and before the data > of the associated model is loaded. > > Any ideas? > > Thanks a lot, > Marco --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
