[Validator] Made GraphWalker::validateReference() method public

This commit is contained in:
Bernhard Schussek 2011-02-03 10:53:30 +01:00
parent 5ed4d91bb8
commit 55a97ec78e
2 changed files with 36 additions and 1 deletions

View File

@ -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)) {

View File

@ -0,0 +1,35 @@
<?php
namespace Symfony\Components\Validator\Mapping\Cache;
use Symfony\Components\Validator\Mapping\ClassMetadata;
class ApcCache implements CacheInterface
{
public function has($class)
{
apc_delete($this->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;
}
}