Callback method called when a modified entity is going to be saved.

@param LifecycleEventArgs $args
774882
public function postUpdate(LifecycleEventArgs $args)
    {
        $entity = $args->getObject();
        if ($entity instanceof PackageVersionEntity) {
            $em = $args->getObjectManager();
            /* @var \Doctrine\ORM\EntityManager $em */
            $unitOfWork = $em->getUnitOfWork();
            $changeSet = $unitOfWork->getEntityChangeSet($entity);
            if (in_array('version', $changeSet)) {
                $this->refreshPackageLatestVersion($em, $entity->getPackage());
            }
        }
    }
436296
public function postLoad(LifecycleEventArgs $eventArgs)
    {
        $entity = $eventArgs->getEntity();

        if ($entity instanceof View) {
            $entity->setReferences([$entity->getCurrentLocale() => new ViewReference($entity->getId())]);
            $viewReferences = $this->viewReferenceRepository->getReferencesByParameters([
                'viewId'     => $entity->getId(),
                'templateId' => $entity->getId(),
            ], true, false, 'OR');
            foreach ($viewReferences as $viewReference) {
                if ($viewReference->getLocale() === $entity->getCurrentLocale()) {
                    if ($entity instanceof WebViewInterface && $viewReference instanceof ViewReference) {
                        $entity->setReference($viewReference, $viewReference->getLocale());
                        $entity->setUrl($viewReference->getUrl());
                    } elseif ($entity instanceof BusinessTemplate) {
                        $entity->setReferences([
                            $entity->getCurrentLocale() => $this->viewReferenceBuilder->buildViewReference($entity, $eventArgs->getEntityManager()),
                        ]);
                    }
                }
            }
        }
    }
1358186
public function afterUpdate(&$args) {
        $model        = &$args[0];
        $affectedRows = &$args[1];
        $data         = &$args[2];
        $where        = &$args[3];

        $pks = $this->_getPrimaryKeysOfAffectedRows($model, $where);
        $this->_afterSave($model, $pks);
    }
1061951
public function preUpdate(LifecycleEventArgs $eventArgs)
    {
        $entity = $eventArgs->getObject();

        if (!$this->hasTrait($entity, 'Blast\BaseEntitiesBundle\Entity\Traits\Timestampable')) {
            return;
        }

        $this->logger->debug(
            '[TimestampableListener] Entering TimestampableListener for « preUpdate » event'
        );

        $now = new DateTime('NOW');
        $entity->setUpdatedAt($now);
    }
118881
public function preUpdate(LifecycleEventArgs $eventArgs)
    {
        $document = $eventArgs->getDocument();
        if (!$document instanceof JobInterface) {
            return;
        }
        $dm = $eventArgs->getDocumentManager();
        $changeset = $dm->getUnitOfWork()->getDocumentChangeset($document);
        
        if (!isset($changeset['user'])) {
            return;
        }
        
        $userId = $document->getUser()->getId();

        $dm->createQueryBuilder('Applications\Entity\Application')
            ->update()->multiple(true)
            ->field('refs.jobs.userId')->set($userId)
            ->field('refs.jobs.__id__')->equals($document->getId())
            ->field('refs.jobs.userId')->notEqual($userId)
            ->getQuery()
            ->execute();
    }
913323
public function postLoad(LifecycleEventArgs $args)
    {
        $object = $args->getObject();
        if(get_class($object) === $this->targetClass) {
            $this->loadEntity($object);
        }
    }
515811
public function postUpdate(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof MediaInterface) {
            $this->getProvider($args)->postUpdate($args->getObject());
        }
    }
1050306
public function postPersist(LifecycleEventArgs $args): void
    {
        // Get the object and make sure it is what we need.
        $object = $args->getObject();
        if (!$object instanceof PublishableInterface) {
            return;
        }

        // Execute published event after the object is persisted.
        if ($object->isPublished()) {
            $event = new EntityPublishedEvent($object);
            $this->event_dispatcher->dispatch(EntityPublishedEvent::NAME, $event);
        }
    }
78587
public function prePersist(LifecycleEventArgs $args)
    {
        if ($args->getObject() instanceof MediaInterface) {
            $this->getProvider($args)->prePersist($args->getObject());
        }
    }
60136
public function prePersist(LifecycleEventArgs $args)
    {
        $object = $args->getObject();
        if ($object instanceof UploadObjectInterface) {
            $this->prepareUploadFileReferences($object);
        }
    }
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);
        }
    }
984975
public function prePersist(LifecycleEventArgs $eventArgs)
	{
		$entity = $eventArgs->getEntity();

		if ($entity instanceof TimestampableInterface) {
			$now = new \DateTime();
			$entity->setModificationTime($now);
			$entity->setCreationTime($now);
		}
	}
132290
public function prePersist(LifecycleEventArgs $event)
    {
        $entity = $event->getEntity();

        if ($entity instanceOf ImageInterface) {
            if ($entity->hasFile()) {
                $this->uploader->upload($entity);
            }
        }
    }
374962
public function onFlush($args)
    {
        if (!$this->isDirty) {
            /** @var $em \Doctrine\ORM\EntityManager */
            $em = $args->getEntityManager();

            /** @var $uow \Doctrine\ORM\UnitOfWork */
            $uow = $em->getUnitOfWork();

            $array = array(
                $uow->getScheduledEntityUpdates(),
                $uow->getScheduledEntityDeletions(),
                $uow->getScheduledEntityInsertions(),
                $uow->getScheduledCollectionUpdates(),
                $uow->getScheduledCollectionDeletions(),
                $uow->getScheduledCollectionDeletions(),
                $uow->getScheduledCollectionUpdates()
            );

            foreach ($array as $obj) {
                foreach ($obj as $element) {
                    if ($element instanceof Entity\Message
                     || $element instanceof Entity\MessageTranslation
                    ) {
                        $this->isDirty = true;
                        break 2;
                    }
                }
            }
        }

        $this->flushCache();
    }
1186132
public function preRemove(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if ($entity instanceof Bug) {
            $this->messageBus->dispatch(new RemoveScreenshotsMessage($entity->getId(), $entity->getTask()->getModel()));
        }
    }
600226
public function prePersist(LifecycleEventArgs $eventArgs)
    {
        $entity = $eventArgs->getObject();

        if (!$this->hasTrait($entity, 'Blast\BaseEntitiesBundle\Entity\Traits\Timestampable')) {
            return;
        }

        $this->logger->debug(
            '[TimestampableListener] Entering TimestampableListener for « prePersist » event'
        );

        $now = new DateTime('NOW');
        $entity->setCreatedAt($now);
        $entity->setUpdatedAt($now);
    }
737233
public function preUpdate(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if (in_array('BespokeSupport\CreatedUpdatedDeletedBundle\Traits\EntityUpdatedTrait', class_uses(get_class($entity)))) {
            /**
             * @var $entity \BespokeSupport\CreatedUpdatedDeletedBundle\Traits\EntityUpdatedTrait
             */
            $entity->setUpdated(new \DateTime());
        }
    }