Closed
Description
Just making sure, this does not get lost, see also http://groups.google.com/group/symfony-devs/msg/a73a70c4b696b8d9
There are two solutions I can imagine:
a) Having an re-entry point for validation that can be used from a class validator
<?php
class MyClassValidator extends ConstraintValidator
{
public function isValid($value, Constraint $constraint)
{
if ($value->field=== 'value') {
return $this->context->validate($value->path1);
} else {
return $this->context->validate($value->path2);
}
}
}
b) Having a way to influence the graph walker as to which members should be visited
<?php
class MyClassValidator extends ConstraintValidator
{
public function isValid($value, Constraint $constraint)
{
if ($value->field === 'somevalue') {
$this->context->getGraphWalker()->skipSubPath('path1');
} else {
$this->context->getGraphWalker()->skipSubPath('path2');
}
return true;
}
}
@bschussek, what do you think?