当前位置: 首页>>代码示例>>PHP>>正文


PHP PropertyMapper::getMessages方法代码示例

本文整理汇总了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;
 }
开发者ID:kitsunet,项目名称:form,代码行数:17,代码来源:ProcessingRule.php

示例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;
 }
开发者ID:robertlemke,项目名称:flow-development-collection,代码行数:24,代码来源:Argument.php

示例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;
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:48,代码来源:NodeImportService.php


注:本文中的TYPO3\Flow\Property\PropertyMapper::getMessages方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。