convert() public method

Convert raw property values to the correct type according to a node type configuration
public convert ( TYPO3\TYPO3CR\Domain\Model\NodeType $nodeType, string $propertyName, string $rawValue, TYPO3\TYPO3CR\Domain\Service\Context $context ) : mixed
$nodeType TYPO3\TYPO3CR\Domain\Model\NodeType
$propertyName string
$rawValue string
$context TYPO3\TYPO3CR\Domain\Service\Context
return mixed
Example #1
0
 /**
  * Applies this change
  *
  * @return void
  */
 public function apply()
 {
     if ($this->canApply()) {
         $node = $this->getSubject();
         $value = $this->nodePropertyConversionService->convert($node->getNodeType(), $this->getPropertyName(), $this->getValue(), $node->getContext());
         $node->setProperty($this->getPropertyName(), $value);
         $this->updateWorkspaceInfo();
     }
 }
Example #2
0
 /**
  * Applies this change
  *
  * @return void
  */
 public function apply()
 {
     if ($this->canApply()) {
         $node = $this->getSubject();
         $value = $this->nodePropertyConversionService->convert($node->getNodeType(), $this->getPropertyName(), $this->getValue(), $node->getContext());
         $node->setProperty($this->getPropertyName(), $value);
         $this->updateWorkspaceInfo();
         if ($node->getNodeType()->getConfiguration('properties.' . $this->getPropertyName() . '.ui.reloadIfChanged')) {
             $this->reloadDocument();
         }
     }
 }