Symfony\Component\Validator\Context\ExecutionContext::setNode PHP Method

setNode() public method

public setNode ( $value, $object, Symfony\Component\Validator\Mapping\MetadataInterface $metadata = null, $propertyPath )
$metadata Symfony\Component\Validator\Mapping\MetadataInterface
    public function setNode($value, $object, MetadataInterface $metadata = null, $propertyPath)
    {
        $this->value = $value;
        $this->object = $object;
        $this->metadata = $metadata;
        $this->propertyPath = (string) $propertyPath;
    }

Usage Example

コード例 #1
0
 protected function createContext()
 {
     $translator = $this->getMock('Symfony\\Component\\Translation\\TranslatorInterface');
     $validator = $this->getMock('Symfony\\Component\\Validator\\Validator\\ValidatorInterface');
     $contextualValidator = $this->getMock('Symfony\\Component\\Validator\\Validator\\ContextualValidatorInterface');
     $context = new ExecutionContext($validator, $this->root, $translator);
     $context->setGroup($this->group);
     $context->setNode($this->value, $this->object, $this->metadata, $this->propertyPath);
     $context->setConstraint($this->constraint);
     $validator->expects($this->any())->method('inContext')->with($context)->will($this->returnValue($contextualValidator));
     return $context;
 }