Save a object in the given session variable.
@param $umi The universal model id (oid with server prefix)
@param $obj The object to register.
@param $buildDepth The depth the object was loaded.
@param $varName The session variable name.
509504
protected function registerObject(ObjectId $umi, PersistentObject $obj, $buildDepth, $varName) {
    if ($buildDepth == 0) {
      $buildDepth=BuildDepth::SINGLE;
    }
    // save the object in the session
    $umiStr = $umi->toString();
    $objects = $this->session->get($varName);
    if (!isset($objects[$umiStr])) {
      $objects[$umiStr] = [];
    }
    $objects[$umiStr][$buildDepth] = $obj;
    $this->session->set($varName, $objects);
  }
830886
public function save($obj, $where = [], $isUpdate = false)
    {
        $this->startProfiling();

        $result = parent::save($obj, $where, $isUpdate);

        $this->endProfiling('save', $result);
        $this->clearParams();

        return $result;
    }
362664
public function initializeObject()
    {
        if ($this->request === null) {
            $httpRequest = Request::createFromEnvironment();
            $this->request = $this->objectManager->get(\TYPO3\Flow\Mvc\ActionRequest::class, $httpRequest);
        }

        $uriBuilder = new UriBuilder();
        $uriBuilder->setRequest($this->request);

        $this->setControllerContext(new ControllerContext(
            $this->request,
            new Response(),
            new Arguments(array()),
            $uriBuilder
        ));
    }
554330
public function initializeObject($obj)
    {
        if ($obj instanceof Proxy) {
            $obj->__load();
        } elseif ($obj instanceof PersistentCollectionInterface) {
            $obj->initialize();
        }
    }
637838
function Snapshot (id, obj) {
  if (!id) {
    var errIdMsg = 'id not injected!';
    debug(errIdMsg);
    throw new Error(errIdMsg);
  }

  if (!obj) {
    var errObjMsg = 'object not injected!';
    debug(errObjMsg);
    throw new Error(errObjMsg);
  }

  if (!obj.aggregateId) {
    var errAggIdMsg = 'object.aggregateId not injected!';
    debug(errAggIdMsg);
    throw new Error(errAggIdMsg);
  }

  if (!obj.data) {
    var errDataMsg = 'object.data not injected!';
    debug(errDataMsg);
    throw new Error(errDataMsg);
  }

  this.id = id;
  this.streamId = obj.aggregateId;
  this.aggregateId = obj.aggregateId;
  this.aggregate = obj.aggregate || null;
  this.context = obj.context || null;
  this.commitStamp = null;
  this.revision = obj.revision;
  this.version = obj.version;
  this.data = obj.data;
}
1343544
function buildSandbox(id) {
    if (!has(id)) {
        throw new Error('Sandbox name is required to build a sandbox.');
    }

    // Create module instance specific sandbox
    var sandbox = {
        type: self.type,
        object: self.object,
        array: self.array,
        log: self.log
    };

    // Add extensions to sandbox
    extensions.forEach(function (extension) {
        try {

            // If extension has buildSandbox method use it to build sandbox
            if (is(extension, 'buildSandbox', 'function')) {
                extension.buildSandbox(sandbox);
            }

            // If extension has a sandbox object add it
            else if (has(extension, 'sandbox')) {
                    extend(sandbox, extension.sandbox);
                }

                // Otherwise extend the sandbox with the extension
                else {
                        extend(sandbox, extension);
                    }
        } catch (ex) {
            error('Fatal error during application initialization. ', 'Failed to build sandbox with extension "', extension, 'See following exception for more details.', ex);
            throw ex;
        }
    });

    return sandbox;
}
48511
public function saveEntityMap($objectManagerName)
    {
        $moduleOptions =  $this->getModuleOptions();
        $originalFlag = $this->getModuleOptions()->getFlagDisableUseEntityMapDoctrineCache();
        $moduleOptions->setFlagDisableUseEntityMapDoctrineCache(true);

        $map = $this->getEntityMapBuilder()->buildEntityMapByObjectManagerName($objectManagerName);

        $key = $this->getCacheKeyForObjectManagerName($objectManagerName);
        $resultSaveCache = $this->getCache()->save($key, $map);
        $moduleOptions->setFlagDisableUseEntityMapDoctrineCache($originalFlag);

        return $resultSaveCache;
    }
184304
@SuppressWarnings({"PMD.NPathComplexity"})
	/*package*/ URI buildUri(final String rawUrl, final String branch, final String lastKnownCommit) throws URISyntaxException {
		URIBuilder builder = new URIBuilder();
		
		/*
		 * Examples:
		 * 
		 * ssh://git@company.com/project/repository.git
		 * https://username@company.com/scm/project/repository.git
		 * ssh://git@company.com/~username/repository.git
		 * https://username@company.com/scm/~username/repository.git
		 * 
		 */
		
		String repoUrlRaw = rawUrl;
		String repoUrlProcessed = repoUrlRaw;
		
		if (repoUrlProcessed.endsWith(".git")) {
			repoUrlProcessed = repoUrlProcessed.substring(0, repoUrlProcessed.lastIndexOf(".git"));
		}
		
		URI uri = URI.create(repoUrlProcessed.replaceAll(" ", "%20"));
		
		String host = uri.getHost();
		String scheme = "ssh".equalsIgnoreCase(uri.getScheme())? "https" : uri.getScheme();
		int port = uri.getPort();
		String path = uri.getPath();
		if ((path.startsWith("scm/") || path.startsWith("/scm")) && path.length() > 4) {
			path = path.substring(4);
		}
		if (path.length() > 0 && path.charAt(0) == '/') {
			path = path.substring(1, path.length());
		}
		
		String[] splitPath = path.split("/");
		String projectKey = "";
		String repositorySlug = "";
		
		if (splitPath.length > 1) {
			projectKey = splitPath[0];
			repositorySlug = path.substring(path.indexOf('/') + 1, path.length());
		} else {
			// Shouldn't get to this case
			projectKey = "";
			repositorySlug = path;
		}
		
		String apiPath = settings.getApi() != null? settings.getApi() : "";
		
		if (apiPath.endsWith("/")) {
			apiPath = settings.getApi().substring(0, settings.getApi().length() - 1);
		}
		
		builder.setScheme(scheme);
		builder.setHost(host);
		if (port != -1) {
			builder.setPort(port);
		}
		
		builder.setPath(apiPath + "/projects/" + projectKey + "/repos/" + repositorySlug + "/commits");
		if (branch == null || branch.length() == 0) {
			builder.addParameter("until", "master");
		} else {
			builder.addParameter("until", branch.replaceAll(" ", "%20"));
		}
		
		if (lastKnownCommit != null && lastKnownCommit.length() > 0) {
			builder.addParameter("since", lastKnownCommit);
		}
		
		if (settings.getPageSize() > 0) {
			builder.addParameter("limit", String.valueOf(settings.getPageSize()));
		}
		
		return builder.build();
	}
871081
public function save($object)
    {
        if (method_exists($object, 'getContenttype')) {
            $entityName = $object->getContenttype();
        } else {
            $entityName = get_class($object);
        }
        $repo = $this->getRepository($entityName);

        return $repo->save($object);
    }
1053555
public function saveShopConfVar($sVarType, $sVarName, $sVarVal, $sShopId = null, $sModule = '')
    {
        $sShopId = $sShopId === null ? $this->_iShopId : $sShopId;
        if ($sShopId == $this->_iShopId) {
            $storedType = $this->getShopConfType($sVarName, $sModule);
            if ($sModule == Config::OXMODULE_THEME_PREFIX . $this->getConfigParam('sTheme')){
                $storedValue = $this->_aConfigParamsParentTheme[$sVarName];
            } else {
                $storedValue = $this->getConfigParam($sVarName);
            }
            if ($sVarType == 'bool') {
                //some modules that have all kinds of bool representations in metadata.php may cause
                //$sVarVal to something else then a boolean, converting the value like parent::saveShopConfVar
                //would do so we can compare it to the strored representation
                $sVarVal = (($sVarVal == 'true' || $sVarVal) && $sVarVal && strcasecmp($sVarVal, "false"));
            }

            if ($sVarType == $storedType && $sVarVal == $storedValue) {
                return false;
            }
        }
        parent::saveShopConfVar($sVarType, $sVarName, $sVarVal, $sShopId, $sModule);
        return true;
    }
69321
private function saveEvent($websiteId, $storeId, $type, $entityId, $data)
    {
        $data = $this->json->serialize($data);

        /** @var EventModel $eventModel */
        $eventModel = $this->eventFactory->create()
            ->setEntityId($entityId)
            ->setWebsiteId($websiteId)
            ->setStoreId($storeId)
            ->setEventType($type)
            ->setEventData($data);

        $this->eventRepository->save($eventModel);
    }
727551
public function save(DomainObjectInterface &$domainObject): void
    {
        if ($domainObject->getId() === 0) {
            $this->concreteInsert($domainObject);
        }

        $this->concreteUpdate($domainObject);
    }
117891
public function initializeObject(object $obj) : void
    {
        if ($obj instanceof GhostObjectInterface) {
            $obj->initializeProxy();
        } elseif ($obj instanceof PersistentCollectionInterface) {
            $obj->initialize();
        }
    }
1134906
def save_object(self, obj):
        
        self.session.add(obj)
        self.session.flush()
        return obj
1322712
public void saveProperty(DbSession session, PropertyDto property) {
    save(getMapper(session), property.getKey(), property.getUserId(), property.getResourceId(), property.getValue());
  }
830046
private final void prepareObject(ZooPC obj, long oid, boolean hollow, 
    		ZooClassDef classDef) {
//        obj.jdoNewInstance(sm); //?
        
        if (hollow) {
        	cache.addToCache(obj, classDef, oid, ObjectState.HOLLOW_PERSISTENT_NONTRANSACTIONAL);
        } else {
        	cache.addToCache(obj, classDef, oid, ObjectState.PERSISTENT_CLEAN);
        }
    }
408281
@Override
    protected Object save(final NoSqlSession session, final Object version, final boolean activateAfterSave)
    {
        try
        {
            log.debug("save:" + session);
            session.willPassivate();

            if (!session.isValid())
            {
                log.debug("save: skip saving invalidated session: id=" + session.getId());
                deleteKey(session.getId());
                return null;
            }

            ISerializableSession data;
            synchronized (session)
            {
                data = getSessionFactory().create(session);
            }
            data.setDomain(_cookieDomain);
            data.setPath(_cookiePath);
            long longVersion = 1; // default version for new sessions
            if (version != null)
            {
                longVersion = (Long) version + 1L;
            }
            data.setVersion(longVersion);

            try
            {
                if (!setKey(session.getId(), data))
                {
                    throw (new RuntimeException("unable to set key: data=" + data));
                }
            }
            catch (TranscoderException error)
            {
                throw (new IllegalArgumentException("unable to serialize session: id=" + session.getId() + ", data="
                    + data, error));
            }
            log.debug("save:db.sessions.update(" + session.getId() + "," + data + ")");

            if (activateAfterSave)
            {
                session.didActivate();
            }

            return longVersion;
        }
        catch (Exception e)
        {
            log.warn(e);
        }
        return null;
    }