In Yii2 I am trying to do an updateAll
command, but I cannot for the life of me find how to incorporate a JOIN
into this query.
ProjectUser::updateAll(['project_user.is_favorite' => 0],
['project_user.userID' => $methodIDs['user_id'],
'project.siteID' => $methodIDs['site_id']
])
->innerJoin('project','project.ID = project_user.projectID')
What I am trying to reach is the above, but Yii2 will ignore the join part and give an error because what remains of the query will NOT recognize the project.siteID
column. How can I get this to work?
As alternative I was thinking to just first do a findAll
, where the join would work, and update it that way. But how do you update a findAll()
result which has multiple records in it?