Mercurial > hg > isophonics-drupal-site
comparison vendor/symfony/var-dumper/Caster/DoctrineCaster.php @ 0:4c8ae668cc8c
Initial import (non-working)
author | Chris Cannam |
---|---|
date | Wed, 29 Nov 2017 16:09:58 +0000 |
parents | |
children | 129ea1e6d783 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:4c8ae668cc8c |
---|---|
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\Proxy\Proxy as OrmProxy; | |
16 use Doctrine\ORM\PersistentCollection; | |
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 class DoctrineCaster | |
25 { | |
26 public static function castCommonProxy(CommonProxy $proxy, array $a, Stub $stub, $isNested) | |
27 { | |
28 foreach (array('__cloner__', '__initializer__') as $k) { | |
29 if (array_key_exists($k, $a)) { | |
30 unset($a[$k]); | |
31 ++$stub->cut; | |
32 } | |
33 } | |
34 | |
35 return $a; | |
36 } | |
37 | |
38 public static function castOrmProxy(OrmProxy $proxy, array $a, Stub $stub, $isNested) | |
39 { | |
40 foreach (array('_entityPersister', '_identifier') as $k) { | |
41 if (array_key_exists($k = "\0Doctrine\\ORM\\Proxy\\Proxy\0".$k, $a)) { | |
42 unset($a[$k]); | |
43 ++$stub->cut; | |
44 } | |
45 } | |
46 | |
47 return $a; | |
48 } | |
49 | |
50 public static function castPersistentCollection(PersistentCollection $coll, array $a, Stub $stub, $isNested) | |
51 { | |
52 foreach (array('snapshot', 'association', 'typeClass') as $k) { | |
53 if (array_key_exists($k = "\0Doctrine\\ORM\\PersistentCollection\0".$k, $a)) { | |
54 $a[$k] = new CutStub($a[$k]); | |
55 } | |
56 } | |
57 | |
58 return $a; | |
59 } | |
60 } |