setPersistent

Retorna valor lógico indicando se o registro será persistido ou não

@param boolean $persists
427615
public function setPersistent($persists)
    {
        if (is_string($persists)) {
            $persists = $persists === 'true' ? true : false;
        }
        $this->persistent = $persists;
    }
1110172
protected function persistObjects()
    {
        $this->visitedDuringPersistence = new \SplObjectStorage();
        foreach ($this->aggregateRootObjects as $object) {
            $this->persistObject($object, null);
        }
        foreach ($this->changedEntities as $object) {
            $this->persistObject($object, null);
        }
    }
338629
public function getPersistence()
    {
        if (null === $this->persistence) {
            $this->persistence = (isset($this->options['persistence']) && $this->options['persistence'] == true);
        }
        
        return $this->persistence;
    }
1265573
public function setBlamesOnNodeForPersist(PersistEvent $event)
    {
        $document = $event->getDocument();

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

        $this->setBlamesOnNode(
            $document,
            $event->getNode(),
            $event->getLocale(),
            $event->getAccessor(),
            $event->getOption('user')
        );
    }
180354
public function set($values)
    {
        if (! is_array($values)) {
            $values = array($values);
        }
        $this->values = $values;
        $this->snapshot();
        $this->tracker->markOverridden();
        return true;
    }
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));
        }
    }
1067987
@Override
    public void setPersistentMapping(String persistentMapping) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setPersistentMapping", persistentMapping);

        if (persistentMapping == null) {
            throw (JMSException) JmsErrorUtils.newThrowable(
                                                            JMSException.class,
                                                            "INVALID_VALUE_CWSIA0261",
                                                            new Object[] { "persistentMapping", null },
                                                            tc
                            );
        }

        if (persistentMapping.equals(ApiJmsConstants.MAPPING_BEST_EFFORT_NONPERSISTENT) ||
            persistentMapping.equals(ApiJmsConstants.MAPPING_EXPRESS_NONPERSISTENT) ||
            persistentMapping.equals(ApiJmsConstants.MAPPING_RELIABLE_NONPERSISTENT) ||
            persistentMapping.equals(ApiJmsConstants.MAPPING_RELIABLE_PERSISTENT) ||
            persistentMapping.equals(ApiJmsConstants.MAPPING_ASSURED_PERSISTENT) ||
            persistentMapping.equals(ApiJmsConstants.MAPPING_NONE)) {
            jcaManagedConnectionFactory.setPersistentMapping(persistentMapping);
        }
        else if (persistentMapping.equals(ApiJmsConstants.MAPPING_AS_SIB_DESTINATION)) {
            jcaManagedConnectionFactory.setPersistentMapping(ApiJmsConstants.MAPPING_NONE);
        }
        else {
            throw (JMSException) JmsErrorUtils.newThrowable(
                                                            JMSException.class,
                                                            "INVALID_VALUE_CWSIA0261",
                                                            new Object[] { "persistentMapping", persistentMapping },
                                                            tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setPersistentMapping");
    }
1088845
public function persistAll($onlyWhitelistedObjects = false)
    {
        if ($onlyWhitelistedObjects) {
            foreach ($this->changedObjects as $object) {
                $this->throwExceptionIfObjectIsNotWhitelisted($object);
            }
            foreach ($this->removedObjects as $object) {
                $this->throwExceptionIfObjectIsNotWhitelisted($object);
            }
            foreach ($this->addedObjects as $object) {
                $this->throwExceptionIfObjectIsNotWhitelisted($object);
            }
        }

        // hand in only aggregate roots, leaving handling of subobjects to
        // the underlying storage layer
        // reconstituted entities must be fetched from the session and checked
        // for changes by the underlying backend as well!
        $this->backend->setAggregateRootObjects($this->addedObjects);
        $this->backend->setChangedEntities($this->changedObjects);
        $this->backend->setDeletedEntities($this->removedObjects);
        $this->backend->commit();

        $this->addedObjects = new \SplObjectStorage();
        $this->removedObjects = new \SplObjectStorage();
        $this->changedObjects = new \SplObjectStorage();

        $this->emitAllObjectsPersisted();
        $this->hasUnpersistedChanges = false;
    }
38717
public function setNodeOnPersist(PersistEvent $event)
    {
        $document = $event->getDocument();
        if (!$document instanceof ArticlePageDocument || $event->hasNode()) {
            return;
        }

        $pageTitle = $this->getPageTitle($document);

        // if no page-title exists use a unique-id
        $nodeName = $this->slugifier->slugify($pageTitle ?: uniqid('page-', true));
        $nodeName = $this->resolver->resolveName($event->getParentNode(), $nodeName);
        $node = $event->getParentNode()->addNode($nodeName);

        $event->setNode($node);
    }
1319195
public void setPersistentItems(boolean persist)  {
        addField(ConfigureNodeFields.persist_items, FormField.Type.bool);
        setAnswer(ConfigureNodeFields.persist_items.getFieldName(), persist);
    }
285247
public function persist(array $events)
    {
        $factory = new EventFactory();
        $events = array_map(
            function ($event) use ($factory) {
                return is_array($event) ? $factory->create($event) : $event;
            },
            $events
        );
        $this->persister()->logEvents($events);
    }
400407
protected function persistRelatedEntities($value)
    {
        if (!is_array($value) && !$value instanceof \Iterator) {
            $value = [$value];
        }
        foreach ($value as $element) {
            if (is_object($element) && $element instanceof PersistenceMagicInterface) {
                $this->persistenceManager->isNewObject($element) ? $this->persistenceManager->add($element) : $this->persistenceManager->update($element);
            }
        }
    }
698820
protected function addToPersistence($model, $defaults = []) : Model
    {
        if (!$model->persistence && $p = $this->getDefaultPersistence($model)) {
            $p->add($model, $defaults);
        }

        return $model;
    }
852092
public function persistBulk($documents)
    {
        if (empty($documents)) {
            $this->log('No more documents to index', 'info');
            return;
        }
        $this->log(sprintf('Indexing %d documents', count($documents)), 'info');
        ConnectionManager::get('auditlog_elastic')->addDocuments($documents);
    }
572409
public function setTimestampsOnNodeForPersist(PersistEvent $event)
    {
        $document = $event->getDocument();

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

        $this->setTimestampsOnNode(
            $document,
            $event->getNode(),
            $event->getAccessor(),
            $this->documentInspector->getOriginalLocale($document),
            new \DateTime()
        );
    }
811212
public function changePersistences($persistenceRepository, $persistencesMapping = null)
    {
        $this->repositories['persistence'] = $persistenceRepository;
        $this->mappings['persistence'] = $persistencesMapping ?: $this->mappings['persistence'];

        return $this;
    }
678108
public function persist(Config $config, $enable_config_per_site = self::DEFAULT_CONFIG_PER_SITE_VALUE)
    {
        if (null === $this->persistors) {
            $this->loadPersistors();
        }

        if (true === $enable_config_per_site) {
            $this->updateConfigOverridedSectionsForSite($config);
        }

        $this->doPersist($config, $config->getAllRawSections());

        // restore current config state after persist if config per site is enabled
        if (true === $enable_config_per_site) {
            $override_sections = $config->getRawSection('override_site');
            $site_uid = $this->application->getSite()->getUid();
            if (is_array($override_sections) && array_key_exists($site_uid, $override_sections)) {
                foreach ($override_sections[$site_uid] as $section_name => $section_settings) {
                    $config->setSection($section_name, $section_settings);
                }
            }
        }
    }