@param Identity $identity

@return \Zend_Db_Select
425860
protected function _getSelect(Identity $identity)
    {
        return $this->_db
            ->select()
            ->from($this->_getTablaName(), '*')
            ->where($this->_getSelectionFactory()->where($identity))
            ->order($this->_getSelectionFactory()->orderBy($identity));
    }
835914
function giveIdentity(iIdentity $identity)
    {
        if ($this->identity)
            throw new \Exception('Identity is immutable.');
        
        $defIdentity = $this->_newDefaultIdentity();
        $defIdentity->import($identity);
        if (!$defIdentity->isFulfilled())
            throw new \InvalidArgumentException(sprintf(
                'Identity (%s) not fulfillment (%s).'
                , \Poirot\Std\flatten($identity)
                , \Poirot\Std\flatten($defIdentity)
            ));
        
        $this->identity = $defIdentity;
        return $this;
    }
262787
function delete_identity($iid)
    {
        if (!$this->ID)
            return false;

        $sql_result = $this->db->query(
            "SELECT count(*) AS ident_count FROM ".$this->db->table_name('identities', true).
            " WHERE `user_id` = ? AND `del` <> 1",
            $this->ID);

        $sql_arr = $this->db->fetch_assoc($sql_result);

        // we'll not delete last identity
        if ($sql_arr['ident_count'] <= 1)
            return -1;

        $this->db->query(
            "UPDATE ".$this->db->table_name('identities', true).
            " SET `del` = 1, `changed` = ".$this->db->now().
            " WHERE `user_id` = ?".
                " AND `identity_id` = ?",
            $this->ID,
            $iid);

        // clear the cache
        $this->identities = array();
        $this->emails     = null;

        return $this->db->affected_rows();
    }
169931
function select($p)
    {
        if ($p['selected'] !== null || !is_object($p['message']->headers)) {
            return $p;
        }

        $rcmail = rcmail::get_instance();

        foreach ((array)$rcmail->config->get('identity_select_headers', array()) as $header) {
            if ($emails = $this->get_email_from_header($p['message'], $header)) {
                foreach ($p['identities'] as $idx => $ident) {
                    if (in_array($ident['email_ascii'], $emails)) {
                        $p['selected'] = $idx;
                        break 2;
                    }
                }
            }
        }

        return $p;
    }
1129302
protected function setLoaded(IdentityInterface $identity, ResourceInterface $resource)
    {
        $this->loaded[$identity->getName()] = $resource;
    }
861662
public function setIdentity(ArrayAccess $identity)
    {
        $controller = $this->getController();

        $result = $this->getAuthenticationService()->persistIdentity(
            $controller->request,
            $controller->response,
            $identity
        );

        $controller->setRequest($result['request']);
        $controller->response = $result['response'];

        return $this;
    }
1170027
protected function _fetchCount(Identity $identity)
    {
        $this->_totalItemsCount = $this->_db->fetchOne($this->_getSelectCount($identity));
        return $this;
    }
171042
public function setID($identity)
    {
        $idAttribute = $this->idAttribute;
        return (is_string($idAttribute) && !empty($idAttribute)) ? $this->$idAttribute = $identity : null;
    }
104996
public function getContext($identity) {
        return new DocumentPermissionContext(
            $this->version,
            $this->solution['serviceSid'],
            $this->solution['documentSid'],
            $identity
        );
    }
123470
public function get(string $class, Identity $identity): object
    {
        $meta = ($this->metadata)($class);
        $generator = $this
            ->generators
            ->get($meta->identity()->type());

        if ($generator->knows($identity->value())) {
            $identity = $generator->for($identity->value());
        } else {
            $generator->add($identity);
        }

        if ($this->container->contains($identity)) {
            return $this->container->get($identity);
        }

        $match = ($this->match)($meta, $identity);
        $entities = $this->execute(
            $match->query(),
            $match->variables()
        );

        if ($entities->size() !== 1) {
            throw new EntityNotFound;
        }

        return $entities->current();
    }
1175787
public function orderBy(IdentityInterface $identity = null)
    {
        if (is_null($this->identity) || !$this->identity->hasOrderBy()) {
            return [];
        }
        $sort = [];
        foreach ($this->identity->getOrderBy() as $key => $value) {
            if (strpos($key, 'random') !== false) {
                $sort["_script"] = [
                    "type"   => "number",
                    "script" => "Math.random()",
                    "order"  => "asc"
                ];
            } elseif ($key === Consts::GEO_DISTANCE_SORT) {
                $sort[$key] = $value;
            } elseif ($key !== null) {
                $sort[$key] = (strtolower($value) == Consts::DESCENDING)
                    ? \G4\DataMapper\Selection\Solr\Consts\Query::DESCENDING
                    : \G4\DataMapper\Selection\Solr\Consts\Query::ASCENDING;
            }
        }
        return $sort;
    }
16477
public function select($name, $id, $options = [], array $attr = null)
    {
        $basic = $this->merge_attr([ 'id' => $id ], $attr);

        return $this->input($name, [ 'type' => 'select', 'options' => $options, 'attr' => $basic ]);
    }
821170
public function league($identity)
	{
		if ( ! isset($this->info['leagues']))
		{
			// no leagues
			return null;
		}
		$leagues = $this->info['leagues'];
		foreach ($leagues as $league)
		{
			if (is_null($league->playerOrTeam))
			{
				// we could not find the player or team in this league
				continue;
			}

			// try the name
			if (strtolower($league->playerOrTeam->playerOrTeamName) == strtolower($identity))
			{
				return $league;
			}

			// try the id
			if ($league->playerOrTeam->playerOrTeamId == $identity)
			{
				return $league;
			}
		}

		return null;
	}
696424
public static function select(Connection $connection)
    {
        return new EntitySelector(AbstractSelector::fromConnection($connection, static::$table, static::$types), get_called_class());
    }
186589
public function associateIdentity( $userId, $identity )
    {
        if ( $this->hasAssociatedIdentity( $userId, $identity ) )
        {
            return 0;
        }

        $sql    = $this->sql( $this->getTableInSchema( 'user_identity' ) );
        $insert = $sql->insert()
                      ->values( array(
                          'userId'    => (int)    $userId,
                          'identity'  => (string) $identity,
                      ) );

        $result = $sql->prepareStatementForSqlObject( $insert )
                      ->execute();

        return $result->getAffectedRows();
    }
654178
public function create($identity, $service, $total_allowance = false, $analyze_queries = false)
    {

        $params = array(
            'service' => $service,
        );

        if ($total_allowance) {
            $params['total_allowance'] = $total_allowance;
        }
        if ($analyze_queries) {
            $params['analyze_queries'] = $analyze_queries;
        }

        return $this->_user->post('account/identity/' . $identity . '/limit', $params);
    }
381456
protected function _createPlainToken($identity)
    {
        $usernameField = $this->getConfig('fields.username');
        $passwordField = $this->getConfig('fields.password');

        return $identity[$usernameField] . $identity[$passwordField];
    }