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

Filter methods for data object listings #4351

Open
BlackbitNeueMedien opened this issue May 13, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@BlackbitNeueMedien
Copy link
Contributor

commented May 13, 2019

Currently the listing classes only extend \Pimcore\Model\DataObject\Listing\Concrete and set some class properties.
What do you think of adding filter methods for the class fields like

class Listing extends DataObject\Listing\Concrete {
...
  public function filterByName($name) {
    $this->addConditionParam("`name` = ?", $name);
  }
...
}

$userListing = new Listing();
$userListing->filterByName($name);
// $userListing now contains all User data objects whose field name=$name

Of course this could be done via User::getByName($name); but these methods only support filtering by one field.

Or even add comparison operators so you could do

$userListing = new Listing();
// get all users who registered since 2019-01-01 00:00:00
$userListing->filterByRegistrationDate(new DateTime('2019-01-01 00:00:00", ">=");

Actually I am inly interested if this feature sounds interesting. I could try to implement a PR if you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.