8000 ORM Collection OneToMany cache issue on update · Issue #5821 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
ORM Collection OneToMany cache issue on update #5821
Closed
@mpoiriert

Description

@mpoiriert

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

http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/unitofwork-associations.html

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 ?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0