Skip to content

Instantly share code, notes, and snippets.

@SebLours
Created February 25, 2016 10:26
Show Gist options
  • Save SebLours/2b6cb67ce3f99c35d146 to your computer and use it in GitHub Desktop.
Save SebLours/2b6cb67ce3f99c35d146 to your computer and use it in GitHub Desktop.
Pomm flexible entity serializer normalizer
<?php
namespace Acme\Component\Serializer\Normalizer;
use PommProject\ModelManager\Model\FlexibleEntity;
use Symfony\Component\Serializer\Normalizer\NormalizerInterface;
class FlexibleEntityNormalizer implements NormalizerInterface
{
/**
* {@inheritdoc}
*/
public function normalize($object, $format = null, array $context = array())
{
return $object->extract();
}
/**
* {@inheritdoc}
*/
public function supportsNormalization($data, $format = null)
{
return $data instanceof FlexibleEntity;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment