cakephp3-soft-delete
cakephp3-soft-delete copied to clipboard
Matching query clauses use wrong alias
I have a Users table and a UserLoginCredentials table. A User hasMany LoginCredentials, and in that association the targetTable has manually been set to the UserLoginCredentials table.
If I now create a query with a matching clause, the following SQL is generated and will (of course) not properly execute.
SELECT [a lot of selects] FROM users Users INNER JOIN user_login_credentials LoginCredentials ON (LoginCredentials.identifier = :c0 AND Users.id = (LoginCredentials.user_id) AND UserLoginCredentials.deleted IS NULL) WHERE Users.deleted IS NULL LIMIT 1
I have checked the code and could not easily find something to fix this, but I find it curious that the original query object has the correct repository name (LoginCredentials
) while this name is not present in the triggerBeforeFind
function in which the deleted statement is added.
Perhaps something to fix in the future.