private function createSerializer()
    {
        return SerializerBuilder::create()
            ->setPropertyNamingStrategy(new IdenticalPropertyNamingStrategy())
            ->configureListeners(function (EventDispatcher $dispatcher) {
                $dispatcher->addListener('serializer.post_deserialize',
                    function (ObjectEvent $event) {
                        $object = $event->getObject();
                        if ($object instanceof ClientAwareInterface) {
                            $object->setClient($this);
                        }
                    }
                );

                $dispatcher->addListener('serializer.post_serialize',
                    function (ObjectEvent $event) {
                        $options = $event->getContext()->attributes->get('options')->getOrElse(array());
                        $visitor = $event->getVisitor();

                        if ($visitor instanceof GenericSerializationVisitor) {
                            foreach ($options as $key => $value) {
                                $visitor->addData($key, $value);
                            }
                        }
                    }
                );
            })
            ->build();
    }
private function createSerializer()
    {
        return SerializerBuilder::create()
            ->setPropertyNamingStrategy(new IdenticalPropertyNamingStrategy())
            ->configureListeners(function (EventDispatcher $dispatcher) {
                $dispatcher->addListener('serializer.post_deserialize',
                    function (ObjectEvent $event) {
                        $object = $event->getObject();
                        if ($object instanceof ClientAwareInterface) {
                            $object->setClient($this);
                        }
                    }
                );

                $dispatcher->addListener('serializer.post_serialize',
                    function (ObjectEvent $event) {
                        $options = $event->getContext()->attributes->get('options')->getOrElse(array());
                        $visitor = $event->getVisitor();

                        if ($visitor instanceof GenericSerializationVisitor) {
                            foreach ($options as $key => $value) {
                                $visitor->addData($key, $value);
                            }
                        }
                    }
                );
            })
            ->build();
    }
private function createSerializer ( ) { return SerializerBuilder :: create ( ) -> setPropertyNamingStrategy ( new IdenticalPropertyNamingStrategy ( ) ) -> configureListeners ( function ( EventDispatcher $ dispatcher ) { $ dispatcher -> addListener ( 'serializer.post_deserialize' , function ( ObjectEvent $ event ) { $ object = $ event -> getObject ( ) ; if ( $ object instanceof ClientAwareInterface ) { $ object -> setClient ( $ this ) ; } } ) ; $ dispatcher -> addListener ( 'serializer.post_serialize' , function ( ObjectEvent $ event ) { $ options = $ event -> getContext ( ) -> attributes -> get ( 'options' ) -> getOrElse ( array ( ) ) ; $ visitor = $ event -> getVisitor ( ) ; if ( $ visitor instanceof GenericSerializationVisitor ) { foreach ( $ options as $ key => $ value ) { $ visitor -> addData ( $ key , $ value ) ; } } } ) ; } ) -> build ( ) ; }
Creates a serializer.

@return SerializerInterface
Creates a serializer .