Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 14 |
DoctrineCaster | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
90 | |
0.00% |
0 / 14 |
castCommonProxy | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 5 |
|||
castOrmProxy | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 5 |
|||
castPersistentCollection | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 4 |
1 | <?php |
2 | |
3 | /* |
4 | * This file is part of the Symfony package. |
5 | * |
6 | * (c) Fabien Potencier <fabien@symfony.com> |
7 | * |
8 | * For the full copyright and license information, please view the LICENSE |
9 | * file that was distributed with this source code. |
10 | */ |
11 | |
12 | namespace Symfony\Component\VarDumper\Caster; |
13 | |
14 | use Doctrine\Common\Proxy\Proxy as CommonProxy; |
15 | use Doctrine\ORM\PersistentCollection; |
16 | use Doctrine\ORM\Proxy\Proxy as OrmProxy; |
17 | use Symfony\Component\VarDumper\Cloner\Stub; |
18 | |
19 | /** |
20 | * Casts Doctrine related classes to array representation. |
21 | * |
22 | * @author Nicolas Grekas <p@tchwork.com> |
23 | * |
24 | * @final |
25 | */ |
26 | class DoctrineCaster |
27 | { |
28 | public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, bool $isNested) |
29 | { |
30 | foreach (['__cloner__', '__initializer__'] as $k) { |
31 | if (\array_key_exists($k, $a)) { |
32 | unset($a[$k]); |
33 | ++$stub->cut; |
34 | } |
35 | } |
36 | |
37 | return $a; |
38 | } |
39 | |
40 | public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, bool $isNested) |
41 | { |
42 | foreach (['_entityPersister', '_identifier'] as $k) { |
43 | if (\array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) { |
44 | unset($a[$k]); |
45 | ++$stub->cut; |
46 | } |
47 | } |
48 | |
49 | return $a; |
50 | } |
51 | |
52 | public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, bool $isNested) |
53 | { |
54 | foreach (['snapshot', 'association', 'typeClass'] as $k) { |
55 | if (\array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) { |
56 | $a[$k] = new CutStub($a[$k]); |
57 | } |
58 | } |
59 | |
60 | return $a; |
61 | } |
62 | } |