I've been using Pagekit before this, which is kinda based on Symfony. However, now I've transitioned to PhalconPHP to get rid of the whole CMS part, and just have a clean framework to build upon.
It feels similar, but obviously there are quite a few differences between them. One of which I haven't yet been able to figure out.
In pagekit, I would be able to use an ORM Query like:
$topTracks = Media::query() ->select('DISTINCT m.*, COUNT(h.id) as popularity, h.played_at as played_at') ->from('@shoutzor_media m') ->leftJoin('@shoutzor_media_artist ma', 'ma.artist_id = '.$this->id) ->leftJoin('@shoutzor_history h', 'h.media_id = m.id') ->where('m.id = ma.media_id') ->groupBy('m.id') ->orderBy('popularity', 'DESC') ->limit(5) ->related(['artist', 'album']) ->get();
I've managed to find
Media::find() in PhalconPHP, but I think that wouldn't really be able to build the same kind ORM of query.
Is there a way to use the querybuilder, and have it return instances of the model? this specific model also uses manytomany relationships, would these be automatically populated, or do I need to provide the data for that in the same query?
I hope my question isn't too vague.