Commit the properties, which are only staged on the structure yet.

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

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

        $document->getStructure()->commitStagedData($event->getOption('clear_missing_content'));
    }
762016
public function commit()
    {
        // Save deferred items
        $deferredItems = $this->getDeferredItems();

        foreach ($deferredItems as $deferredItem) {
            $this->save($deferredItem);
        }
    }
590379
public function afterSave(Event $event, EntityInterface $entity)
    {
        $property = $this->versionAssociation()->getProperty();
        $entity->unsetProperty($property);
    }
1220419
public void commit()
    {
        onCommit(eventLogQueue.getInsertEvents());
        onCommit(eventLogQueue.getUpdateEvents());
        onCommit(eventLogQueue.getDeleteEvents());
    }
149486
public function setStructureTypeToParent(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument
            || LocalizationState::GHOST === $this->documentInspector->getLocalizationState($document->getParent())
            || $document->getStructureType() === $document->getParent()->getStructureType()
        ) {
            return;
        }

        $document->getParent()->setStructureType($document->getStructureType());
        $this->documentManager->persist($document->getParent(), $event->getLocale());
    }
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);
            }
        }
    }
1089389
public function commit()
    {
        foreach ($this->registry->all() as $entity) {
            switch($this->getEntityState($entity)) {
                case EntityStates::NEW_ENTITY:
                    $this->commandBus->dispatch(new NewCommand($entity));
                    break;
                case EntityStates::EDITED_ENTITY:
                    $changeSet = $this->changeBuilder->buildChanges($this->registry->getSnapshot($entity), $entity);
                    $this->commandBus->dispatch(new EditCommand($entity, $changeSet));
                    break;
                case EntityStates::REMOVED_ENTITY:
                    $this->commandBus->dispatch(new RemoveCommand($entity));
                    break;
            }
        }

        $this->registry->cleanRemoved();
        $this->registry->makeNewSnapshots();
    }
1102739
public function handlePersist(PersistEvent $event)
    {
        $document = $event->getDocument();

        if (false == $document instanceof OrderBehavior) {
            return;
        }

        if ($document->getSuluOrder()) {
            return;
        }

        $node = $event->getNode();
        $parent = $node->getParent();
        $nodeCount = count($parent->getNodes());
        $order = ($nodeCount + 1) * 10;

        $document->setSuluOrder($order);
    }
178508
public function afterCreate(PersistenceEvent $event) {
    if ($event->getAction() == PersistenceAction::CREATE) {
      $oldOid = $event->getOldOid();
      $oldOidStr = $oldOid != null ? $oldOid->__toString() : null;
      if ($oldOidStr != null && isset($this->createdTranslations[$oldOidStr])) {
        foreach ($this->createdTranslations[$oldOidStr] as $translation) {
          $translation->setValue('objectid', $event->getObject()->getOID()->__toString());
        }
      }
    }
  }
499116
public function newCommit(NewCommitEvent $event)
    {
        $commit = $event->getCommit();

        $related = $this->matcher->getRelatedIssues($commit);
        $commit->setIssuesRelated($related);

        $this->repository->persist($commit);
    }
1342807
public function handlePersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        $node = $event->getNode();
        $propertyName = $this->propertyEncoder->systemName(static::FIELD);
        if (!$document instanceof PageBehavior) {
            return;
        }

        $parentDocument = $document->getParent();

        $page = 1;
        foreach ($parentDocument->getChildren() as $child) {
            if (!$child instanceof PageBehavior) {
                continue;
            }

            ++$page;

            if ($child === $document) {
                break;
            }
        }

        $node->setProperty($propertyName, $page);
        $document->setPageNumber($page);
    }
692296
public function commit()
    {
        try {
            $this->persistenceHandler->commit();
        } catch (Exception $e) {
            throw new RuntimeException($e->getMessage(), 0, $e);
        }
    }
792035
public function afterSave(Save $event)
    {
        /** @var Entity $entity */
        $entity = $event->getTarget();
        $entity->loadRelations = false;
        $prop = $this->getPropertyName();
        $relPrk = Entity\Manager::getInstance()->get($this->getRelatedEntity())
            ->getEntity()->getPrimaryKey();
        $entPrk = $entity->getPrimaryKey();
        
        if (isset($entity->$prop) && is_array($entity->$prop)) {
            $this->beforeDelete(new Delete(['primaryKey' => $entity->$entPrk]));
            foreach ($entity->$prop as $object) {
                $relVal = $object;
                if ($object instanceof Entity) {
                    $relVal = $object->$relPrk;
                }

                Sql::createSql($entity->getAdapter())
                    ->insert($this->getRelationTable())
                    ->set(
                        [
                            $this->getForeignKey() => $entity->$entPrk,
                            $this->getRelatedForeignKey() => $relVal
                        ]
                    )
                    ->execute();
            }
        }
        $entity->loadRelations = true;
    }
1161509
private function mutate($event)
    {
        $method = 'on' . (string) new EventName($event);

        if (method_exists($this, $method)) {
            $this->$method($event);
        } else {
            throw new \RuntimeException(sprintf('Method %s does not exist on aggregate %s', $method, get_class($this)));
        }
    }
924971
public function handlePersist(PersistEvent $event)
    {
        /** @var SecurityBehavior $document */
        $document = $event->getDocument();

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

        $node = $event->getNode();

        foreach ($document->getPermissions() as $roleId => $permission) {
            // TODO use PropertyEncoder, once it is refactored
            $node->setProperty('sec:role-' . $roleId, $this->getAllowedPermissions($permission));
        }
    }
775270
public function save(EventInterface $event)
    {
        $this->events[(string) $event->uuid()][] = new $event(
            $event->uuid(),
            $event->type(),
            $event->body(),
            $this->count($event->uuid()),
            $event->occurredOn()->format('Y-m-d H:i:s.u')
        );
    }
375158
public function add($event) {
        $event->setParent($this->_parent);
        $this->_events[$event->getName()] = $event;
    }