count should not be persisted to query
Open
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 1
- Forks
- 1
- Avg merge
- 1h 26m
- Merged PRs (30d)
- 1
Description
$models = Data::on($conn);
$good = $models->filter(Filter::equal('processed', 'y'))->count();
$bad = $models->filter(Filter::equal('processed', 'n'))->count();
this example gives $bad the same value as $good since it will not be evaluated after query adaption
https://github.com/Icinga/ipl-orm/blob/832d9ff5346ddce2f2ef19919815067a40bc1ec2/src/Query.php#L723
of course this would work:
$models = Data::on($conn);
$good = $models->filter(Filter::equal('processed', 'y'))->count();
$models = Data::on($conn);
$bad = $models->filter(Filter::equal('processed', 'n'))->count();
Best Regards
Nicolas
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Query.php around line 723 and reproduce the example with two filtered count calls on the same Data query. Trace how count and query adaption affect persisted state; done means the second count reflects its own filter without requiring a new Data::on($conn) instance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100