Document/Subscriber/ArticleSubscriber.php
public function handleChildrenPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        foreach ($document->getChildren() as $childDocument) {
            if (!$childDocument instanceof ArticlePageDocument) {
                continue;
            }

            $localizationState = $this->documentInspector->getLocalizationState($childDocument);

            if (LocalizationState::GHOST === $localizationState) {
                continue;
            }

            $changed = false;

            if ($document->getStructureType() !== $childDocument->getStructureType()) {
                $childDocument->setStructureType($document->getStructureType());
                $changed = true;
            }

            if ($document->getShadowLocale() !== $childDocument->getShadowLocale()) {
                $childDocument->setShadowLocale($document->getShadowLocale());
                $changed = true;
            }

            if ($document->isShadowLocaleEnabled() !== $childDocument->isShadowLocaleEnabled()) {
                $childDocument->setShadowLocaleEnabled($document->isShadowLocaleEnabled());
                $changed = true;
            }

            if ($changed) {
                $this->documentManager->persist(
                    $childDocument,
                    $childDocument->getLocale(),
                    [
                        'clear_missing_content' => false,
                        'auto_name' => false,
                        'auto_rename' => false,
                    ]
                );
            }
        }
    }
public function handleChildrenPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticleDocument) {
            return;
        }

        foreach ($document->getChildren() as $childDocument) {
            if (!$childDocument instanceof ArticlePageDocument) {
                continue;
            }

            $localizationState = $this->documentInspector->getLocalizationState($childDocument);

            if (LocalizationState::GHOST === $localizationState) {
                continue;
            }

            $changed = false;

            if ($document->getStructureType() !== $childDocument->getStructureType()) {
                $childDocument->setStructureType($document->getStructureType());
                $changed = true;
            }

            if ($document->getShadowLocale() !== $childDocument->getShadowLocale()) {
                $childDocument->setShadowLocale($document->getShadowLocale());
                $changed = true;
            }

            if ($document->isShadowLocaleEnabled() !== $childDocument->isShadowLocaleEnabled()) {
                $childDocument->setShadowLocaleEnabled($document->isShadowLocaleEnabled());
                $changed = true;
            }

            if ($changed) {
                $this->documentManager->persist(
                    $childDocument,
                    $childDocument->getLocale(),
                    [
                        'clear_missing_content' => false,
                        'auto_name' => false,
                        'auto_rename' => false,
                    ]
                );
            }
        }
    }
public function handleChildrenPersist ( PersistEvent $ event ) { $ document = $ event -> getDocument ( ) ; if ( ! $ document instanceof ArticleDocument ) { return ; } foreach ( $ document -> getChildren ( ) as $ childDocument ) { if ( ! $ childDocument instanceof ArticlePageDocument ) { continue ; } $ localizationState = $ this -> documentInspector -> getLocalizationState ( $ childDocument ) ; if ( LocalizationState :: GHOST === $ localizationState ) { continue ; } $ changed = false ; if ( $ document -> getStructureType ( ) !== $ childDocument -> getStructureType ( ) ) { $ childDocument -> setStructureType ( $ document -> getStructureType ( ) ) ; $ changed = true ; } if ( $ document -> getShadowLocale ( ) !== $ childDocument -> getShadowLocale ( ) ) { $ childDocument -> setShadowLocale ( $ document -> getShadowLocale ( ) ) ; $ changed = true ; } if ( $ document -> isShadowLocaleEnabled ( ) !== $ childDocument -> isShadowLocaleEnabled ( ) ) { $ childDocument -> setShadowLocaleEnabled ( $ document -> isShadowLocaleEnabled ( ) ) ; $ changed = true ; } if ( $ changed ) { $ this -> documentManager -> persist ( $ childDocument , $ childDocument -> getLocale ( ) , [ 'clear_missing_content' => false , 'auto_name' => false , 'auto_rename' => false , ] ) ; } } }
Schedule all children.

@param PersistEvent $event
Schedule all children .