Your use case:
$ArrayCollectionOfActiveUsers = $customer->users->filter(function($user) { return $user->getActive() === TRUE; });
if you add β first (), you will only get the first entry entered, which is not what you want.
@Sjwdavies You need to put () around the variable you pass to the USE. You can also shorten since in_array already returns a boolean:
$member->getComments()->filter( function($entry) use ($idsToFilter) { return in_array($entry->getId(), $idsToFilter); });
StΓ©phan Champagne May 10 '12 at 14:22 2012-05-10 14:22
source share