Commit 2e0f7d38 authored by Jean Lorenz Hertel's avatar Jean Lorenz Hertel Committed by GitHub

Update documentation to add cache explaination

This updates the documentation explaining how to setup any cache that implements the Doctrine interface. As the Symfony documentation don't clearly shows how to do this, I intend to add it here.
parent 02ba1df9
......@@ -71,3 +71,16 @@ The ``SerializerServiceProvider`` provider provides a ``serializer`` service::
));
})->assert("_format", "xml|json")
->assert("id", "\d+");
Use 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``::
$app->register(new Silex\Provider\SerializerServiceProvider());
$app['serializer.normalizers'] = function () use ($app) {
return [new \Symfony\Component\Serializer\Normalizer\CustomNormalizer(),
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