Update route-paths of articles which are linked to the given page-document.

@param MoveEvent $event
160128
public function handleMove(MoveEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof PageDocument) {
            return;
        }

        foreach ($this->documentInspector->getLocales($document) as $locale) {
            $this->routeUpdater->update($this->documentManager->find($document->getUuid(), $locale));
        }
    }
398340
private function updateRoute($document, $generateRoutes)
    {
        $locales = $this->documentInspector->getLocales($document);
        $webspaceKey = $this->documentInspector->getWebspace($document);
        $uuid = $this->documentInspector->getUuid($document);
        $path = $this->documentInspector->getPath($document);
        $parentUuid = $this->documentInspector->getUuid($this->documentInspector->getParent($document));

        $defaultNode = $this->defaultSession->getNode($path);
        $liveNode = $this->liveSession->getNode($path);

        $resourceLocatorStrategy = $this->resourceLocatorStrategyPool->getStrategyByWebspaceKey($webspaceKey);

        foreach ($locales as $locale) {
            $localizedDocument = $this->documentManager->find($uuid, $locale);

            if (RedirectType::NONE !== $localizedDocument->getRedirectType()) {
                continue;
            }

            $resourceSegmentPropertyName = $this->encoder->localizedSystemName(
                $this->getResourceSegmentProperty($localizedDocument)->getName(),
                $locale
            );

            $this->updateResourceSegmentProperty(
                $defaultNode,
                $resourceSegmentPropertyName,
                $parentUuid,
                $webspaceKey,
                $locale
            );

            if ($liveNode->hasProperty($resourceSegmentPropertyName)) {
                $this->updateResourceSegmentProperty(
                    $liveNode,
                    $resourceSegmentPropertyName,
                    $parentUuid,
                    $webspaceKey,
                    $locale
                );

                // if the method is called with the generateRoutes flag it will create a new route
                // this happens on a move, but not on copy, because copy results in a draft page without url
                if ($generateRoutes) {
                    $localizedDocument->setResourceSegment($liveNode->getPropertyValue($resourceSegmentPropertyName));
                    $resourceLocatorStrategy->save($localizedDocument, null);
                    $localizedDocument->setResourceSegment($defaultNode->getPropertyValue($resourceSegmentPropertyName));
                }
            }
        }
    }
1253720
public function onPostUpdate(ResourceEventInterface $event)
    {
        $page = $this->getPageFromEvent($event);

        $this->deletePageCache($page);
    }
325443
public static function updateConfig( Event $event )
	{
		$event->getIO()->write( 'Ensure existing config and routing for the shop bundle' );

		$options = self::getOptions( $event );

		if( isset( $options['symfony-app-dir'] ) )
		{
			self::updateConfigFile( $options['symfony-app-dir'] . '/config/config.yml' );
			self::updateRoutingFile( $options['symfony-app-dir'] . '/config/routing.yml' );
		}
	}
675761
public function handleNodeFromRegistry($event)
    {
        if ($event->hasNode()) {
            return;
        }

        $document = $event->getDocument();

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

        $node = $this->documentRegistry->getNodeForDocument($document);
        $event->setNode($node);
    }
1252831
public function update($event, $step, $r)
	{	
		global $app_mode;

		$this->permlink = permlinkurl_id($r['ID']);

		callback_event('rah_bitly.update', '', false, $r);

		if (!$this->permlink || $r['Status'] < STATUS_LIVE)
		{
			return;
		}

		if (
			$this->prev_permlink !== $this->permlink ||
			empty($r['custom_'.$this->field]) ||
			$this->prev_status != $r['Status']
		) {
			$uri = $this->fetch($this->permlink);
		}

		if (empty($uri))
		{
			return;
		}

		$fields = getCustomFields();

		if (!isset($fields[$this->field]))
		{
			return;
		}

		safe_update(
			'textpattern',
			'custom_'.intval($this->field)."='".doSlash($uri)."'",
			"ID='".doSlash($r['ID'])."'"
		);

		$js = 
			'$(document).ready(function(){'.
				'$(\'input[name="custom_'.$this->field.'"]\').val("'.escape_js($uri).'");'.
			'});';

		if ($app_mode == 'async')
		{
			send_script_response($js);
		}
	}
781753
private function moveFieldData(CalendarEvent $event) {
        if ($event->Attendees()->exists()) {
            /** @var Attendee $attendee */
            foreach ($event->Attendees() as $attendee) {
                /** @var UserField $field */
                foreach ($event->Fields() as $field) {
                    $q = SQLSelect::create(
                        $field->FieldName,
                        "`{$attendee->getClassName()}`",
                        array('ID' => $attendee->ID)
                    );

                    try {
                        $value = $q->execute()->value();
                        $attendee->Fields()->add($field, array(
                            'Value' => $value
                        ));
                        echo "[$event->ID][$attendee->ID] Set '$field->FieldName' with '{$value}' \n";
                    } catch (\Exception $e) {
                        // fails silent
                        echo "[$event->ID][$attendee->ID] Failed, '$field->FieldName' does not exist \n";
                    }
                }
            }
            echo "[$event->ID] Finished migrating event \n\n";
        } else {
            echo "[$event->ID] No attendees to migrate \n\n";
        }
    }
877239
public function onPostSerialize(ObjectEvent $event)
    {
        $visitor = $event->getVisitor();
        $document = $event->getObject();

        if (!$document instanceof PathBehavior || !$this->documentRegistry->hasDocument($document)) {
            return;
        }

        $visitor->addData('path', $this->documentInspector->getContentPath($document));
    }
541545
public function nestedSetPostMove(NestedSetEventArgs $eventArgs)
	{
		$entity = $eventArgs->getEntity();
		$this->em = $eventArgs->getEntityManager();
		$this->unitOfWork = $this->em->getUnitOfWork();

		if ($entity instanceof Page) {
			$changedLocalizations = $this->pageChange($entity, true);

			foreach ($changedLocalizations as $changedLocalization) {
				$this->em->flush($changedLocalization);
			}
		}
	}
387200
def _update_page(self, uri, path):
        """"""
        if uri in self._pages:
            self._pages[uri].update()
        else:
            self._pages[uri] = Page(uri=uri, path=path)
1209097
public function hydratePageData(HydrateEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        $pages = $event->getNode()->getPropertyValueWithDefault(
            $this->propertyEncoder->localizedSystemName(self::PAGES_PROPERTY, $document->getOriginalLocale()),
            json_encode([])
        );
        $pages = json_decode($pages, true);

        if (LocalizationState::SHADOW === $this->documentInspector->getLocalizationState($document)) {
            $pages = $this->loadPageDataForShadow($event->getNode(), $document, $pages);
        }

        $document->setPages($pages);
    }
1000280
public function nestedSetPostMove(NestedSetEventArgs $eventArgs)
	{
		$entity = $eventArgs->getEntity();

		if ($entity instanceof FileAbstraction) {
			$this->regeneratePathForEntity($entity, $eventArgs);
		}
	}
612700
public static function onPreUpdate(Event $event)
    {
        $page = $event->getTarget();
        $eventArgs = $event->getEventArgs();

        if ($eventArgs instanceof PreUpdateEventArgs) {
            if ($eventArgs->hasChangedField('_workflow_state')) {
                $old = $eventArgs->getOldValue('_workflow_state');
                $new = $eventArgs->getNewValue('_workflow_state');

                if (null !== $new && null !== $listener = $new->getListenerInstance()) {
                    $listener->switchOnState($event);
                }

                if (null !== $old && null !== $listener = $old->getListenerInstance()) {
                    $listener->switchOffState($event);
                }
            }

            if ($eventArgs->hasChangedField('_state')) {
                if (
                    !($eventArgs->getOldValue('_state') & Page::STATE_ONLINE)
                    && $eventArgs->getNewValue('_state') & Page::STATE_ONLINE
                ) {
                    $event->getDispatcher()->triggerEvent('putonline', $page);
                } elseif (
                    $eventArgs->getOldValue('_state') & Page::STATE_ONLINE
                    && !($eventArgs->getNewValue('_state') & Page::STATE_ONLINE)
                ) {
                    $event->getDispatcher()->triggerEvent('putoffline', $page);
                }
            }
        }
    }
544443
public function handleRemove(RemoveEvent $event)
    {
        $document = $event->getDocument();

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

        $this->recursivelyRemoveRoutes($document);
    }
224133
private function cascadeDetach(object $document, array &$visited) : void
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        foreach ($class->fieldMappings as $mapping) {
            if (! $mapping['isCascadeDetach']) {
                continue;
            }
            $relatedDocuments = $class->reflFields[$mapping['fieldName']]->getValue($document);
            if ($relatedDocuments instanceof Collection || is_array($relatedDocuments)) {
                if ($relatedDocuments instanceof PersistentCollectionInterface) {
                    // Unwrap so that foreach() does not initialize
                    $relatedDocuments = $relatedDocuments->unwrap();
                }
                foreach ($relatedDocuments as $relatedDocument) {
                    $this->doDetach($relatedDocument, $visited);
                }
            } elseif ($relatedDocuments !== null) {
                $this->doDetach($relatedDocuments, $visited);
            }
        }
    }
1310731
public function persistPageDataOnReorder(ReorderEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument) {
            return;
        }

        $document = $document->getParent();
        $node = $this->documentInspector->getNode($document);

        $this->setPageData($document, $node, $document->getLocale());

        $document->setWorkflowStage(WorkflowStage::TEST);
        $this->documentManager->persist($document, $this->documentInspector->getLocale($document));

        $this->documents[$document->getUuid()] = [
            'uuid' => $document->getUuid(),
            'locale' => $document->getLocale(),
        ];
    }
734450
public function setWorkflowStageOnArticle($event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument
            || LocalizationState::GHOST === $this->documentInspector->getLocalizationState($document->getParent())
        ) {
            return;
        }

        $document->getParent()->setWorkflowStage(WorkflowStage::TEST);
        $this->documentManager->persist(
            $document->getParent(),
            $this->documentInspector->getLocale($document),
            $event instanceof PersistEvent ? $event->getOptions() : []
        );
    }