Commit 74d9869d authored by Fabien Potencier's avatar Fabien Potencier

fixed CS

parent 85bff8cb
...@@ -72,15 +72,14 @@ The ``SerializerServiceProvider`` provider provides a ``serializer`` service:: ...@@ -72,15 +72,14 @@ The ``SerializerServiceProvider`` provider provides a ``serializer`` service::
})->assert("_format", "xml|json") })->assert("_format", "xml|json")
->assert("id", "\d+"); ->assert("id", "\d+");
Use a Cache Using a Cache
----- -------------
To use a cache you can register it in the specified encoder needed. All you need to do is have a class implementing ``Doctrine\Common\Cache\Cache``:: To use a cache, register a class implementing ``Doctrine\Common\Cache\Cache``::
$app->register(new Silex\Provider\SerializerServiceProvider()); $app->register(new Silex\Provider\SerializerServiceProvider());
$app['serializer.normalizers'] = function () use ($app) { $app['serializer.normalizers'] = function () use ($app) {
return [new \Symfony\Component\Serializer\Normalizer\CustomNormalizer(), return [new \Symfony\Component\Serializer\Normalizer\CustomNormalizer(),
new \Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()), $app['my_custom_cache'])) new \Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer(new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()), $app['my_custom_cache']))
]; ];
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment