Skip to content

Commit

Permalink
Add 'useCredentials' to ignored attributes in normalizers
Browse files Browse the repository at this point in the history
In the two updated classes (ManifestCompileEventListener and PwaDevServerSubscriber), the constant 'useCredentials' has been added to the IGNORED_ATTRIBUTES option of the Symfony AbstractNormalizer, which prevents serialization of this specific attribute. This adjustment was made to improve the efficiency of our serialization process.
  • Loading branch information
Spomky committed Apr 15, 2024
1 parent d1d9195 commit 02dd82f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Subscriber/ManifestCompileEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Symfony\Component\DependencyInjection\Attribute\Autowire;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;
use Symfony\Component\Serializer\Encoder\JsonEncode;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
use const JSON_PRETTY_PRINT;
Expand Down Expand Up @@ -40,6 +41,7 @@ public function __construct(
$options = [
AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES => true,
AbstractObjectNormalizer::SKIP_NULL_VALUES => true,
AbstractNormalizer::IGNORED_ATTRIBUTES => ['useCredentials'],
JsonEncode::OPTIONS => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR,
];
if ($debug === true) {
Expand Down
2 changes: 2 additions & 0 deletions src/Subscriber/PwaDevServerSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\Serializer\Encoder\JsonEncode;
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
use Symfony\Component\Serializer\SerializerInterface;
use function assert;
Expand Down Expand Up @@ -69,6 +70,7 @@ public function __construct(
$options = [
AbstractObjectNormalizer::SKIP_UNINITIALIZED_VALUES => true,
AbstractObjectNormalizer::SKIP_NULL_VALUES => true,
AbstractNormalizer::IGNORED_ATTRIBUTES => ['useCredentials'],
JsonEncode::OPTIONS => JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR,
];
if ($debug === true) {
Expand Down

0 comments on commit 02dd82f

Please sign in to comment.