stephpy / timeline-bundle

Symfony2 bundle to make timeline
192 stars 57 forks source link

Not real bugs just two questions #215

Open collapso opened 5 years ago

collapso commented 5 years ago

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 commented 5 years ago

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.