Neos\Flow\Mvc\Controller\Argument::setValue PHP Method

setValue() public method

Sets the value of this argument.
public setValue ( mixed $rawValue ) : Argument
$rawValue mixed The value of this argument
return Argument $this
    public function setValue($rawValue)
    {
        if ($rawValue === null) {
            $this->value = null;
            return $this;
        }
        if (is_object($rawValue) && $rawValue instanceof $this->dataType) {
            $this->value = $rawValue;
            return $this;
        }
        $this->value = $this->propertyMapper->convert($rawValue, $this->dataType, $this->getPropertyMappingConfiguration());
        $this->validationResults = $this->propertyMapper->getMessages();
        if ($this->validator !== null) {
            $validationMessages = $this->validator->validate($this->value);
            $this->validationResults->merge($validationMessages);
        }
        return $this;
    }

Usage Example

Esempio n. 1
0
 protected function setupPropertyMapperAndSetValue()
 {
     $this->mockPropertyMapper->expects($this->once())->method('convert')->with('someRawValue', 'string', $this->mockConfiguration)->will($this->returnValue('convertedValue'));
     $this->mockPropertyMapper->expects($this->once())->method('getMessages')->will($this->returnValue(new FLowError\Result()));
     return $this->simpleValueArgument->setValue('someRawValue');
 }