Failed Conditions
Push — develop ( 9800ca...d1cf9a )
by Marco
272:19 queued 264:21
created

ReadOnlyCachedCollectionPersister   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 15
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A update() 0 10 3
1
<?php
2
3
4
declare(strict_types=1);
5
6
namespace Doctrine\ORM\Cache\Persister\Collection;
7
8
use Doctrine\ORM\Cache\CacheException;
9
use Doctrine\ORM\PersistentCollection;
10
use Doctrine\ORM\Utility\StaticClassNameConverter;
11
12
/**
13
 * @author Fabio B. Silva <[email protected]>
14
 * @since 2.5
15
 */
16
class ReadOnlyCachedCollectionPersister extends NonStrictReadWriteCachedCollectionPersister
17
{
18
    /**
19
     * {@inheritdoc}
20
     */
21 23
    public function update(PersistentCollection $collection)
22
    {
23 23
        if ($collection->isDirty() && $collection->getSnapshot()) {
24 1
            throw CacheException::updateReadOnlyCollection(
25 1
                StaticClassNameConverter::getClass($collection->getOwner()),
26 1
                $this->association->getName()
27
            );
28
        }
29
30 23
        parent::update($collection);
31 23
    }
32
}
33