Created
February 25, 2016 10:26
-
-
Save SebLours/2b6cb67ce3f99c35d146 to your computer and use it in GitHub Desktop.
Pomm flexible entity serializer normalizer
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
<?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