Description
Following
http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/second-level-cache.html
Under 33.6.1. Cache usage
There is a example of OneToMany collection cache (State->cities).
From this documentation
In a OneToMany the owner side is the inverse side (City in the example mention above).
From the UnitOfWork
private function computeAssociationChanges($assoc, $value)
{
if ($value instanceof Proxy && ! $value->__isInitialized__) {
return;
}
if ($value instanceof PersistentCollection && $value->isDirty()) {
$coid = spl_object_hash($value);
if ($assoc['isOwningSide']) {
$this->collectionUpdates[$coid] = $value;
}
$this->visitedCollections[$coid] = $value;
}
///...///
}
This mean the collection will not be added to the collectionUpdates since it's not the owning side.
Not being in the collectionUpdates the AbstractCollectionPersister->update will not get called so the cache entry will not be updated (or deleted) resulting of corrupted data in the cache.
It's all a big theory but looking in the code it make sense that this is my problem (unless there is something I didn't configure properly).
Clearing the cache after the flush does make all the cache entry getting updated and it's w 589C orking properly...
Also I was trying to find automation test of those classes and I didn't find any, could I be mistaken or there is really no automated integration test for this ?