[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/symfony/var-dumper/Caster/ -> DoctrineCaster.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the Symfony package.
   5   *
   6   * (c) Fabien Potencier <[email protected]>
   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 <[email protected]>
  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  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer