-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZP-31677: Added normalizer to decrease amount of data when compound …
…matcher is encoded to JSON (#3041)
- Loading branch information
1 parent
f816402
commit c0efbbe
Showing
4 changed files
with
75 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
eZ/Publish/Core/MVC/Symfony/Component/Serializer/CompoundMatcherNormalizer.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace eZ\Publish\Core\MVC\Symfony\Component\Serializer; | ||
|
||
use eZ\Publish\Core\MVC\Symfony\SiteAccess\Matcher; | ||
use Symfony\Component\Serializer\Normalizer\PropertyNormalizer; | ||
|
||
class CompoundMatcherNormalizer extends PropertyNormalizer | ||
{ | ||
public function normalize($object, $format = null, array $context = []) | ||
{ | ||
$data = parent::normalize($object, $format, $context); | ||
$data['config'] = []; | ||
$data['matchersMap'] = []; | ||
|
||
return $data; | ||
} | ||
|
||
public function supportsNormalization($data, $format = null) | ||
{ | ||
return $data instanceof Matcher\Compound; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters