Failed Conditions
Push — master ( 2ccf23...d791f7 )
by Michael
10:40
created

CacheException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 42
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A nonCacheableEntityAssociation() 0 3 1
A updateReadOnlyCollection() 0 3 1
A nonCacheableEntity() 0 3 1
A updateReadOnlyEntity() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM\Cache;
6
7
use Doctrine\ORM\ORMException;
8
9
/**
10
 * Exception for cache.
11
 */
12
class CacheException extends ORMException
13
{
14
    /**
15
     * @param string $sourceEntity
16
     * @param string $fieldName
17
     *
18
     * @return \Doctrine\ORM\Cache\CacheException
19
     */
20 1
    public static function updateReadOnlyCollection($sourceEntity, $fieldName)
21
    {
22 1
        return new self(sprintf('Cannot update a readonly collection "%s#%s"', $sourceEntity, $fieldName));
23
    }
24
25
    /**
26
     * @param string $entityName
27
     *
28
     * @return \Doctrine\ORM\Cache\CacheException
29
     */
30 1
    public static function updateReadOnlyEntity($entityName)
31
    {
32 1
        return new self(sprintf('Cannot update a readonly entity "%s"', $entityName));
33
    }
34
35
    /**
36
     * @param string $entityName
37
     *
38
     * @return \Doctrine\ORM\Cache\CacheException
39
     */
40 1
    public static function nonCacheableEntity($entityName)
41
    {
42 1
        return new self(sprintf('Entity "%s" not configured as part of the second-level cache.', $entityName));
43
    }
44
45
    /**
46
     * @param string $entityName
47
     * @param string $field
48
     *
49
     * @return CacheException
50
     */
51 2
    public static function nonCacheableEntityAssociation($entityName, $field)
52
    {
53 2
        return new self(sprintf('Entity association field "%s#%s" not configured as part of the second-level cache.', $entityName, $field));
54
    }
55
}
56