jamierumbelow/codeigniter-base-model

Mandatory relationship

Closed this issue · 1 comments

Hello, i wonder if there is any method to do a mandatory relationship as an inner join?

Example:
$return =$this->photo_model->with('user')->get_all();

Photo belongs to user, but if the user does not exists that entry in the array $return must be empty.

Thank you.

@jeffersonlicet Relation != inner join
you can add something "where exists" condition in before_get observer to take only photos belongs to existing users