There are tables:
orders:
id
author_id
consumer_id
supplier_id
manager_id
status_id
created
orders_archive
id,
order_id,
user_id,
created
That is, there are orders, any user can mark the order archive (customer, manager ..)
We need to get all the records that are created by the current user, and which are thus added to / have been added to the archive (the same user)
$orders = ORM::factory('Order')
->where('author_id', '=', $this->user->id)
->and_where(?)
How to insert a sub-query? Do I understand correctly that you want to use DB::expr()
? How?