Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

count should not be persisted to query #140

Open
moreamazingnick opened this issue Oct 3, 2024 · 1 comment
Open

count should not be persisted to query #140

moreamazingnick opened this issue Oct 3, 2024 · 1 comment

Comments

@moreamazingnick
Copy link

$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

if ($this->count === null) {

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

@nilmerg
Copy link
Member

nilmerg commented Oct 7, 2024

of course this would work:

Which I'd suggest anyway.

But thanks for bringing this up!

@nilmerg nilmerg added this to the Implementation Flaws milestone Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants