根据指定的应用id或名称删除应用版本或者应用；当指定的为应用名称，则表示指定的为当前应用分组中的在线的应用。。

如果当前应用只有一个版本，则会删除这个应用的整个分组；
如果当前应用分组有多个应用，则需要当前要删除的版本不能处于在线状态。

@param string $identity 指定的应用ID或者应用名称。
@return \OpenSearch\Generated\Common\OpenSearchResult
505161
public function removeById($identity) {
        $path = $this->path . "/" . $identity;
        return $this->openSearchClient->delete($path);
    }
1112038
public function findModuleByIdentity($identity)
    {
        $field = $this->getModularIdentifier();

        if (null == $field) {
            throw new \InvalidArgumentException('The module manager is missing a modular identifier.');
        }

        return $this->repository->findOneBy([$field => $identity]);
    }
246273
protected function byId($id)
    {
        //在QueryRelate 中的 __call中也没有找到first，需要用getQuery()，它指向的是Query\Builder
        $model = $this->queryRelate->where($this->repository->getModel()->getKeyName(), $id)->getQuery()->first();

        $this->resetQueryRelate();

        return $model;
    }
88102
private function findObjectIdentityId(ObjectIdentityInterface $objectIdentity)
    {
        if ($this->objectIds->contains($objectIdentity)) {
            return $this->objectIds->offsetGet($objectIdentity);
        }

        $conn = $this->getConnection();

        $qb = $conn->createQueryBuilder();
        $qb
            ->select('id')
            ->from('acl_object_identity')
            ->where($qb->expr()->eq('type', $qb->expr()->literal($objectIdentity->getType())))
            ->andWhere($qb->expr()->eq('identifier', $qb->expr()->literal($objectIdentity->getIdentifier())));

        $id = $qb->execute()->fetchColumn();

        if ($id) {
            $this->objectIds->attach($objectIdentity, $id);
        }

        return $id;
    }
1212591
public static function getAuthorized($identity)
  	{       
        $conn = self::getDbConnection();
        $conn->executeUpdate('UPDATE users_auth SET time=? WHERE user_id=? and uniq=? and ip=?', array( time(), (int)$identity['user_id'], $identity['uniq'], $_SERVER['REMOTE_ADDR'] ));        
        $fields = $conn->fetchAssoc('SELECT A.* FROM users A LEFT JOIN users_auth B ON (A.id=B.user_id) WHERE B.user_id=? and B.uniq=?', array( (int)$identity['user_id'], $identity['uniq'] ));  
        
        if ($fields) {		
            return self::fetch($fields);
        } else {
            return false;
        }      
    }
419333
public function getIdentity()
    {
        if ($this->_result === null || !$this->_result->isValid()) {
            return null;
        }

        $identity = $this->_result->getData();
        if (!($identity instanceof IdentityInterface)) {
            $identity = $this->buildIdentity($identity);
        }

        return $identity;
    }
348162
public static function findIdentity($id) : ?Identity
    {
        $user = self::getRepository()->findActiveById($id);
        return $user ? new self($user) : null;
    }
473134
public function find($id, int $lockMode = LockMode::NONE, ?int $lockVersion = null) : ?object
    {
        if ($id === null) {
            return null;
        }

        /* TODO: What if the ID object has a field with the same name as the
         * class' mapped identifier field name?
         */
        if (is_array($id)) {
            [$identifierFieldName] = $this->class->getIdentifierFieldNames();

            if (isset($id[$identifierFieldName])) {
                $id = $id[$identifierFieldName];
            }
        }

        // Check identity map first
        $document = $this->uow->tryGetById($id, $this->class);
        if ($document) {
            if ($lockMode !== LockMode::NONE) {
                $this->dm->lock($document, $lockMode, $lockVersion);
            }

            return $document; // Hit!
        }

        $criteria = ['_id' => $id];

        if ($lockMode === LockMode::NONE) {
            return $this->getDocumentPersister()->load($criteria);
        }

        if ($lockMode === LockMode::OPTIMISTIC) {
            if (! $this->class->isVersioned) {
                throw LockException::notVersioned($this->documentName);
            }

            $document = $this->getDocumentPersister()->load($criteria);
            if ($document) {
                $this->uow->lock($document, $lockMode, $lockVersion);
            }

            return $document;
        }

        return $this->getDocumentPersister()->load($criteria, null, [], $lockMode);
    }
534460
function get_identity($id = null)
    {
        $id = (int)$id;
        // cache identities for better performance
        if (!array_key_exists($id, $this->identities)) {
            $result = $this->list_identities($id ? "AND `identity_id` = $id" : '');
            $this->identities[$id] = $result[0];
        }

        return $this->identities[$id];
    }
58236
public static function findByProvider($provider, $identifier)
    {
        $t = UserRemoteIdentity::tableName();

        return self::find()
            ->leftJoin($t, self::tableName().'.[['.self::primaryKey()[0].']]='.$t.'.[[user_id]]')
            ->andWhere($t.'.[[provider]]=:provider', [':provider' => $provider])
            ->andWhere($t.'.[[identifier]]=:identifier', [':identifier' => $identifier])
            ->one();
    }
1269934
public function findIdentityById(int $identityId): Entity\Identity
    {
        $identity = new Entity\Identity;
        $identity->setId($identityId);

        $this->repository->load($identity, Entity\Identity::class);

        if ($identity->getAccountId() === null) {
            $this->logger->notice('identity not found', [
                'input' => [
                    'id' => $identityId,
                ],
            ]);

            throw new IdentityNotFound;
        }

        return $identity;
    }
342609
public function getIdentity(): ?IdentityInterface
    {
        if (!$this->identity) {
            // check user agent
            if (Session::get('auth:agent') === Request::getServer('HTTP_USER_AGENT')) {
                $this->identity = Session::get('auth:identity');
            } else {
                $this->clearIdentity();
            }
        }
        return $this->identity;
    }
1055114
public function checkIdExists($identity)
    {
        if ($identity == null) {
            return false;
        }
        return static::find()->where([$this->idAttribute => $identity])->exists();
    }
207762
private function getCacheEntity($id)
    {
        $contextual_id = $this->getContextualId($id);

        if (null === $this->_entity || $this->_entity->getId() !== $contextual_id) {
            $this->_entity = $this->_repository->find($contextual_id);
        }

        return $this->_entity;
    }
496430
public function detach(Identity $identity): self
    {
        $this->states = $this->states->map(static function(
            State $state,
            MapInterface $entities
        ) use (
            $identity
        ) {
            return $entities->remove($identity);
        });

        return $this;
    }
2858
private function matchRelationship(
        Identity $identity,
        object $entity,
        Query $query
    ): Query {
        $meta = ($this->metadata)(\get_class($entity));
        $name = $this->name->sprintf(\md5($identity->value()));
        $this->variables = $this->variables->add((string) $name);

        return $query
            ->match()
            ->linkedTo()
            ->through(
                (string) $meta->type(),
                (string) $name
            )
            ->withProperty(
                $meta->identity()->property(),
                (string) $name
                    ->prepend('{')
                    ->append('_identity}')
            )
            ->withParameter(
                (string) $name->append('_identity'),
                $identity->value()
            );
    }
690953
public function renderIdentity(IdentityInterface $identity, $long = false)
    {
        return sprintf(
            '%s %s %s',
            $this->translator->trans($this->getGenderLabel($identity->getGender(), $long)),
            $identity->getFirstName(),
            $identity->getLastName()
        );
    }