getMessages() public method

Get the messages of the last Property Mapping
public getMessages ( ) : Neos\Error\Messages\Result
return Neos\Error\Messages\Result
Ejemplo n.º 1
0
 /**
  * @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 \Neos\Error\Messages\Result();
     }
     $validationResult = $this->validator->validate($value);
     $messages->merge($validationResult);
     $this->processingMessages->merge($messages);
     return $value;
 }
Ejemplo n.º 2
0
 /**
  * Sets the value of this argument.
  *
  * @param mixed $rawValue 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;
 }
 /**
  * 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;
 }