Skip to content

Idea: use custom result iterators per tables to provide on-the-fly filtering #91

Open

Description

@moufmouf

We could generate custom iterators per table that can be customized by users to offer "on the fly filtering".

It could work like this:

$users = $userDao->findAll()->filterActiveUsers()->filterAdults();

Behind the scene, the findAll() method returns a UserResultIterator (instead of a simple ResultIterator). The UserResultIterator has been coded by the developer (I'm not sure exactly how yet...)

Maybe something like:

class UserResultIterator extends ResultIterator {
    public function filterActiveUsers() : ResultIterator {
        return $this->andSqlFilter('active = 1');
    }
}

You think this is a good idea?

Activity

  1. self-assigned this
    on May 28, 2018
  2. nguyenk commented on May 28, 2018

    @nguyenk
    Member

    Yet another generated class ? :)

  3. moufmouf commented on May 28, 2018

    @moufmouf
    MemberAuthor

    Yep! That's why I'm asking! :)

  4. added this to the 5.2 milestone on Jul 11, 2019
  5. moufmouf commented on Sep 27, 2019

    @moufmouf
    MemberAuthor

    Implementation started in #176

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions