After a few tries with Phalcon raw query, phpl and orm, I'm about to give up on Phalcon. It's too hard to do any serious database query in Phalcon.
The ORM Model is useless because I'd like to join tables with complex conditions. The has_many_through hasn't yet been implemented. And I don't even know if it can do eager loading either.
Phpl and raw query? why I must to paste some length and hard to maintain string instead of this:
join('thread_tag', 'threads.id', '=', 'thread_tag.thread_id') ->join('tags', 'tags.id', '=', 'thread_tag.tag_id') ->where('tags.name', 'in', DB::raw(static::wrap_tag($tags))) ->group_by('threads.id') ->having(DB::raw('count(tags.id)'), '=', count($tags)) ->order_by('threads.updated_at', 'desc') ->take($limit) ->skip($offset) ->get([DB::raw('threads.*')]);
and most of all, because of the N+1 problem, I have to deal with eager loading myself (when laravel offers it nicely).
It would be best if I can use Laravel library inside of Phalcon. It can be done, right? Then we could have both: the speed of Phalcon and the easy-of-use of Laravel.
p/s: admitted, I'd rather static method call like DB::raw(), Session::get(), Input::get() to \Phalcon\Db\RawValue('default') , $this->session->getVar(), $this->request->getPost() and all...
Maybe I should write helper class using shortcut call to actual phalcon methods. Because I don't use code completion, having short and easy to type and remember method is ways better.