Symfony\Component\Serializer\Serializer::denormalize PHP Method

denormalize() public method

public denormalize ( $data, $type, $format = null )
    public function denormalize($data, $type, $format = null)
    {
        return $this->denormalizeObject($data, $type, $format);
    }

Usage Example

 function it_denormalizes_association_with_products(Association $association, Serializer $serializer, ProductInterface $product1, ProductInterface $product2)
 {
     // Mock product denormalization
     $serializer->denormalize('foo', self::PRODUCT_CLASS, self::FORMAT_CSV)->willReturn($product1);
     $serializer->denormalize('bar', self::PRODUCT_CLASS, self::FORMAT_CSV)->willReturn($product2);
     $association->addProduct($product1)->shouldBeCalled();
     $association->addProduct($product2)->shouldBeCalled();
     $this->setSerializer($serializer);
     $this->denormalize('foo,bar', self::ENTITY_CLASS, self::FORMAT_CSV, ['part' => 'products', 'entity' => $association]);
 }
All Usage Examples Of Symfony\Component\Serializer\Serializer::denormalize