Renames node if necessary.

@param PersistEvent $event
480851
public function handleScheduleRename(PersistEvent $event)
    {
        $document = $event->getDocument();

        if (!$event->getOption('auto_name')
            || !$document instanceof AutoNameBehavior
            || $event->getOption('auto_name_locale') !== $event->getLocale()
            || !$event->hasNode()
            || $event->getNode()->isNew()
        ) {
            return;
        }

        $node = $event->getNode();
        $name = $this->getName($document, $event->getParentNode(), $event->getOption('auto_rename'), $node);

        if ($name === $node->getName()) {
            return;
        }

        $uuid = $event->getNode()->getIdentifier();
        $this->scheduledRename[] = ['uuid' => $uuid, 'name' => $name, 'locale' => $event->getLocale()];
    }
572409
public function setTimestampsOnNodeForPersist(PersistEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($document)) {
            return;
        }

        $this->setTimestampsOnNode(
            $document,
            $event->getNode(),
            $event->getAccessor(),
            $this->documentInspector->getOriginalLocale($document),
            new \DateTime()
        );
    }
804131
function _rename(){
    self._visitingAlter = true;
    var table = self._queryNode.table;
    var result = ['EXEC sp_rename '+self.visit(table.toNode())+', '+self.visit(alter.nodes[0].nodes[0])];
    self._visitingAlter = false;
    return result;
  }
775562
public function checkOptions(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument) {
            return;
        }

        $autoRename = $event->getOption('auto_rename');

        if (false !== $autoRename) {
            throw new \InvalidArgumentException('Persist "ArticlePageDocument" only with option "auto_rename" set to "false" allowed');
        }
    }
1014612
public function postUpdate(UpdateEvent $event)
    {
        $workspace = $event->getObject();
        $root = $this->resourceManager->getWorkspaceRoot($workspace);
        $root->setName($workspace->getName());
        $this->om->persist($root);
        $this->om->flush();
    }
17069
public function setTitleOnNode(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();

        if (!$this->supports($document)) {
            return;
        }

        if ($document instanceof LocalizedTitleBehavior) {
            if (!$event->getLocale()) {
                return;
            }

            $event->getNode()->setProperty(
                $this->propertyEncoder->localizedContentName(static::PROPERTY_NAME, $event->getLocale()),
                $document->getTitle()
            );
        } else {
            $event->getNode()->setProperty(
                $this->propertyEncoder->contentName(static::PROPERTY_NAME),
                $document->getTitle()
            );
        }
    }
1011092
final private function replayChange(Event $event)
    {
        $this->apply($event->payload());
        $this->lastCommittedEventSequenceNumber = $event->sequenceNumber();
    }
38717
public function setNodeOnPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument || $event->hasNode()) {
            return;
        }

        $pageTitle = $this->getPageTitle($document);

        // if no page-title exists use a unique-id
        $nodeName = $this->slugifier->slugify($pageTitle ?: uniqid('page-', true));
        $nodeName = $this->resolver->resolveName($event->getParentNode(), $nodeName);
        $node = $event->getParentNode()->addNode($nodeName);

        $event->setNode($node);
    }
1100164
private function setNodeName(AbstractMappingEvent $event)
    {
        $document = $event->getDocument();

        if (!$document instanceof NodeNameBehavior) {
            return;
        }

        $node = $event->getNode();
        $accessor = $event->getAccessor();
        $accessor->set(
            'nodeName',
            $node->getName()
        );
    }
711842
def rename(self, name):
        
        self.update(name='{} node {}'.format(name, self.nodeid))
868480
protected function update(Event $event)
    {
        $this->dispatch(static::EVENT_UPDATE_BEFORE, $event);
        if (!$event->isPropagationStopped()) {
            $this->updateProcess($event);
            if (!$event->isPropagationStopped()) {
                $this->dispatch(static::EVENT_UPDATE_AFTER, $event);
            }
        }
    }
341776
public function nodeUpdated(NodeInterface $node)
    {
        if (!$this->eventEmittingService->isEnabled()) {
            return;
        }

        if (!isset($this->changedNodes[$node->getContextPath()])) {
            $this->changedNodes[$node->getContextPath()] = ['node' => $node];
        }
    }
45285
public function onReplace(string $hint, callable $replacer, ?string $eventName = null): void
	{
		$hint = $this->resolveAlias($hint);

		$eventName === null ? ($this->replacers[$hint][] = $replacer) : ($this->replacers[$hint][$eventName] = $replacer);
	}
1256370
public function handleRemoveLive($event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        $this->liveIndexer->remove($document);
        $this->liveIndexer->flush();
    }
594693
public function afterCommit(TransactionEvent $event) {
    if ($this->liveUpdate && $event->getPhase() == TransactionEvent::AFTER_COMMIT) {
      $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
      // add inserted/updated objects
      foreach (array_merge(array_values($event->getInsertedOids()), $event->getUpdatedOids()) as $oid) {
        $object = $persistenceFacade->load(ObjectId::parse($oid));
        if ($object) {
          $this->addToIndex($object);
        }
        else {
          self::$logger->warn("Could not index object with oid ".$oid." because it does not exist");
        }
      }
      // remove deleted objects
      foreach ($event->getDeletedOids() as $oid) {
        $this->deleteFromIndex(ObjectId::parse($oid));
      }
    }
  }
386696
public function setChangedForRestore(RestoreEvent $event)
    {
        $document = $event->getDocument();
        if (!$this->supports($document)) {
            return;
        }

        $encoding = $this->getPropertyEncoding($document);

        $event->getNode()->setProperty(
            $this->propertyEncoder->encode(
                $encoding,
                static::CHANGED,
                $this->documentInspector->getOriginalLocale($document)
            ),
            new \DateTime()
        );
    }
712286
public function handlePersist(PersistEvent $event)
    {
        $options = $event->getOptions();
        $this->validateOptions($options);
        $document = $event->getDocument();
        $parentPath = null;
        $nodeName = null;

        if ($options['path']) {
            $parentPath = PathHelper::getParentPath($options['path']);
            $nodeName = PathHelper::getNodeName($options['path']);
        }

        if ($options['parent_path']) {
            $parentPath = $options['parent_path'];
        }

        if ($parentPath) {
            $event->setParentNode(
                $this->resolveParent($parentPath, $options)
            );
        }

        if ($options['node_name']) {
            if (!$event->hasParentNode()) {
                throw new DocumentManagerException(sprintf(
                    'The "node_name" option can only be used either with the "parent_path" option ' .
                    'or when a parent node has been established by a previous subscriber. ' .
                    'When persisting document: %s',
                    DocumentHelper::getDebugTitle($document)
                ));
            }

            $nodeName = $options['node_name'];
        }

        if (!$nodeName) {
            return;
        }

        if ($event->hasNode()) {
            $this->renameNode($event->getNode(), $nodeName);

            return;
        }

        if (!$event->getParentNode()->hasNode($nodeName)) {
            $node = $event->getParentNode()->addNode($nodeName);
        } elseif ($options['override']) {
            $node = $event->getParentNode()->getNode($nodeName);
        } else {
            throw new ItemExistsException(
                sprintf(
                    'The node \'%s\' already has a child named \'%s\'.',
                    $event->getParentNode()->getPath(),
                    $nodeName
                )
            );
        }

        $event->setNode($node);
    }