[DDC-1835] Fix clone side effects in PersistentCollection #356

merged 1 commit into from May 27, 2012


None yet
4 participants

kdambekalns commented May 24, 2012

No description provided.

This pull request passes (merged f2bcb19 into 1f9435d).

+ $this->_em->clear();
+ $collectionHolder = $this->_em->find(__NAMESPACE__ . '\PersistentCollectionHolder', $collectionHolder->getId());
+ $collectionHolder->getCollection();

stof May 24, 2012


why calling getCollection here ?


kdambekalns May 24, 2012


This is what triggers the bug, because the getter clones the collection before returning it (and we do this quite often, to avoid indirect changes to internal data (by accident) through references).

beberlei added a commit that referenced this pull request May 27, 2012

Merge pull request #356 from kdambekalns/DDC-1835
[DDC-1835] Fix clone side effects in PersistentCollection

@beberlei beberlei merged commit b7bcbc2 into doctrine:2.2 May 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment