Icinga / Icinga/ipl-orm

Select and order columns should be instantly resolved

Open
#8 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
1
Forks
1
Avg merge
1h 26m
Merged PRs (30d)
1

Description

Currently a call to Query::with() is mandatory (see https://github.com/Icinga/ipl-orm/commit/7dc53f1e4a4214444dd575e3c58c3f777cc6e34b) in order to be able to differentiate a column from being solely used in a filter or from being selected.

Consider the following:

$query = Service::on($this->getDb());

$query->with('service.vars');
$query->columns('service.vars.flatvalue');
$query->where('service.vars.flatname', 'app');

The call to with() here shouldn't be necessary, the call to columns should do so instantly. Instantly because with() does the same and it is required for any filter optimizations to work correctly.

At the moment relations of selected columns are only resolved in Query::assembleSelect(). This is too late and can't be assumed as an requirement for e.g. filter optimizations.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Query::with(), Query::columns(), and Query::assembleSelect() to trace when selected-column relations are resolved and how filter optimizations use them. Done means selecting service.vars.flatvalue through columns() resolves the relation immediately, so the explicit with() call is unnecessary while filter optimizations continue to work correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.