Post update handler.

@param LifecycleEventArgs $args
515811
public function postUpdate(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof MediaInterface) {
            $this->getProvider($args)->postUpdate($args->getObject());
        }
    }
1359356
public function postUpdate(PageInterface $page, LifecycleEventArgs $event)
    {
        /** @var \Doctrine\ORM\EntityManagerInterface $em */
        $em = $event->getObjectManager();
        $uow = $em->getUnitOfWork();

        $changeSet = $uow->getEntityChangeSet($page);
        if (array_key_exists('enabled', $changeSet)) {
            if ($page->isEnabled()) {
                $this->discardPageRedirections($page);
            } else {
                $this->buildPageRedirections($page);
            }
        }
    }
1105344
public function postPersist(LifecycleEventArgs $args)
    {
        $this->init($args->getEntityManager(), $args->getEntityManager()->getUnitOfWork());

        $entity = $args->getEntity();

        $entityClass = ClassUtils::getClass($entity);

        $meta = $this->extendedMetadataFactory->getExtendedMetadata($entityClass);

        if (!isset($meta['slugs']) || empty($meta['slugs'])) {
            return;
        }
        foreach ($this->slugMapItemFactory->createItems($entity, $meta['slugs'], $this->em->getClassMetadata($entityClass)) as $slugMapItem) {
            $this->em->persist($slugMapItem);
        }

        $this->flushNeeded = true;
    }
480802
public function postLoad(LifecycleEventArgs $args)
    {
        $document = $args->getDocument();

        // Sometimes $document is a doctrine proxy class, we therefore need to retrieve it's real class
        $name = $args->getDocumentManager()->getClassMetadata(get_class($document))->getName();

        if (!isset($this->mappings[$name])) {
            return;
        }

        $metadata = $this->mappings[$name];

        if (isset($metadata['fallback_locale'])) {
            $setter = 'set' . ucfirst($metadata['fallback_locale']);
            $document->$setter($this->fallbackLocale);
        }
        if (isset($metadata['current_locale'])) {
            $setter = 'set' . ucfirst($metadata['current_locale']);
            $document->$setter($this->currentLocale);
        }
    }
1279133
public function postRemove(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof BlockInterface) {
            $this->getService($args)->postRemove($args->getObject());
        }
    }
931923
public function postPersist(LifecycleEventArgs $args)
    {
        $entity = $args->getObject();
        if ($entity instanceof PackageVersionEntity) {
            $this->refreshPackageLatestVersion($args->getObjectManager(), $entity->getPackage());
        }
    }
320499
public function preRemove(LifecycleEventArgs $args)
    {
        $value = $args->getEntity();
        if (!$value instanceof ValueInterface) {
            return;
        }

        // Ignore removed families
        if (!$this->familyRegistry->hasFamily($value->getFamilyCode())) {
            return;
        }
        $family = $this->familyRegistry->getFamily($value->getFamilyCode());

        // Ignore removed attributes
        if (!$family->hasAttribute($value->getAttributeCode())) {
            return;
        }
        $attribute = $family->getAttribute($value->getAttributeCode());

        // Trigger for attributes marked for orphan_removal, default true for embedded
        if ($attribute->getOption('orphan_removal', $attribute->getType()->isEmbedded())) {
            $args->getEntityManager()->remove($value->getValueData());
        }
    }
477286
public function preRemove(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if ($index = $this->getIndexForObject($entity)) {
            $indexManager = new IndexManager($index);
            $indexManager->remove($entity);
        }
    }
223908
public function afterUpdate(&$args) {
        $model = $args[0];
        $data = $args[2];
        $this->afterSave($model, $data);
    }
966039
protected function _update( $args, $assoc_args, $callback ) {
		$status = 0;

		if ( empty( $assoc_args ) ) {
			WP_CLI::error( 'Need some fields to update.' );
		}

		if ( Utils\get_flag_value( $assoc_args, 'defer-term-counting' ) ) {
			wp_defer_term_counting( true );
		}

		foreach ( $args as $obj_id ) {
			$params = array_merge( $assoc_args, [ $this->obj_id_key => $obj_id ] );

			$status = $this->success_or_failure(
				$this->wp_error_to_resp(
					$callback( $params ),
					"Updated {$this->obj_type} {$obj_id}."
				)
			);
		}

		if ( Utils\get_flag_value( $assoc_args, 'defer-term-counting' ) ) {
			wp_defer_term_counting( false );
		}

		exit( $status );
	}
339256
public function postPersist(LifecycleEventArgs $args)
    {
        $object = $args->getDocument();

        if (($names = $this->referenceRepository->getReferenceNames($object)) !== false) {
            foreach ($names as $name) {
                $identity = $args->getDocumentManager()
                    ->getUnitOfWork()
                    ->getDocumentIdentifier($object);

                $this->referenceRepository->setReferenceIdentity($name, $identity);
            }
        }
    }
814147
public function preRemove(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof MediaInterface) {
            $this->getProvider($args)->preRemove($args->getObject());
        }
    }
1039181
public function beforeUpdate(&$args) {
        $model = &$args[0];
        $data  = &$args[1];
        $where = &$args[2];
        $this->validate($data, $model, true);
    }
149812
public function preUpdate(LifecycleEventArgs $eventArgs)
    {
        $em = $eventArgs->getEntityManager();
        $uow = $em->getUnitOfWork();
        $entity = $eventArgs->getEntity();

        $classMetadata = $em->getClassMetadata(get_class($entity));
        if ($this->isBlameable($classMetadata)) {
            if (!$entity->isBlameable()) {
                return;
            }
            $user = $this->getUser();
            if ($this->isValidUser($user)) {
                $oldValue = $entity->getUpdatedBy();
                $entity->setUpdatedBy($user);
                $uow->propertyChanged($entity, 'updatedBy', $oldValue, $user);

                $uow->scheduleExtraUpdate($entity, [
                    'updatedBy' => [$oldValue, $user],
                ]);
            }
        }
    }
281081
private function updateViewReference(LifecycleEventArgs $eventArgs)
    {
        $entity = $eventArgs->getEntity();
        $view = null;
        $currentLocale = null;
        $translations = [];
        if ($entity instanceof WebViewInterface) {
            $translations = $entity->getTranslations();
            $view = $entity;
            $currentLocale = $view->getCurrentLocale();
        } elseif ($entity instanceof ViewTranslation && $entity->getTranslatable() instanceof WebViewInterface) {
            $translations = [$entity];
            $view = $entity->getTranslatable();
            $currentLocale = $view->getCurrentLocale();
        }

        // if a page is persisted we rebuild his viewRef
        foreach ($translations as $translation) {
            $view->setCurrentLocale($translation->getLocale());
            if ($view->getParent() && $view->getParent()->getCurrentLocale() != $translation->getLocale()) {
                $view->getParent()->translate($translation->getLocale());
                $view->getParent()->setCurrentLocale($translation->getLocale());
            }
            $event = new ViewReferenceEvent($view);
            $this->dispatcher->dispatch(ViewReferenceEvents::UPDATE_VIEW_REFERENCE, $event);
        }
        if ($view) {
            $view->setCurrentLocale($currentLocale);
        }
    }
928333
public function postFlush(PostFlushEventArgs $args)
    {
        $change = false;

        $em = $args->getEntityManager();
        $uow = $args->getEntityManager()->getUnitOfWork();
        $result = $uow->getIdentityMap();
        if(isset($result[$this->targetClass])) {
            foreach ($result[$this->targetClass] as $entity) {
                $updated = $this->updateEntity($entity);
                if($updated) {
                    $change = true;
                }

                $propertyAccessor = PropertyAccess::createPropertyAccessor();
                $targetProperty = $propertyAccessor->getValue($entity, $this->targetProperty);

                if($targetProperty && $uow->getEntityState($targetProperty) !== UnitOfWork::STATE_MANAGED) {
                    $em->persist($targetProperty);
                    $change = true;
                }
            }
        }

        if($change) {
            $em->flush();
        }
    }
1205754
public function prePersist(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Publish active objects immediately.
        if ($object->isActive()) {
            $object->setPublished(true);
        } else {
            $object->setPublished(false);
        }
    }