Last active
February 9, 2017 11:23
-
-
Save carteni/d702eaa4f7459edb06434a0856938942 to your computer and use it in GitHub Desktop.
Symfony Validation / Caching ClassMetadata information using Predis and DoctrineCacheBundle.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AppKernel extends Kernel | |
{ | |
public function registerBundles() | |
{ | |
$bundles = [ | |
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), | |
new Symfony\Bundle\SecurityBundle\SecurityBundle(), | |
new Symfony\Bundle\TwigBundle\TwigBundle(), | |
new Symfony\Bundle\MonologBundle\MonologBundle(), | |
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), | |
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), | |
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), | |
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(), | |
new AppBundle\AppBundle(), | |
]; | |
if (in_array($this->getEnvironment(), ['dev', 'test'], true)) { | |
$bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); | |
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); | |
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); | |
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); | |
} | |
return $bundles; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
framework: | |
validation: { enable_annotations: true, cache: validator.mapping.cache.doctrine.predis_cache } | |
# $ composer require doctrine/doctrine-cache-bundle | |
# $ composer predis/predis | |
doctrine_cache: | |
aliases: | |
predis_cache: my_predis_cache | |
providers: | |
my_predis_cache: | |
type: predis | |
namespace: "%validator.mapping.cache.prefix%" | |
aliases: | |
- predis_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
validator.mapping.cache.doctrine.predis_cache: | |
class: Symfony\Component\Validator\Mapping\Cache\DoctrineCache | |
public: false | |
arguments: ["@predis_cache"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment