simplon_mysql
simplon_mysql copied to clipboard
Replace conditions with stripped conditions
When using joins in the readQueryBuilder in the format table.column there's always an exception because both of the initial conditions and stripped conditions are passed to PDO.
This query
$readQueryBuilder = (new ReadQueryBuilder)
->addSelect('users.*')
->addSelect(profiles.nickname as user_nickname')
->addCondition('users.id', $userId)
->addInnerJoin('profiles', 'profiles', 'users.id = profiles.user_id');
will generate the following conditions:
[
{ "users.id": "35140057-a2a4-5adb-a500-46f8ed8b66a9" },
{ "usersid": "35140057-a2a4-5adb-a500-46f8ed8b66a9" }
]
which will throw an exception.