Welcome Guest, Not a member yet? Register   Sign In
DBPrefix causing double prefixes
#1

I use version 4.4.7, but the same problem occurs in version 4.5.2. And database is postgres
When I set the environment variable database.default.DBPrefix = foo.
if I call the model repeatedly (like foreach), the 'from' clause in the SQL statement will show double prefixes.

PHP Code:
$tutorModel model(TutorModel::class);

foreach (
$result as $key => $value) {

     $result[$key]->tutors $tutorModel->select("name")
                                      ->join('course_tutors','course_tutors.tutor_id=tutors.id')
                                      ->where('course_id',$value->course_id)
                                      ->orderBy('order','asc')
                                      ->findAll();


And it will return server error because  cross-database references are not implemented: "select name from foo.foo.tutors where..."

Is there a workaround?
Reply




Theme © iAndrew 2016 - Forum software by © MyBB