Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phalcon >= 2.0.4 conditions on relationships #8

Open
Surt opened this issue Oct 20, 2015 · 2 comments
Open

Phalcon >= 2.0.4 conditions on relationships #8

Surt opened this issue Oct 20, 2015 · 2 comments

Comments

@Surt
Copy link
Contributor

Surt commented Oct 20, 2015

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.

@josefguenther
Copy link

I can confirm, conditions do not work. The following is how it should work:

$this->hasMany('id', 'RobotsParts', 'robots_id', [
    'params' => ['conditions' => 'something = 1']
]);

@erisrayanesh
Copy link

Grate library @stibiumz . Same issue.
I think before the line blow

if ($this->constraints) {

you need to process the params part of relation options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants