I'm working on a cakePHP3 project which does have 3 different datascources. I have one main model, called application, which should have two hasOne()
associations to two models with a different datascource as Model Application. I have created the two models and pointed the two Model Tables to their datascources with defaultConnectionName()
.
Now I added two hasOne()
relations to my ApplicationsTable object and recieve an sql error, when trying to Applications->get()
. This is clear as in the SQL Statement their isn't any stating of a datasource on the FROM and JOIN part, like SELECT * FROM datasource1.myTable
I had a look into the cakephp framework ORM/Query class and the Query object only seems to have one datasource connection as a class attribute.
Is there a way to use different datascources in data retrieval using cake ORM or should I just use a custom query here?
Thanks in advance!
See Question&Answers more detail:os