Conditional Associations

I have my query as:

$result = $this->Auctions->find()
->contain([‘Notifications’=>[‘Plotauctions’=>[‘Plots’,‘Bidders’=>[‘Registrations’]]]])
->where([‘Auctions.id’ => 1])->all();

I want to set conditions on bidder association that it should have max(amount) group by user id

You can pass conditions to contain().

https://book.cakephp.org/3/en/orm/retrieving-data-and-resultsets.html#passing-conditions-to-contain