Why doesn't this work?
I want to display files which are
it doesn't display me anything for which the user that created it, it is supposed to show a file that is within those conditions
it seems like I have a problem within the 'Files.user_id !=' => $auth->user_id
but I can't figure out what is wrong with it
$filesTable->find('all')->where(['available' => 0,'Privacy.privacy_id' => 1,'Files.user_id !=' => $auth->user_id])->contain(['Users','Privacy'])->toArray();
Neither of these are being displayed click here
To include null
IDs in your query, you need to match on that explicitly:
$filesTable->find('all')->where([
'available' => 0,
'Privacy.privacy_id' => 1,
'OR' => [
'Files.user_id !=' => $auth->user_id,
'Files.user_id IS' => null,
],
])->contain(['Users','Privacy'])->toArray();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.