本文整理汇总了PHP中TYPO3\Flow\Property\PropertyMapper::getMessages方法的典型用法代码示例。如果您正苦于以下问题:PHP PropertyMapper::getMessages方法的具体用法?PHP PropertyMapper::getMessages怎么用?PHP PropertyMapper::getMessages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Property\PropertyMapper
的用法示例。
在下文中一共展示了PropertyMapper::getMessages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* @param mixed $value
* @return mixed
*/
public function process($value)
{
if ($this->dataType !== null) {
$value = $this->propertyMapper->convert($value, $this->dataType, $this->propertyMappingConfiguration);
$messages = $this->propertyMapper->getMessages();
} else {
$messages = new \TYPO3\Flow\Error\Result();
}
$validationResult = $this->validator->validate($value);
$messages->merge($validationResult);
$this->processingMessages->merge($messages);
return $value;
}
示例2: setValue
/**
* Sets the value of this argument.
*
* @param mixed $rawValue The value of this argument
* @return \TYPO3\Flow\Mvc\Controller\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;
}
示例3: convertElementToValue
/**
* Convert an element to the value it represents.
*
* @param \XMLReader $reader
* @param string $currentType current element (userland) type
* @param string $currentEncoding date encoding of element
* @param string $currentClassName class name of element
* @param string $currentNodeIdentifier identifier of the node
* @param string $currentProperty current property name
* @return mixed
* @throws ImportException
*/
protected function convertElementToValue(\XMLReader $reader, $currentType, $currentEncoding, $currentClassName, $currentNodeIdentifier, $currentProperty)
{
switch ($currentType) {
case 'object':
if ($currentClassName === 'DateTime') {
$stringValue = trim($reader->value);
$value = $this->propertyMapper->convert($stringValue, $currentClassName, $this->propertyMappingConfiguration);
if ($this->propertyMapper->getMessages()->hasErrors()) {
throw new ImportException(sprintf('Could not convert element <%s> to DateTime for node %s', $currentProperty, $currentNodeIdentifier), 1472992032);
}
} elseif ($currentEncoding === 'json') {
$decodedJson = json_decode($reader->value, true);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new ImportException(sprintf('Could not parse encoded JSON in element <%s> for node %s: %s', $currentProperty, $currentNodeIdentifier, json_last_error_msg()), 1472992033);
}
$value = $this->propertyMapper->convert($decodedJson, $currentClassName, $this->propertyMappingConfiguration);
if ($this->propertyMapper->getMessages()->hasErrors()) {
throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentClassName, $currentNodeIdentifier), 1472992034);
}
} else {
throw new ImportException(sprintf('Unsupported encoding "%s"', $currentEncoding), 1404397061);
}
break;
case 'string':
$value = $reader->value;
break;
default:
$value = $this->propertyMapper->convert($reader->value, $currentType, $this->propertyMappingConfiguration);
if ($this->propertyMapper->getMessages()->hasErrors()) {
throw new ImportException(sprintf('Could not convert element <%s> to %s for node %s', $currentProperty, $currentType, $currentNodeIdentifier), 1472992035);
}
return $value;
}
$this->persistEntities($value);
return $value;
}