public function configureSerializerExtension(JMSSerializerExtension $ext) { $ext->addHandlerFactory(new ArticleAuthorHandlerFactory()); $ext->addHandlerFactory(new ArticleCommentsLinkHandlerFactory()); $ext->addHandlerFactory(new AuthorImageUriHandlerFactory()); $ext->addHandlerFactory(new PackageItemsLinkHandlerFactory()); $ext->addHandlerFactory(new ItemLinkHandlerFactory()); $ext->addHandlerFactory(new TopicArticlesLinkHandlerFactory()); $ext->addHandlerFactory(new ArticleFieldsHandlerFactory()); $ext->addHandlerFactory(new ArticleTranslationsHandlerFactory()); $ext->addHandlerFactory(new ArticleRenditionsHandlerFactory()); }
public function configureSerializerExtension(JMSSerializerExtension $ext) { $ext->addHandlerFactory(new ObjectBasedFactory()); $ext->addHandlerFactory(new DoctrineProxyFactory()); $ext->addHandlerFactory(new ArrayCollectionFactory()); $ext->addHandlerFactory(new ConstraintViolationFactory()); $ext->addHandlerFactory(new DateTimeFactory()); $ext->addHandlerFactory(new FormErrorFactory()); }
private function getSerializer() { $container = new ContainerBuilder(); $container->set('annotation_reader', new AnnotationReader()); $container->set('translator', new IdentityTranslator(new MessageSelector())); $container->setParameter('kernel.debug', true); $container->setParameter('kernel.cache_dir', sys_get_temp_dir()); $container->setParameter('kernel.bundles', array()); $extension = new JMSSerializerExtension(); $extension->load(array(array()), $container); $bundle = new JMSSerializerBundle(); $bundle->build($container); $container->getCompilerPassConfig()->setOptimizationPasses(array(new ResolveDefinitionTemplatesPass())); $container->getCompilerPassConfig()->setRemovingPasses(array()); $container->compile(); return $container->get('serializer'); }