Jackalope\NodeType\NodeProcessor::process PHP Метод

process() публичный Метод

Process the given node and return eventual extra operations determined from the node.
public process ( PHPCR\NodeInterface $node ) : Jackalope\Transport\AddNodeOperation[]
$node PHPCR\NodeInterface
Результат Jackalope\Transport\AddNodeOperation[] Additional operations that the client must execute for autocreated nodes.
    public function process(NodeInterface $node)
    {
        $this->validateNamespace($node->getName());
        $nodeDef = $node->getPrimaryNodeType();
        $nodeTypes = $node->getMixinNodeTypes();
        array_unshift($nodeTypes, $nodeDef);
        $additionalOperations = array();
        foreach ($nodeTypes as $nodeType) {
            /* @var $nodeType NodeTypeDefinitionInterface */
            $additionalOperations = array_merge($additionalOperations, $this->processNodeWithType($node, $nodeType));
        }
        return $additionalOperations;
    }

Usage Example

Пример #1
0
 /**
  * @dataProvider providePropertyValidationOutOfRangeCharacters
  */
 public function testPropertyValidationOutOfRangeCharacters($value, $isValid)
 {
     $property = $this->getPropertyMock(array('getType' => PropertyType::STRING, 'isMultiple' => false, 'getValue' => $value, 'getPath' => '/path/to'));
     if (false === $isValid) {
         $this->setExpectedException('PHPCR\\ValueFormatException', 'Invalid character detected in value');
     }
     $nodeType = $this->getNodeTypeMock(array('getDeclaredChildNodeDefinitions' => array(), 'getDeclaredPropertyDefinitions' => array(), 'getDeclaredSupertypes' => array(), 'getName' => 'node-type-1'));
     $node = $this->getNodeMock(array('getPrimaryNodeType' => $nodeType, 'getMixinNodeTypes' => array(), 'getProperties' => array($property), 'getName' => 'node1', 'getPath' => 'path/to/node'));
     $this->processor->process($node);
 }