Skip to content

Conversation

@meyerbaptiste
Copy link
Member

No description provided.

#### Eager loading

By default Doctrine comes with [lazy loading](http://doctrine-orm.readthedocs.io/en/latest/reference/working-with-objects.html#by-lazy-loading).
Usually a killer time-saving feature and also a performance killer with large applications.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't that a little bit informal ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with this statement.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha I do agree too, this feature should give more warning than it actually does

# ...
```

Be careful when you exceed your limit, it's often the result of circular references. The use of [serializer groups](serialization-groups-and-relations.md)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be careful when you exceed this limit, it's often caused by the result of a circular reference. [Serializer groups](serialization-groups-and-relations.md) can be a good solution to fix this issue


##### Force eager

As mentioned above, by default we force eager loading for all relations. This behaviour can be modified in the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behaviour can be modified with the configuration in order to apply it only on join relations having the ...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this can still be better

##### Override at resource and operation level

When eager loading is enabled, whatever the status of the `force_eager` parameter, you can easily override it directly
from the configuration of each resource. For now, you can do this at the resource level, at the operations level, or both:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You say that there will be more way to do this, but you are not saying what will be next. IMO you don't need to say For now.

@soyuka
Copy link
Member

soyuka commented Nov 18, 2016

We may want to remove my part on performances as it's not right anymore because there are no partial select anymore https://github.com/meyerbaptiste/doc/blob/3216e636ec21917790456d9a2554edb96bed865c/core/performance.md#unserialized-properties-hydratation.

@meyerbaptiste
Copy link
Member Author

Done @soyuka.

@Simperfit
Copy link
Contributor

Thanks @meyerbaptiste

@Simperfit Simperfit merged commit f56f4e1 into api-platform:master Nov 18, 2016
@meyerbaptiste meyerbaptiste deleted the add_eager_loading_doc branch November 18, 2016 14:13
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

Successfully merging this pull request may close these issues.

4 participants