Find many records by identity

@param array $identities
@return array
@throws LogicException
166736
public function findMany(array $identities)
    {
        if( !$this->primaryKey ) {
            throw new LogicException('No primary key!');
        }
        return $this->select()
                ->whereIn($this->primaryKey, $identities)
                ->query()
                ->fetchAll();
    }
815753
public function findActionsForIds(array $ids)
    {
        if (empty($ids)) {
            return array();
        }

        $datas = $this->client->hmget($this->getActionKey(), $ids);

        return array_values(
            array_map(
                function ($v) {
                    return unserialize($v);
                },
                $datas
            )
        );
    }
638855
public function contains(Identity $identity): bool
    {
        try {
            $this->stateFor($identity);

            return true;
        } catch (IdentityNotManaged $e) {
            return false;
        }
    }
1318280
public function matchIdentityRoles(array $roles): bool
    {
        $identityRoles = $this->getIdentityRoles();
        // Too easy...
        if (empty($identityRoles)) {
            return false;
        }
        $roleNames = [];
        foreach ($roles as $role) {
            $roleNames[] = $role instanceof RoleInterface ? $role->getName() : (string)$role;
        }

        $identityRoleNames = [];
        foreach ($this->flattenRoles($identityRoles) as $role) {
            $identityRoleNames[] = $role->getName();
        }

        return count(array_intersect($roleNames, $identityRoleNames)) > 0;
    }
1316986
public function findByName( $name )
    {

        // is this name schema qualified
        $call = sprintf(
            "findBy%s",
            ( false !== strpos( $name, '.' ) ) ? 'FullyQualifiedName' : 'Name'
        );

        $found = $this->persistedGet()->$call( $name );

        // return
        switch( $count = count( $found ) ) {
            case 0:
                return null;
            case 1:
                return $found->pop();
            default:
                throw new \LogicException( "{$count} relations' found with name `{$name}`. Ambiguous. Can't proceed." );
        }

    }
788043
public function league($identities, $entry = false)
	{
		if (is_array($identities))
		{
			if (count($identities) > 10)
			{
				throw new ListMaxException('This request can only support a list of 10 elements, '.count($identities).' given.');
			}
		}

		$ids = $this->extractIds($identities);
		$ids = implode(',', $ids);
		if ($entry)
		{
			$ids .= '/entry';
		}
		$array = $this->request('league/by-summoner/'.$ids);

		$summoners = [];
		foreach ($array as $id => $summonerLeagues)
		{
			$leagues = [];
			foreach ($summonerLeagues as $info)
			{
				if (isset($info['participantId']))
				{
					$info['id'] = $info['participantId'];
				}
				else
				{
					$info['id'] = $id;
				}
				$league    = new Dto\League($info);
				$leagues[] = $this->attachStaticDataToDto($league);
			}
			$summoners[$id] = $leagues;
		}

		$this->attachResponses($identities, $summoners, 'leagues');

		if (is_array($identities))
		{
			return $summoners;
		}
		else
		{
			return reset($summoners);
		}
	}
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;
    }
776159
public function getAll($identity, $page = 1, $perPage = 25)
    {
        $params = array(
            'page' => $page,
            'per_page' => $perPage
        );

        return $this->_user->get('account/identity/' . $identity . '/token', $params);
    }
1009140
function find(array $logic = null) {

		$logic != null or $logic = [];

		$opt = [];
		foreach (['%fields', '%order_by', '%limit', '%offset'] as $key) {
			if (isset($logic[$key])) {
				$opt[$key] = $logic[$key];
				unset($logic[$key]);
			}
			else { // %filter not set
				$opt[$key] = [];
			}
		}

		$entries = $this->sqlfind
			(
				$logic,
				$opt['%fields'],
				$opt['%order_by'],
				$opt['%limit'],
				$opt['%offset']
			);

		return $this->toModels($entries);
	}
1370874
public function findByIds($ids)
    {
        if (!is_array($ids)) {
            $ids = explode(',', trim($ids));
        }

        return $this->createQueryBuilder('o')
            ->where('o.id IN (:ids)')
            ->setParameters([
                'ids' => $ids,
            ])
            ->getQuery()
            ->getResult();
    }
1366961
public function searchIds(array $cond, array $options = array()): SearchResult
    {
        $params = $options + array('cond' => $cond);

        $params['ids_only'] = true;

        $result = $this->getEntityDao()->search($params);

        if (!$result instanceof SearchResult) {
            throw new FindException('Data Access Object did not return a search result');
        }

        return $result;
    }
52293
public function get_from_ids(array $ids) {
        $alias = $this->get_table_alias();
        list($insql, $params) = $this->get_db()->get_in_or_equal($ids);
        $wheresql = $alias . '.id ' . $insql;
        $sql = $this->generate_get_records_sql($wheresql);
        $records = $this->get_db()->get_records_sql($sql, $params);

        return $this->transform_db_records_to_entities($records);
    }
604117
public function findAllNew($ids = [])
    {
        $query = $model = $this->makeModel()->where('broadcasted', 0);
        if (!empty($ids)) {
            $values = array_values($ids);
            $query->whereNotIn('id', $values);
        }
        return $query->get();
    }
686604
public function findByIds($class, array $ids)
    {
        if (count($ids) === 0) {
            return array();
        }

        $dql = "SELECT object FROM {$class} object WHERE object.id IN (:ids)";
        $query = $this->wrapped->createQuery($dql);
        $query->setParameter('ids', $ids);
        $objects = $query->getResult();

        if (($entityCount = count($objects)) !== ($idCount = count($ids))) {
            throw new MissingObjectException(
                "{$entityCount} out of {$idCount} ids don't match any existing object"
            );
        }

        return $objects;
    }
280270
public function getByIds($entityType, array $ids, array $params = [])
    {
        $validIds = array_values(array_unique(array_filter($ids, [__CLASS__, 'isIdValid'])));

        if (count($validIds) === 0) {
            return [];
        }

        $doSortByIds = empty($params['sort']);
        $results = $this->search($entityType, ['_id' => ['$in' => $validIds]], $params);
        if (!$doSortByIds) {
            return $results;
        }

        $flipped = array_flip($validIds);
        foreach ($results as $result) {
            $flipped[$result['_id']] = $result;
        }
        return array_filter(array_values($flipped), function ($result) {
            return is_array($result) && count($result) > 0;
        });

    }
431929
public function multiCreate($records)
    {
        $ids = [];

        foreach ($records as $record) {
            try {
                $createdRecord = $this->create($record);
                $ids[] = $createdRecord[$this->getIdentifier()];
            } catch (\Throwable $e) {
                // TODO: need to log record that was not created
                continue;
            }
        }

        return $ids;
    }
841468
public function findByIds($ids)
    {
        if (!is_array($ids)) {
            $ids = explode(',', $ids);
        }

        return $this->createQueryBuilder('ml')
            ->andWhere('ml.id IN (:ids)')
            ->setParameter('ids', $ids)
            ->getQuery()
            ->getResult();
    }