vendor/coreshop/resource-bundle/Cache/CoreCacheHandlerDecorator.php line 35

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4.  * CoreShop
  5.  *
  6.  * This source file is available under two different licenses:
  7.  *  - GNU General Public License version 3 (GPLv3)
  8.  *  - CoreShop Commercial License (CCL)
  9.  * Full copyright and license information is available in
  10.  * LICENSE.md which is distributed with this source code.
  11.  *
  12.  * @copyright  Copyright (c) CoreShop GmbH (https://www.coreshop.org)
  13.  * @license    https://www.coreshop.org/license     GPLv3 and CCL
  14.  *
  15.  */
  16. namespace CoreShop\Bundle\ResourceBundle\Cache;
  17. use CoreShop\Bundle\ResourceBundle\Pimcore\CacheMarshallerInterface;
  18. use Pimcore\Cache\Core\CoreCacheHandler;
  19. use Pimcore\Model\DataObject\Concrete;
  20. /**
  21.  * @psalm-suppress InternalClass
  22.  */
  23. class CoreCacheHandlerDecorator extends CoreCacheHandler
  24. {
  25.     public function load($key): mixed
  26.     {
  27.         /**
  28.          * @psalm-suppress InternalMethod
  29.          */
  30.         $data parent::load($key);
  31.         if ($data instanceof Concrete) {
  32.             $class $data->getClass();
  33.             foreach ($class->getFieldDefinitions() as $fd) {
  34.                 if (!$fd instanceof CacheMarshallerInterface) {
  35.                     continue;
  36.                 }
  37.                 $data->setObjectVar(
  38.                     $fd->getName(),
  39.                     $fd->unmarshalForCache($data$data->getObjectVar($fd->getName())),
  40.                 );
  41.             }
  42.         }
  43.         return $data;
  44.     }
  45. }