我需要找到与给定文章列表具有相同作者的所有文章
这是我的自定义查找器方法:
public function findSimilar(Query $query, array $options)
{
if (empty($options['idList'])) {
throw new Exception('idList is not populated');
}
// We are given a list of article IDs
$idList = $options['idList'];
return $query->matching('Authors', function ($q) use ($idList) {
return $q->matching('Articles', function ($q2) use ($idList) {
return $q2->where(['Articles.id IN' => $idList]);
});
});
}
不幸的是,我收到以下错误消息:PDOException:SQLSTATE[42000]: Syntax error or access violation: 1066 Not unique table/alias: 'Articles'
我做错了什么?