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
[NFR] Relation chain #12552
Comments
? Just use query builder: $result = $modelsManager->createBuilder()
->columns('Salon.*, Car.*, Tires.*')
->from('Salon')
->leftJoin('Car')
->leftJoin('Tires')
->getQuery()
->execute(); You will get complex resultset with each row having Salon model, Car resultset and Tires resultset(or car array/tires array, i dont remember exactly). Eager loading/deep relations/relation chain or however other you want to call it is bad and won't be implemented in phalcon. check #1117 especially @andresgutierrez comments |
@Jurigag. Eager loading very helps in the some cases. In your solution, you cannot get a model and it relationships like that:
|
Yes but read @andresgutierrez comments, eager loading is bad for performance and caching. |
But question of eager loading is asked regularly. Maybe, the best solutions is implementation but with notification to developers about performance issues. |
This is why eager loading is already in incubator. |
Eager loading in incubator have two issues:
Prevents to resolve these issues: https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model/manager.zep#L1352 |
Feel free to send PR with fixes for 1 and 2 |
Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues |
Expected:
I whsh to define a relation with multiple joins as below:
where tires i a oneToMany ralation alias on Car to Tire class I have already the 'tires' relation defined in the Car.
For now it's not working that way.
I am trying to get related modal data with one sql query and want the object + appropriate relations to be build then.
The text was updated successfully, but these errors were encountered: