simplon_mysql icon indicating copy to clipboard operation
simplon_mysql copied to clipboard

Replace conditions with stripped conditions

Open angi-s opened this issue 6 years ago • 0 comments

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.

angi-s avatar Mar 01 '20 09:03 angi-s