The Database component should support raw statements for multiple methods, example the where-method.
We use the where-method like this:
$db->table('table')->where('column', 'operator', 'value')->get();
However it needs support for adding raw statements like this:
$db->table('table')->whereRaw("strftime('%Y', `created_at`) = ?", ['2016'])->get();
$db->table('table')->where($db->raw("(SELECT count(id) FROM user_groups WHERE users.id = user_groups.user_id"), '>', 1)->get();
That is my idea on how this should work.
The functions that might require usage of raw statements: