CodeIgniter-MY_Model icon indicating copy to clipboard operation
CodeIgniter-MY_Model copied to clipboard

Unable to pull multiple with=>relation for some joined table?

Open ryan1978 opened this issue 7 years ago • 0 comments

I have 4 tables... vehicles, service_logs, items, receipts I want to pull a vehicle along with all it's service logs and all of the service log's items and receipts. A vehicle has many service logs. A service log has a many receipts and many items.

$this->vehicle->with_service_logs([ 'with' => [ 'relation' => 'items' ] ])->get(1)

The above works fine but I still need to get the receipts related to the service_log too. How do I do that? I tried setting 'relation' to an array of relationship names but that didn't work. Is there a way to do that?

ryan1978 avatar Jul 30 '17 03:07 ryan1978