ApiPlatform\Core\Hal\Serializer\ItemNormalizer::denormalize PHP Method

denormalize() public method

public denormalize ( $data, $class, $format = null, array $context = [] )
$context array
    public function denormalize($data, $class, $format = null, array $context = [])
    {
        throw new RuntimeException(sprintf('%s is a read-only format.', self::FORMAT));
    }

Usage Example

 /**
  * @expectedException \ApiPlatform\Core\Exception\RuntimeException
  */
 public function testDonTSupportDenormalization()
 {
     $propertyNameCollectionFactoryProphecy = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
     $propertyMetadataFactoryProphecy = $this->prophesize(PropertyMetadataFactoryInterface::class);
     $iriConverterProphecy = $this->prophesize(IriConverterInterface::class);
     $resourceClassResolverProphecy = $this->prophesize(ResourceClassResolverInterface::class);
     $normalizer = new ItemNormalizer($propertyNameCollectionFactoryProphecy->reveal(), $propertyMetadataFactoryProphecy->reveal(), $iriConverterProphecy->reveal(), $resourceClassResolverProphecy->reveal());
     $this->assertFalse($normalizer->supportsDenormalization('foo', ItemNormalizer::FORMAT));
     $normalizer->denormalize(['foo'], 'Foo');
 }