-
Notifications
You must be signed in to change notification settings - Fork 55
EAGER annotation on node relations #121
Comments
@theUm couldn't this be solved with using I see two benefits to this :
However I'm not sure I understand fully this part :
|
Ok. I'll show you full case of my structure:
So with EAGER I sipmly can go first way and do not worry about performance because all |
I agree it makes sense. The only problem I have with the For your use case though, I would personally do the following :
or
I leave the issue open without saying no, however I think createQuery() functionality as well as custom labels are more important than Eager for a GA release. |
Thanks for answer. I'll wait for |
What if eagerness could be controller by defining a maximum depth level? |
Max depth level? This means we should know and define eagerness path. Isn`t it will be too complex to implement and maintain? What to do with circular references? What will be syntax to such eager annotations? |
@mfalcier when we speak about dense is that for example a Twitter user could have 1 million followers. @theUm The java ogm uses depth fetching by default, when you load entities you defined until which depth you want to fetch. To be honest, I see how they are struggling and this isn't something I'm gonna implement. However combining depth with EAGER can be interesting, for example you could be able to load all depth 2 entities at once starting from your "THE OBJECT" node. Anyway I'm afraid EAGER will be post-ga. |
There's an additional option that can be applied with eager loading, which is the idea of Laravel's 'With' clause in calling relationships. It would be nice to be able to specify which relationships we want to load with a node so that we don't have to keep querying the database for more data to return. For instance, let's say we have a user and they have a relationship to their pets. If we act normally, if we want to know the pet's name, we have to make another call to the database to get the pet information. However if we specify something like user->with(pet::class) then it will eager load that user with the pet nodes as well, meaning we can make one call to the database instead of several. This is a simpler implementation and should help avoid the very real situations of recursive relationships and loading by depth, provided this is managed well enough. |
If we have
@LAZY
, we need doctrine like@EAGER
too. In some cases it will be wery usefull to have autoloaded relations.Example case: I have labels "Object", "FieldType", "Value" they are all interlinked. So whenever I want to make list of object values with corresponded field types, I must gather values from object, then get field types from object from other relation type, and then link values to types through foreach. Its very frustrating to do so, and prefetching field types with fields would be nice thing to have.
The text was updated successfully, but these errors were encountered: