What cascade \"refresh\" means in Doctrine2? Is it entity update operation?
UPDATE
Now it seems that if, for example, category name is ch
You can find the documentation here, but for summary I will copy some important point:
Persisting, removing, detaching, refreshing and merging individual entities can become pretty cumbersome, especially when a highly interweaved object graph is involved. Therefore Doctrine 2 provides a mechanism for transitive persistence through cascading of these operations. Each association to another entity or a collection of entities can be configured to automatically cascade certain operations. By default, no operations are cascaded.
The following cascade options exist:
- persist : Cascades persist operations to the associated entities.
- remove : Cascades remove operations to the associated entities.
- merge : Cascades merge operations to the associated entities.
- detach : Cascades detach operations to the associated entities.
- refresh : Cascades refresh operations to the associated entities.
Copying all the section is unnecessary since everybody can open the link but the idea of cascade is clear from this part.
doing some automatic stuff on associations by doctrine.
In refresh cascade
case, when you define this cascade on a @oneToMany
association, you are asking doctrine to refresh the collection
on many side when you do refresh
on one side.
lets say we have one-to-many
association between Category
and Product
entities. If you define this cascade for it, everytime you invoke refresh
on any Category
its Products Collection
will be refreshed.
About this part of your question: Is it entity update operation? yes, In Refresh
It means fetching collections and entities from data source into the memory.
Cascade operations are performed in memory. That means collections and related entities are fetched into memory, even if they are still marked as lazy when the cascade operation is about to be performed. However this approach allows entity lifecycle events to be performed for each of these operations.
However, pulling objects graph into memory on cascade can cause considerable performance overhead, especially when cascading collections are large. Makes sure to weigh the benefits and downsides of each cascade operation that you define.