Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic join for belongsTo association with cross databases not work #5058

Closed
ericj opened this issue Nov 3, 2014 · 2 comments
Closed
Milestone

Comments

@ericj
Copy link

ericj commented Nov 3, 2014

In cakephp 2.2.x, we can have automatic join work for cross databases with a simple patch:

"lib/Model/Datasource/DboSource.php function read()
if ($model->useDbConfig === $linkModel->useDbConfig) {
...

to
if ($model->useDbConfig === $linkModel->useDbConfig || $type=='belongsTo') {
...

But in recent 2.5.x, the read function seems have some changes,
I was wondering how to make the cross database auto join for belongsTo ?

@markstory
Copy link
Member

We can't always do cross db joins as the dbs could be on different servers or database server types.

@markstory markstory added this to the 2.5.6 milestone Nov 3, 2014
@lorenzo
Copy link
Member

lorenzo commented Nov 5, 2014

The misunderstanding was solved in IRC by talking to @ericj. Cake will not inspect into datasource configurations for resolving possible joins. You need to either use the same datasource or set the table name correctly to include the database name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants