. */ namespace Doctrine\ORM\Cache\Persister; use Doctrine\ORM\PersistentCollection; use Doctrine\ORM\Cache\CacheException; use Doctrine\Common\Util\ClassUtils; /** * @author Fabio B. Silva * @since 2.5 */ class ReadOnlyCachedCollectionPersister extends NonStrictReadWriteCachedCollectionPersister { /** * {@inheritdoc} */ public function update(PersistentCollection $collection) { if ($collection->isDirty() && count($collection->getSnapshot()) > 0) { throw CacheException::updateReadOnlyCollection(ClassUtils::getClass($collection->getOwner()), $this->association['fieldName']); } parent::update($collection); } }