Hello.
I want to return all objects which has at least one related object, before I paginate it. I know that I can create my "find" method, but I'm pretty sure there is functionality like this already in Phalcon.
I've got 2 models:
- Companies (hasMany Workers)
- Workers (belongsTo Companies)
And got this code:
$companies_before = Companies::find( [ 'order' => 'slug ASC' ] );
I would like to make it like this:
$companies_before = Companies::find( [ 'order' => 'slug ASC' 'conditions' => Company->Workers->count() is more than 0 ] );
Is there "one-line" solution already in Phalcon?
Regards