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

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

Open
moufmouf opened this issue May 28, 2018 · 3 comments
Assignees
Milestone

Comments

@moufmouf
Copy link
Member

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?

@moufmouf moufmouf self-assigned this May 28, 2018
@nguyenk
Copy link
Member

nguyenk commented May 28, 2018

Yet another generated class ? :)

@moufmouf
Copy link
Member Author

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

@moufmouf moufmouf added this to the 5.2 milestone Jul 11, 2019
@moufmouf
Copy link
Member Author

Implementation started in #176

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

No branches or pull requests

2 participants