You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
foreign_field is user_id, and suppose user_id is 2. When you add new record, $join->id is set to lastInsertID:
$this->id = $insert->connection->lastInsertID();
so it holds the value of contact.id, let's say it's 1 for our new record. If you execute delete after, the where() clause can cause deletion of incorrect record:
$delete->where($this->foreign_field, $this->id);
which would render to "where user_id = 1".
create failing test-case for this bug
implement a fix
The text was updated successfully, but these errors were encountered:
It appears that the use of $join->id in reveres join is incorrect.
Look at this file: https://github.com/atk4/data/blob/develop/src/Join_SQL.php#L211
With reverse join you are joining like this:
foreign_field
is user_id, and suppose user_id is 2. When you add new record, $join->id is set to lastInsertID:so it holds the value of contact.id, let's say it's 1 for our new record. If you execute delete after, the where() clause can cause deletion of incorrect record:
which would render to "where user_id = 1".
The text was updated successfully, but these errors were encountered: