Get the query params for a lookup request.

@param string $id
@param string $value
@param array  $params

@return array
194517
protected function getLookupParams($id, $value, array $params)
    {
        // Make the id default
        if (!$value) {
            $value = $id;
            $id = 'id';
        }

        return array_merge(array($id => $value), $params);
    }
901701
private function listEntityIdsWithCps(PagerInterface $pager = null, array $query_params = []): array
    {
        $query_params = [
                'expand' => 'false',
            ] + $query_params;
        if ($pager) {
            return $this->getResultsInRange($pager, $query_params);
        } else {
            $ids = $this->getResultsInRange($this->createPager(), $query_params);
            if (empty($ids)) {
                return [];
            }
            $lastId = end($ids);
            do {
                $tmp = $this->getResultsInRange($this->createPager(0, $lastId), $query_params);
                // Remove the first item from the list because it is the same
                // as the current last item of $ids.
                // Apigee Edge response always starts with the requested entity
                // id (startKey).
                array_shift($tmp);

                if (count($tmp) > 0) {
                    $ids = array_merge($ids, $tmp);
                    $lastId = end($tmp);
                } else {
                    $lastId = false;
                }
            } while ($lastId);

            return $ids;
        }
    }
1225716
private function filterMessage($param, $value)
    {
        $messages = session($this->session_key, []);

        $filtered_messages = [];
        foreach ($messages as $message) {
            if ($message[$param] == $value) {
                $filtered_messages[] = $message;
            }
        }

        return $filtered_messages;
    }
37864
public function getCard($id, array $params = array())
    {
        return $this->get($this->getPath().'/'.rawurlencode($id).'/card', $params);
    }
879668
public function getList($id, array $params = array())
    {
        return $this->get($this->getPath().'/'.rawurlencode($id).'/list', $params);
    }
140681
protected function getPrestaShopValues($id, array $options)
    {
        $result = array();
        foreach ($options as $value => $label) {
            $result[] = array(
                'id' => $id . $value,
                'value' => $value,
                'label' => $label,
            );
        }
        return $result;
    }
1083049
public function sqlFetchPairs(string $sql, array $params = [], string $key = '0', string $value = '1'): array
    {
        return $this->connection()->sqlFetchPairs($sql, $params, $key, $value);
    }
917965
public function sqlFetchPairs(string $sql, array $params = [], string $key = '0', string $value = '1'): array
    {
        $stmt = $this->prepare($sql, $params);

        $pairs = [];

        while ($record = $stmt->fetch()) {
            $pairs[array_key_exists($key, $record) ? $record[$key] : null] = array_key_exists($value, $record) ? $record[$value] : null;
        }

        return $pairs;
    }
787543
public function prev_id( $id = null, $params_override = null ) {

		if ( null === $id ) {
			$id = $this->id();
		}

		$id = (int) $id;

		$params = array(
			'select'  => "`t`.`{$this->data->field_id}`",
			'where'   => "`t`.`{$this->data->field_id}` < {$id}",
			'orderby' => "`t`.`{$this->data->field_id}` DESC",
			'limit'   => 1,
		);

		if ( ! empty( $params_override ) || ! empty( $this->params ) ) {
			if ( ! empty( $params_override ) ) {
				$params = $params_override;
			} elseif ( ! empty( $this->params ) ) {
				$params = $this->params;
			}

			if ( is_object( $params ) ) {
				$params = get_object_vars( $params );
			}

			if ( 0 < $id ) {
				if ( isset( $params['where'] ) && ! empty( $params['where'] ) ) {
					$params['where']   = (array) $params['where'];
					$params['where'][] = "`t`.`{$this->data->field_id}` < {$id}";
				} else {
					$params['where'] = "`t`.`{$this->data->field_id}` < {$id}";
				}
			} elseif ( isset( $params['offset'] ) && 0 < $params['offset'] ) {
				$params['offset'] --;
			} elseif ( 0 < $this->row_number && ! isset( $params['offset'] ) && ! empty( $this->params ) ) {
				$params['offset'] = $this->row_number - 1;
			} else {
				return 0;
			}

			if ( isset( $params['orderby'] ) && ! empty( $params['orderby'] ) ) {
				if ( is_array( $params['orderby'] ) ) {
					foreach ( $params['orderby'] as $orderby => $dir ) {
						$dir = strtoupper( $dir );

						if ( ! in_array( $dir, array( 'ASC', 'DESC' ), true ) ) {
							continue;
						}

						if ( 'ASC' === $dir ) {
							$params['orderby'][ $orderby ] = 'DESC';
						} else {
							$params['orderby'][ $orderby ] = 'ASC';
						}
					}

					$params['orderby'][ $this->data->field_id ] = 'DESC';
				} elseif ( "`t`.`{$this->data->field_id}` DESC" !== $params['orderby'] ) {
					$params['orderby'] .= ", `t`.`{$this->data->field_id}` DESC";
				}
			}//end if

			$params['select'] = "`t`.`{$this->data->field_id}`";
			$params['limit']  = 1;
		}//end if

		$pod = pods( $this->pod, $params );

		$new_id = 0;

		if ( $pod->fetch() ) {
			$new_id = $pod->id();
		}

		$new_id = $this->do_hook( 'prev_id', $new_id, $id, $pod, $params_override );

		return $new_id;
	}
934871
public function setQueryParams($id, $params = [])
    {
        $requestQuery = $this->request->query->get('query_id');
        
        if(isset($requestQuery[$id])) {
            $paramsQuery = $requestQuery[$id];
        } elseif(isset($params['query'])) {
            $paramsQuery = $params['query'];
        } else {
            $paramsQuery = [];
        }
        
        $query = array_merge([
            'limit' => null,
            'offset' => null,
            'orderby' => null,
            'order' => null
        ], $paramsQuery);
        
        if($query['offset'] !== null && $query['offset'] >= $this->paramDefaults['offset']) {
            $this->qb->setFirstResult($query['offset']);
        }
        
        if($query['limit'] !== null && $query['limit'] >= $this->paramDefaults['limit']) {
            $this->qb->setMaxResults($query['limit']);
        }
        
        if(in_array($query['orderby'], $this->paramDefaults['orderby'])) {
            $order = in_array(strtoupper($query['order']), $this->paramDefaults['order']) ? $query['order'] : $this->paramDefaults['order'][0];

            $this->qb->orderBy('a.'.Inflector::camelize($query['orderby']), strtoupper($order));
        }
    }
216864
public static function findOrFail($id, array $params = [])
    {
        $instance = new static([], static::getParentID());

        // Make request
        if (!is_null($result = $instance->request($instance->getEndpoint(), 'find', [$id, $params]))) {
            return $result;
        }

        // Not found
        throw new NotFoundException;
    }
888138
public static function couponsList($id, $params = null, $options = null)
    {
        $url = static::classUrl() . '/' . $id . '/coupons';
        return static::_directRequest('get', $url, $params, $options);
    }
672591
protected QueryParameters[] getQueryParams(Object[][] params) {
        QueryParameters[] result = new QueryParameters[params.length];

        for (int i = 0; i < params.length; i++) {
            result[i] = new QueryParameters(params[i]);
        }

        return result;
    }
1235909
public static function find( $param = null, $param2 = null ) 
	{
		$settings = static::_model();

		$query = DB::select( $settings['table'] );

		// Do we have a find modifier?
		if ( !is_null( $settings['find_modifier'] ) ) 
		{
			$callbacks = $settings['find_modifier'];

			if ( !\CCArr::is_collection( $callbacks ) )
			{
				$callbacks = array( $callbacks );
			}

			foreach( $callbacks as $call )
			{
				if ( is_callable( $call ) ) 
				{
					call_user_func_array( $call, array( &$query ) );
				}
				else 
				{
					throw new ModelException( "Invalid Callback given to find modifiers." );
				}
			}
		}

		if ( !is_null( $param ) )
		{
			// Check if paramert 1 is a valid callback and not a string.
			// Strings as function callback are not possible because
			// the user might want to search by key like:
			// Model::find( 'key', 'type' );
			if ( is_callable( $param ) && !is_string( $param ) ) 
			{
				call_user_func_array( $param, array( &$query ) );
			}
			// When no param 2 isset we try to find the record by primary key
			elseif ( is_null( $param2 ) ) 
			{
				$query->where( $settings['table'].'.'.$settings['primary_key'], $param )
					->limit(1);
			}
			// When param one and two isset we try to find the record by
			// the given key and value.
			elseif ( !is_null( $param2 ) )
			{
				$query->where( $param, $param2 )
					->limit(1);
			}
		}

		// alway group the result
		$query->forward_key( $settings['primary_key'] );

		// and we have to fetch assoc
		$query->fetch_arguments = array( 'assoc' );

		// and assign
		return static::assign( $query->run() );
	}
151901
public function getById(array $params = [], $id)
    {
        $this->getLogger()->info('Getting event with ID ' . $id);
        $entries = [];
        # need at least display group (always events) and to, from (other dayparts)
        $response = $this->doGet('/schedule/data/events', $params);

        foreach ($response['result'] as $item) {
            if($item['id'] === $id){
            $entries[] = clone $this->hydrate($item);
        }
            else
                throw new XiboApiException('Provided eventId not found ' . $id);
        }
        return $entries;
    }
837075
public function getById(string $id, array $params = [])
    {
        return $this->executeRequest(
            RequestMethodEnum::GET,
            ResourceMethodEnum::GET_BY_ID,
            $params,
            $id
        );
    }
213449
private function resolveParameters(string $id, array $parameters, ContainerInterface $container): array
    {
        $resolved = [];
        foreach ($parameters as $parameter) {
            $resolved[] = $this->getParameterValue($id, $parameter, $container);
        }
        return $resolved;
    }