*/
class RecursiveContextualValidator implements ContextualValidatorInterface
{
- /**
- * @var ExecutionContextInterface
- */
private $context;
-
- /**
- * @var string
- */
private $defaultPropertyPath;
-
- /**
- * @var array
- */
private $defaultGroups;
-
- /**
- * @var MetadataFactoryInterface
- */
private $metadataFactory;
-
- /**
- * @var ConstraintValidatorFactoryInterface
- */
private $validatorFactory;
-
- /**
- * @var ObjectInitializerInterface[]
- */
private $objectInitializers;
/**
$this->validateGenericNode(
$value,
- null,
+ $previousObject,
is_object($value) ? spl_object_hash($value) : null,
$metadata,
$this->defaultPropertyPath,
if (is_object($objectOrClass)) {
$object = $objectOrClass;
+ $class = get_class($object);
$cacheKey = spl_object_hash($objectOrClass);
$propertyPath = PropertyPath::append($this->defaultPropertyPath, $propertyName);
} else {
// $objectOrClass contains a class name
$object = null;
+ $class = $objectOrClass;
$cacheKey = null;
$propertyPath = $this->defaultPropertyPath;
}
$this->validateGenericNode(
$value,
$object,
- $cacheKey.':'.get_class($object).':'.$propertyName,
+ $cacheKey.':'.$class.':'.$propertyName,
$propertyMetadata,
$propertyPath,
$groups,
* objects are iterated as well. Nested arrays are always iterated,
* regardless of the value of $recursive.
*
- * @param array|\Traversable $collection The collection
+ * @param iterable $collection The collection
* @param string $propertyPath The current property path
* @param string[] $groups The validated groups
* @param ExecutionContextInterface $context The current execution context