Пример #1
0
 /**
  * Adjusts the order of the document and its siblings.
  *
  * @param ReorderEvent $event
  */
 public function handleReorder(ReorderEvent $event)
 {
     $node = $event->getNode();
     $document = $event->getDocument();
     if (false == $this->supports($document)) {
         return;
     }
     $propertyName = $this->encoder->systemName(self::FIELD);
     $parent = $node->getParent();
     $count = 0;
     foreach ($parent->getNodes() as $childNode) {
         $childNode->setProperty($propertyName, ($count + 1) * 10, PropertyType::LONG);
         ++$count;
     }
     $this->handleHydrate($event);
 }