@param string $entityId
@param string $id
@param \DateTime $expiryTime

@return void
197428
public function set($entityId, $id, \DateTime $expiryTime) {
        $idEntry = $this->manager->find(IdEntity::class, ['entityId' => $entityId, 'id' => $id]);
        if (null == $idEntry) {
            $idEntry = new IdEntity();
        }
        $idEntry->setEntityId($entityId)
            ->setId($id)
            ->setExpiry($expiryTime);
        $this->manager->persist($idEntry);
        $this->manager->flush();
    }
938552
@Override
    public void setHiddenExpiryTime(long expiryTime)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            SibTr.entry(tc, "setHiddenExpiryTime", Long.valueOf(expiryTime));
        }
        hiddenExpiryTime = expiryTime;
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            SibTr.exit(tc, "setHiddenExpiryTime");
        }
    }
881454
public void addEntityId(long entityId)
    {
        if(this.entityIds == null)
            this.entityIds = new ArrayList<Long>();
        this.entityIds.add(entityId);
    }
720722
static function setIsValid( $id, $isValid )
    {
        $dateTime = time();
        $isValid = (int) $isValid;
        eZPersistentObject::updateObjectList( array( 'definition' => eZURL::definition(),
                                                     'update_fields' => array( 'is_valid' => $isValid,
                                                                               'modified' => $dateTime ),
                                                     'conditions' => array( 'id' => $id ) ) );
    }
374864
public function acquireLock($entityId, $lockType, $expirationSeconds = null, $retryTimeoutSeconds = null)
        {
            /* Sanitize */
            
            if (is_null($expirationSeconds)) {
                $expirationSeconds = (int)config('locking.expiration_seconds', 30);
            }
            
            if (is_null($retryTimeoutSeconds)) {
                $retryTimeoutSeconds = (int)config('locking.retry_timeout_seconds', 10);
            }
            
            /* Initialize */

            $lock = null;

            if (is_null(Auth::user())) {
                throw new LockTimeoutException();
            }
            $userId = Auth::user()->id;

            /* Attempt to acquire the desired lock */

            $timestampEnd = time() + $retryTimeoutSeconds;
            while (is_null($lock) && time() <= $timestampEnd) {
                /* Determine whether a more important lock is set on the requested entity */

                $needToSleep = false;

                switch ($lockType) {
                    case $this::READ_LOCK:
                        if ($this->isWriteLocked($entityId)) {
                            $needToSleep = true;
                        }

                        break;

                    case $this::WRITE_LOCK:
                        /* We need to check all active locks for this entity */

                        $locks = $this->getLocks($entityId);
                        $activeLockCount = $this->getLocks($entityId)->filter(function ($lock, $key) use ($userId) {
                            // (new Dumper())->dump($lock);
                            return Locking::WRITE_LOCK == $lock->lock_type || $lock->user_id != $userId;
                        })->count();

                        $needToSleep = (0 != $activeLockCount);

                        break;
                }

                if ($needToSleep) {
                    usleep(500000);
                    continue;
                }

                $lock = Lock::create([
                    'user_id'    => Auth::user()->id,
                    'entity_id'  => $entityId,
                    'lock_type'  => $lockType,
                    'expires_at' => Carbon::now()->addSeconds($expirationSeconds),
                ]);
            }

            if (is_null($lock)) {
                throw new LockTimeoutException();
            }

            /* Return lock */

            return $lock->id;
        }
1228550
public function ___expire($id)
    {
        $metadatas = $this->_getMetadatas($id);
        if ($metadatas) {
            $metadatas['expire'] = 1;
            $this->_setMetadatas($id, $metadatas);
        }
    }
1170892
public function assignValuesToCode(TokenInterface $token, int $expirationInSeconds): void
    {
        try {
            $query = $this->getConnection()->createQueryBuilder();

            $now   = $this->ignoreException(function (): DateTimeImmutable {
                return new DateTimeImmutable();
            });
            $dbNow = $this->createTypedParameter($query, $now);

            $earliestExpired = $this->ignoreException(function () use ($now, $expirationInSeconds) : DateTimeImmutable {
                /** @var DateTimeImmutable $now */
                return $now->sub(new DateInterval("PT{$expirationInSeconds}S"));
            });

            $schema = $this->getDatabaseSchema();
            $query
                ->update($this->getTableNameForWriting())
                ->where($schema->getTokensCodeColumn() . '=' . $this->createTypedParameter($query, $token->getCode()))
                ->andWhere(
                    $schema->getTokensCodeCreatedAtColumn() . '>' .
                    $this->createTypedParameter($query, $earliestExpired)
                )
                ->set($schema->getTokensValueColumn(), $this->createTypedParameter($query, $token->getValue()))
                ->set($schema->getTokensTypeColumn(), $this->createTypedParameter($query, $token->getType()))
                ->set($schema->getTokensValueCreatedAtColumn(), $dbNow);

            if ($token->getRefreshValue() !== null) {
                $query
                    ->set(
                        $schema->getTokensRefreshColumn(),
                        $this->createTypedParameter($query, $token->getRefreshValue())
                    )->set($schema->getTokensRefreshCreatedAtColumn(), $dbNow);
            }

            $numberOfUpdated = $query->execute();
            assert(is_int($numberOfUpdated) === true);
        } /** @noinspection PhpRedundantCatchClauseInspection */ catch (DBALException $exception) {
            $message = 'Assigning token values by code failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
266096
public function populate($id, $recipient = null, $backupCodeIdentifier = null, $totpIdentifier = null)
    {
        if (empty($id)) {
            throw new EntityException('No messages id supplied', EntityException::NO_MESSAGE_ID_SUPPLIED);
        }
        if ($recipient === null && $backupCodeIdentifier === null && $totpIdentifier === null) {
            throw new EntityException('No recipient, backup code identifier or totp identifier supplied', EntityException::INVALID_FIELDS);
        }

        $params = [];
        if ($recipient !== null) {
            $params['recipient'] = $recipient;
        }
        if ($backupCodeIdentifier !== null) {
            $params['backupCodeIdentifier'] = $backupCodeIdentifier;
        }
        if ($totpIdentifier !== null) {
            $params['totpIdentifier'] = $totpIdentifier;
        }

        $this->sendApiCall(self::ACTION_RETRIEVE, $this->getCreateUrl() . '/' . urlencode($id) . '?' . http_build_query($params));
    }
612004
@Transactional
  @PostMapping(value = "/{entityTypeId}/{id}", params = "_method=PUT")
  @ResponseStatus(OK)
  public void updatePost(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("id") String untypedId,
      @RequestBody Map<String, Object> entityMap) {
    updateInternal(entityTypeId, untypedId, entityMap);
  }
395461
protected function entityNotFound($entityId)
    {
        throw new NotFoundHttpException(
            json_encode([
                "error" => sprintf("%s %s %d not found", $this->objName, $this->idParameterName, $entityId)
            ])
        );
    }
85703
public function setRefreshToken($token, $clientId, $userId, $expiryTimestamp, $scope = null)
    {
        $refreshTokenDataMapper = $this->getTokenDataMapper(Entity\RefreshToken::class);

        $client = $this->getClientDataMapper()->findByUuid($clientId);

        if (! $refreshToken = $refreshTokenDataMapper->findByToken($token)) {
            $refreshToken = new Entity\RefreshToken(null, $token, $client);
        } else {
            $refreshToken->setClient($client);
        }

        if ($userId) {
            $user = $this->getUserDataMapper()->findByUuid($userId);
            if ($user instanceof $this->userClass) {
                $refreshToken->setUser($user);
            }
        }

        $expiryDate = is_int($expiryTimestamp) ? new DateTime('@' . $expiryTimestamp) : null;
        $refreshToken->setExpiryDate($expiryDate);

        if ($scope) {
            $scopes = $this->getScopeDataMapper()->findScopes(explode(' ', $scope));
            $refreshToken->setScopes($scopes);
        }

        $refreshTokenDataMapper->save($refreshToken);
    }
1096176
@Override
    public void renew(IEntityLock lock, int duration) throws LockingException {
        if (isValid(lock)) {
            Date newExpiration = getNewExpiration(duration);
            getLockStore().update(lock, newExpiration);
            ((EntityLockImpl) lock).setExpirationTime(newExpiration);
        } else {
            throw new LockingException("Could not renew " + lock + " : lock is invalid.");
        }
    }
267932
public function setContainerId(EntityInterface $entity) : void
    {
        $this->containerId = self::TABLE_PREFIX . md5($entity->id);
    }
314024
protected function handleLastId($entity, $id)
    {
        $entity = $this->getUserInputEntity($entity);
        $this->lastId = $id;
        $entity = $this->makeSQLUnsafe($entity);
        $this->saveLastId($entity, $this->lastId);
        $this->setKeyword($entity . '_id', $this->lastId);
    }
416393
private void addEntityID(Map<String, String> requestParameters, StringBuilder uri) {
        if (StringUtils.hasText(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_ID))) {
            uri.append("/").append(requestParameters.get(RequestElements.REQ_PARAM_ENTITY_ID));
        }
    }
445818
public function delete($entityId)
    {
        $this->preDelete($entityId);
        $return = $this->doDelete($entityId);
        $this->postDelete($entityId);

        return $return;
    }
335141
public function savePropertyId($propertyId, $id = false)
    {
        $em = $this->getEntityManager();
        $config = $id ? $this->find($id) : $this->findFirst();
        $config->setPropertyId($propertyId);
        $em->persist($config);
        $em->flush();
    }