How to print ORM query
$query = $articles->find('all')->contain(['Comments']);
For example print =>
SELECT * FROM comments WHERE article_id IN (comments);
Wrapping your ORM query result with the debug function will show the SQL and bound params:
debug($query);
You can also similarly look at the query results with the debug function.See CakePHP 3: retrieving data and result sets — Debugging Queries and ResultSets