From 55a97ec78e87b3c374d0e1773afffc745cfe7533 Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Thu, 3 Feb 2011 10:53:30 +0100 Subject: [PATCH] [Validator] Made GraphWalker::validateReference() method public --- .../Component/Validator/GraphWalker.php | 2 +- .../Validator/Mapping/Cache/ApcCache.php | 35 +++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/Symfony/Component/Validator/Mapping/Cache/ApcCache.php diff --git a/src/Symfony/Component/Validator/GraphWalker.php b/src/Symfony/Component/Validator/GraphWalker.php index 83068b01a8..221a0bc2ae 100644 --- a/src/Symfony/Component/Validator/GraphWalker.php +++ b/src/Symfony/Component/Validator/GraphWalker.php @@ -133,7 +133,7 @@ class GraphWalker } } - protected function walkReference($value, $group, $propertyPath, $traverse) + public function walkReference($value, $group, $propertyPath, $traverse) { if (null !== $value) { if (!is_object($value) && !is_array($value)) { diff --git a/src/Symfony/Component/Validator/Mapping/Cache/ApcCache.php b/src/Symfony/Component/Validator/Mapping/Cache/ApcCache.php new file mode 100644 index 0000000000..38361cbac0 --- /dev/null +++ b/src/Symfony/Component/Validator/Mapping/Cache/ApcCache.php @@ -0,0 +1,35 @@ +computeCacheKey($class)); + apc_fetch($this->computeCacheKey($class), $exists); + + return $exists; + } + + public function read($class) + { + if (!$this->has($class)) { + // TODO exception + } + + return apc_fetch($this->computeCacheKey($class)); + } + + public function write(ClassMetadata $metadata) + { + apc_store($this->computeCacheKey($metadata->getClassName()), $metadata); + } + + protected function computeCacheKey($class) + { + return 'Symfony\Components\Validator:'.$class; + } +} \ No newline at end of file