Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Not real bugs just two questions #215

Open
collapso opened this issue Sep 6, 2019 · 1 comment
Open

Not real bugs just two questions #215

collapso opened this issue Sep 6, 2019 · 1 comment

Comments

@collapso
Copy link

collapso commented Sep 6, 2019

How do we fetch the latest entry:

    $qb->field('createdAt')->equals($value);
    $qb->field('createdAt')->notEquals($value);
    $qb->field('createdAt')->in(array($value));
    $qb->field('createdAt')->notIn(array($value));
    $qb->field('createdAt')->like('%'.$value);
    $qb->field('createdAt')->notLike($value.'%');
    $qb->field('createdAt')->lt($value); // lower than
    $qb->field('createdAt')->lte($value); // lower than equals
    $qb->field('createdAt')->gt($value); // greater than
    $qb->field('createdAt')->gte($value); // greater than equals

These don't help with that, an option could be something like:

    $qb->field('createdAt')->max();
    $qb->field('createdAt')->min();

It would just add select max('field') ...

Right now we need to fetch all the entries (in my case over 400 entries and have to filter them afterwards)
Or would you suggest creating a custom filter which would do this for me?

This leads me to the next question:
Why do we get 10 results even if we say paginate=false?
Talking about ResultsBuilder::fetchResults()
public function fetchResults($query, $page = 1, $maxPerPage = 10, $filter = false, $paginate = false)
We need to set a setMaxPerPage so we have to keep a random big number any time we want to fetch all records.
I would assume that deactivating the pagination would give me all results. Forget about my assumption, how would you suggest getting all results?

Edit:
I thought of another way to fetch all entries:

    $qb->field('createdAt')->gt('1800-01-01 00:00:00'); // given this is a timestamp that is acceptable
    $qb->field('createdAt')->lt('3000-01-01 00:00:00');

which also requires keeping two dates just in case we need to do fetch all.

@collapso
Copy link
Author

collapso commented Sep 6, 2019

After proof reading it, it sounds a bit harsh but my intention is to figure out the best way to build the query and not to pick a fight.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant