{@inheritDoc}
public matching ( Doctrine\Common\Collections\Criteria $criteria ) | ||
$criteria | Doctrine\Common\Collections\Criteria |
use Doctrine\Common\Collections\ArrayCollection; $users = new ArrayCollection([ ['name' => 'John', 'age' => 25], ['name' => 'Jane', 'age' => 30], ['name' => 'Bob', 'age' => 20], ]); $filtered = $users->matching( ArrayCollection::create([ ['age' => 25], ['age' => 30], ]) ); // $filtered contains the elements with age 25 and 30
use Doctrine\Common\Collections\ArrayCollection; $users = new ArrayCollection([ ['name' => 'John', 'age' => 25], ['name' => 'Jane', 'age' => 30], ['name' => 'Bob', 'age' => 20], ]); $filtered = $users->matching( ArrayCollection::create(), function ($user) { return $user['age'] > 25 && strpos($user['name'], 'J') !== false; } ); // $filtered contains the element with name 'Jane' and age 30The Doctrine\Common\Collections package library provides a set of classes and interfaces for managing collections of objects.
public matching ( Doctrine\Common\Collections\Criteria $criteria ) | ||
$criteria | Doctrine\Common\Collections\Criteria |