Wrapper to the Doctrine2 persist function.

This function will call the 'persist' function on the Doctrine2 Entity Manager.

@see http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/index.html
@return null
511505
public static function persist() {
		if(self::$entity_manager == null)
			self::initialize();

		return call_user_func_array(array(self::$entity_manager, "persist"), func_get_args());
	}
334169
public function getPersistentFields()
    {
        if (empty($this->persistentFields)) {

            $persistentFields = $this->getPropertyContainer()->getFields('hasMany');
            if (!empty($persistentFields)) {
                $persistentFields = array_filter(
                    $persistentFields,
                    function (PropertyContract $property) {
                        if (!$property->getBehavior()->isPersistent()) {
                            return false;
                        }

                        if (!$property->getBehavior() instanceof IntegerBehavior) {
                            return true;
                        }

                        if ($property->getBehavior()->getIncrementalBehavior() == 'database') {
                            return false;
                        }

                        return true;
                    }
                );
            }
            $this->persistentFields = $persistentFields;
        }

        return $this->persistentFields;
    }
272826
public function refresh()
    {
        $app = Facade::getFacadeApplication();
        $db = $app->make('database')->connection();
        $pkgHandle = false;
        if ($this->pkgID > 0) {
            $pkgHandle = $this->getPackageHandle();
        }

        $class = \Concrete\Core\Block\BlockType\BlockType::getBlockTypeMappedClass($this->btHandle, $pkgHandle);
        $bta = $app->build($class);

        $this->loadFromController($bta);

        $em = \ORM::entityManager();
        $em->persist($this);
        $em->flush();

        $env = Environment::get();
        $r = $env->getRecord(DIRNAME_BLOCKS . '/' . $this->btHandle . '/' . FILENAME_BLOCK_DB, $this->getPackageHandle());
        if ($r->exists()) {
            $parser = Schema::getSchemaParser(simplexml_load_file($r->file));
            $parser->setIgnoreExistingTables(false);
            $toSchema = $parser->parse($db);

            $fromSchema = $db->getSchemaManager()->createSchema();
            $comparator = new \Doctrine\DBAL\Schema\Comparator();
            $schemaDiff = $comparator->compare($fromSchema, $toSchema);
            $saveQueries = $schemaDiff->toSaveSql($db->getDatabasePlatform());
            foreach ($saveQueries as $query) {
                $db->query($query);
            }
        }
    }
194847
public function persistAndFlush($entity, $persistAll = false, $entityManager = null)
    {
        $entityManager = $this->getEntityManager($entityManager);

        $entityManager->persist($entity);
        $entityManager->flush($persistAll ? null : $entity);
    }
1035343
public function save(Persistable $persistable) : void
    {
        $data = $this->serializer->serialize($persistable);

        $success = $this->connector->set($this->key, $data);

        if (!$success) {
            throw new RuntimeException('Failed to save persistable'
                . ' to the database.');
        }
    }
395615
protected function persist()
    {
        if (false === file_put_contents($this->filename, $this->serialize())) {
            // @codeCoverageIgnoreStart
            throw new RuntimeException('Unable to open file ' . $this->filename);
            // @codeCoverageIgnoreEnd
        }
    }
296977
public static function createQuery() {
		if(self::$entity_manager == null)
			self::initialize();

		return call_user_func_array(array(self::$entity_manager, "createQuery"), func_get_args());
	}
342016
protected function getCachePersistence()
    {
        if (is_null($this->cachePersistence) && $this->hasOption(static::OPTION_CACHE_PERSISTENCE)) {
            $persistenceOption = $this->getOption(static::OPTION_CACHE_PERSISTENCE);
            $this->cachePersistence = (is_object($persistenceOption))
                ? $persistenceOption
                : common_persistence_KeyValuePersistence::getPersistence($persistenceOption);
        }

        return $this->cachePersistence;
    }
485538
public function persistAndFlush($entities, $clearAfterPush = false)
    {
        if (0 === func_num_args()) {
            throw new \LogicException('Missing arguments');
        }

        $persists = [];
        $entities = func_get_args();
        $clearAfterPush = false;

        foreach ($entities as $entity) {
            if (true === $entity || true === is_string($entity)) {
                $clearAfterPush = $entity;

                continue;
            }

            if (true === is_array($entity)) {
                $persists = array_merge($persists, $entity);
            } else {
                $persists[] = $entity;
            }
        }

        foreach ($persists as $persist) {
            $this->getDoctrineManager()->persist($persist);
        }

        $this->getDoctrineManager()->flush();

        /* Clear after push */
        if (false !== $clearAfterPush) {
            if (true === $clearAfterPush) {
                $this->getDoctrineManager()->clear();

                return $this;
            }

            $this->getDoctrineManager()->clear($clearAfterPush);
        }

        return $this;
    }
328030
public function _getEntityManager()
    {
        if ($this->kernel === null) {
            $this->fail('Symfony2 platform module is not loaded');
        }
        if (!isset($this->permanentServices[$this->config['em_service']])) {
            // try to persist configured EM
            $this->persistService($this->config['em_service'], true);

            if ($this->_getContainer()->has('doctrine')) {
                $this->persistService('doctrine', true);
            }
            if ($this->_getContainer()->has('doctrine.orm.default_entity_manager')) {
                $this->persistService('doctrine.orm.default_entity_manager', true);
            }
            if ($this->_getContainer()->has('doctrine.dbal.backend_connection')) {
                $this->persistService('doctrine.dbal.backend_connection', true);
            }
        }
        return $this->permanentServices[$this->config['em_service']];
    }
939080
public function getPersistence()
    {
        $persistenceOption = $this->getOption(self::DIAGNOSTIC_PERSISTENCE);
        $persistence = (!empty($persistenceOption)) ? $persistenceOption : 'default';
        return \common_persistence_Manager::getPersistence($persistence);
    }
200324
public function atomic($f, Persistence $persistence = null)
    {
        if (!$persistence) {
            $persistence = $this->persistence;
        }

        return $persistence->atomic($f);
    }
573924
public function persist(PersistableInterface $persistable, $remember = false)
    {
        try
        {
            if ($this->single)
            {
                $this->flush($persistable);
            }

            $code = $persistable->generatePersistenceCode();

            $this->session->put($code);

            if ($remember === true) {
                $this->cookie->put($code);
            }

            $persistence = $this->create($persistable, $code);

            $entityManager = $this->getEntityManager();
            $entityManager->persist($persistence);
            $entityManager->flush();

            return true;
        }
        catch (\Exception $e)
        {
            return false;
        }
    }
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);
            }
        }
    }
1354373
public function persist(AbstractEntity $entity)
    {
        /** @var InserterTrait $this */
        if ($entity->isNew()) {
            return $this->insert($entity);
        }

        /** @var UpdaterTrait $this */
        return $this->update($entity);
    }
1222246
public function save(){
    $table  = static::persistenceOptions('table');
    $op     = static::persistenceOptions();
    $cb     = static::persistenceSave();

    // Use standard persistence on DB layer
    $cb = $cb ? Closure::bind($cb, $this) : [$this,'persistenceSaveDefault'];
    return $cb($table,$op);
  }
1111761
public function saveEntityTranslations()
    {
        if (empty($this->translationsBackup)) {
            return null;
        }

        foreach ($this->translationsBackup as $formHash => $entities) {
            foreach ($entities as $entityData) {
                $entity = $entityData['object'];
                $entityIdGetter = $entityData['idGetter'];
                $entityAlias = $entityData['alias'];
                $fields = $entityData['fields'];

                foreach ($fields as $fieldName => $locales) {
                    foreach ($locales as $locale => $translation) {
                        $this
                            ->entityTranslationProvider
                            ->setTranslation(
                                $entityAlias,
                                $entity->$entityIdGetter(),
                                $fieldName,
                                $translation,
                                $locale
                            );
                    }
                }
            }
        }

        $this
            ->entityTranslationProvider
            ->flushTranslations();
    }