I have 2 models:
- models/Users.php
- models/Posts.php
Users has:
- $this->hasMany('id', 'Posts', 'id_user');
Posts has:
- $this->belongsTo('id_user', 'Users', 'id');
and this is fine.
Is possible to create search using phalcon ORM ? I know that I can do this (with leftjoin, innerjoin, etc) like that:
- $this->modelsManager->executeQuery($sql-with-joins, $bind_array);
or I can use queryBuilder like that:
-
->columns('id, name') ->from('Users') ->join('Posts) ... ->orderBy('name')
But how can I create search with ORM construction:
- Users::find( .. here join and search on Posts model fields .. )->toArray();
Thanks for advance