for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace ScayTrase\Api\Cruds\Adaptors\JmsSerializer;
use JMS\Serializer\ArrayTransformerInterface as JmsDenormalizerInterface;
use ScayTrase\Api\Cruds\EntityProcessorInterface;
final class JmsSerializerProcessor implements EntityProcessorInterface
{
/** @var JmsDenormalizerInterface */
private $denormalizer;
/**
* JmsSerializerProcessor constructor.
*
* @param JmsDenormalizerInterface $denormailzer
*/
public function __construct(JmsDenormalizerInterface $denormailzer)
$this->denormalizer = $denormailzer;
}
/** {@inheritdoc} */
public function updateEntity($entity, $data)
$this->denormalizer->fromArray(
$data,
get_class($entity),
JmsContextFactory::deserialization(['object_to_populate' => $entity])
);
return $entity;