How can i filter level3 table by level1 field?


#1
 $query = $articles->find()->contain([
            'Comments' => [
                'Authors' => [
                    'Profiles' => function ($q) {
                        return $q->where(['Profiles.author_id' => 'Authors.id', 'Profiles.field' => 'Articles.field']);
                    }
                ]
            ]
     ]);

#2

Matching?

https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#filtering-by-associated-data-via-matching-and-joins