for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <[email protected]>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ElasticsearchDSL\Serializer\Normalizer;
use Symfony\Component\Serializer\Normalizer\CustomNormalizer;
/**
* Normalizer used with referenced normalized objects.
class CustomReferencedNormalizer extends CustomNormalizer
{
* @var array
private $references = [];
* {@inheritdoc}
public function normalize($object, $format = null, array $context = [])
$object->setReferences($this->references);
$data = parent::normalize($object, $format, $context);
$this->references = array_merge($this->references, $object->getReferences());
return $data;
}
public function supportsNormalization($data, $format = null)
return $data instanceof AbstractNormalizable;