コード例 #1
0
ファイル: Argument.php プロジェクト: rickymathew/TYPO3.CMS
 /**
  * Sets the value of this argument.
  *
  * @param mixed $rawValue The value of this argument
  *
  * @return \TYPO3\CMS\Extbase\Mvc\Controller\Argument
  * @throws \TYPO3\CMS\Extbase\Property\Exception
  */
 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;
     }
     try {
         $this->value = $this->propertyMapper->convert($rawValue, $this->dataType, $this->propertyMappingConfiguration);
     } catch (TargetNotFoundException $e) {
         // for optional arguments no exeption is thrown.
         if ($this->isRequired()) {
             throw $e;
         }
     }
     $this->validationResults = $this->propertyMapper->getMessages();
     if ($this->validator !== null) {
         // @todo Validation API has also changed!!!
         $validationMessages = $this->validator->validate($this->value);
         $this->validationResults->merge($validationMessages);
     }
     return $this;
 }
コード例 #2
0
 /**
  * Sets the value of this argument.
  *
  * @param mixed $rawValue The value of this argument
  * @return \TYPO3\CMS\Extbase\Mvc\Controller\Argument
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException if the argument is not a valid object of type $dataType
  */
 public function setValue($rawValue)
 {
     if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
         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->propertyMappingConfiguration);
         $this->validationResults = $this->propertyMapper->getMessages();
         if ($this->validator !== NULL) {
             // TODO: Validation API has also changed!!!
             $validationMessages = $this->validator->validate($this->value);
             $this->validationResults->merge($validationMessages);
         }
         return $this;
     } else {
         if ($rawValue === NULL || is_object($rawValue) && $rawValue instanceof $this->dataType) {
             $this->value = $rawValue;
         } else {
             $this->value = $this->transformValue($rawValue);
         }
         return $this;
     }
 }
コード例 #3
0
ファイル: Argument.php プロジェクト: khanhdeux/typo3test
 /**
  * Sets the value of this argument.
  *
  * @param mixed $rawValue The value of this argument
  * @return \TYPO3\CMS\Extbase\Mvc\Controller\Argument
  * @throws \TYPO3\CMS\Extbase\Property\Exception
  */
 public function setValue($rawValue)
 {
     if ($this->configurationManager->isFeatureEnabled('rewrittenPropertyMapper')) {
         if ($rawValue === NULL) {
             $this->value = NULL;
             return $this;
         }
         if (is_object($rawValue) && $rawValue instanceof $this->dataType) {
             $this->value = $rawValue;
             return $this;
         }
         try {
             $this->value = $this->propertyMapper->convert($rawValue, $this->dataType, $this->propertyMappingConfiguration);
         } catch (TargetNotFoundException $e) {
             // for optional arguments no exeption is thrown.
             if ($this->isRequired()) {
                 throw $e;
             }
         }
         $this->validationResults = $this->propertyMapper->getMessages();
         if ($this->validator !== NULL) {
             // TODO: Validation API has also changed!!!
             $validationMessages = $this->validator->validate($this->value);
             $this->validationResults->merge($validationMessages);
         }
         return $this;
     } else {
         if ($rawValue === NULL || is_object($rawValue) && $rawValue instanceof $this->dataType) {
             $this->value = $rawValue;
         } else {
             $this->value = $this->transformValue($rawValue);
         }
         return $this;
     }
 }
コード例 #4
0
 /**
  * Sets the value of this argument.
  *
  * @param mixed $rawValue The value of this argument
  * @return \TYPO3\CMS\Extbase\Mvc\Controller\Argument
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\InvalidArgumentValueException if the argument is not a valid object of type $dataType
  */
 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->propertyMappingConfiguration);
     $this->validationResults = $this->propertyMapper->getMessages();
     if ($this->validator !== NULL) {
         // TODO: Validation API has also changed!!!
         $validationMessages = $this->validator->validate($this->value);
         $this->validationResults->merge($validationMessages);
     }
     return $this;
 }