public function denormalize($data, $class, $format = null, array $context = [])
    {
        $reflection = new ReflectionClass($class);
        $instance = $reflection->newInstanceWithoutConstructor();

        foreach ($data as $key => $value) {
            $property = $reflection->getProperty($key);
            $property->setAccessible(true);
            $property->setValue($instance, $value);
        }

        return $instance;
    }
public function denormalize($data, $class, $format = null, array $context = [])
    {
        $reflection = new ReflectionClass($class);
        $instance = $reflection->newInstanceWithoutConstructor();

        foreach ($data as $key => $value) {
            $property = $reflection->getProperty($key);
            $property->setAccessible(true);
            $property->setValue($instance, $value);
        }

        return $instance;
    }
public function denormalize ( $ data , $ class , $ format = null , array $ context = [ ] ) { $ reflection = new ReflectionClass ( $ class ) ; $ instance = $ reflection -> newInstanceWithoutConstructor ( ) ; foreach ( $ data as $ key => $ value ) { $ property = $ reflection -> getProperty ( $ key ) ; $ property -> setAccessible ( true ) ; $ property -> setValue ( $ instance , $ value ) ; } return $ instance ; }
Denormalizes data back into an object of the given class.

@param mixed  $data    data to restore
@param string $class   the expected class to instantiate
@param string $format  format the given data was extracted from
@param array  $context options available to the denormalizer

@return object
Denormalizes data back into an object of the given class .