hasMany('articles'); } public function findByAuthor(Query $query, array $options = []) { if (isset($options['author_id'])) { $query->where(['Articles.id' => $options['author_id']]); } return $query; } }