phalcon.eager-loading
phalcon.eager-loading copied to clipboard
Phalcon >= 2.0.4 conditions on relationships
Since Phalcon 2.0.4 it's possible to write conditions on relationships 2.0.4 changes, under Relationships with conditionals
But it seems to fail when using the Loader
$users = Loader::fromResultset($users, ['favouriteImage']);
been favouriteImage
a relationship with conditional it does not ask for the condition, only the relationship.
Of course, actually the loader allows to override the relationship with the Querybuilder, but I will like to avoid this since my domain logic and data providers become a mess.
Again, thank you very much @stibiumz for your library, it does the phalcon orm more useful.
I can confirm, conditions do not work. The following is how it should work:
$this->hasMany('id', 'RobotsParts', 'robots_id', [
'params' => ['conditions' => 'something = 1']
]);
Grate library @stibiumz . Same issue. I think before the line blow https://github.com/stibiumz/phalcon.eager-loading/blob/b3028a9ac828a2945bf9859a72b2a7667acd65a9/src/EagerLoading/EagerLoad.php#L133 you need to process the params part of relation options