Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

SiteAccessSerializationTrait.php
Go to the documentation of this file.
1 <?php
2
7 declare(strict_types=1);
8
9 namespace eZ\Bundle\EzPublishCoreBundle\Fragment;
10
11 use eZ\Publish\Core\MVC\Symfony\Component\Serializer\SerializerTrait;
12 use eZ\Publish\Core\MVC\Symfony\SiteAccess;
13 use Symfony\Component\HttpKernel\Controller\ControllerReference;
14
15 trait SiteAccessSerializationTrait
16 {
17 use SerializerTrait;
18
19 public function serializeSiteAccess(SiteAccess $siteAccess, ControllerReference $uri): void
20 {
21 // Serialize the siteaccess to get it back after. @see eZ\Publish\Core\MVC\Symfony\EventListener\SiteAccessMatchListener
22 $uri->attributes['serialized_siteaccess'] = json_encode($siteAccess);
23 $uri->attributes['serialized_siteaccess_matcher'] = $this->getSerializer()->serialize(
24 $siteAccess->matcher,
25 'json'
26 );
27 if ($siteAccess->matcher instanceof SiteAccess\Matcher\CompoundInterface) {
28 $subMatchers = $siteAccess->matcher->getSubMatchers();
29 foreach ($subMatchers as $subMatcher) {
30 $uri->attributes['serialized_siteaccess_sub_matchers'][get_class($subMatcher)] = $this->getSerializer()->serialize(
31 $subMatcher,
32 'json'
33 );
34 }
35 }
36 }
37 }
eZ\Publish\API\Repository\Values\ValueObject\attributes
attributes()
Internal function for Legacy template engine compatibility to get properties.
Definition: API/Repository/Values/ValueObject.php:187
eZ\Publish\Core\MVC\Symfony\SiteAccess
Base struct for a siteaccess representation.
Definition: SiteAccess.php:16
eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher\CompoundInterface
Definition: CompoundInterface.php:14
eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher
Interface for SiteAccess matchers.
Definition: Publish/Core/MVC/Symfony/SiteAccess/Matcher.php:15
eZ\Bundle\EzPublishCoreBundle\Fragment
Definition: DecoratedFragmentRenderer.php:7
eZ\Bundle\EzPublishCoreBundle\Fragment\serializeSiteAccess
serializeSiteAccess(SiteAccess $siteAccess, ControllerReference $uri)
Definition: SiteAccessSerializationTrait.php:19
eZ\Bundle\EzPublishCoreBundle\Fragment\SiteAccessSerializationTrait
trait SiteAccessSerializationTrait
Definition: SiteAccessSerializationTrait.php:16
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.