Doctrine\Common\Collections\ArrayCollection::forAll PHP Method

forAll() public method

{@inheritDoc}
public forAll ( Closure $p )
$p Closure
    public function forAll(Closure $p)
    {
        foreach ($this->elements as $key => $element) {
            if (!$p($key, $element)) {
                return false;
            }
        }
        return true;
    }

Usage Example

Example #1
1
 /**
  * {@inheritdoc}
  */
 public function getNotificationEmails()
 {
     $emails = [];
     $this->businessUnits->forAll(function (BusinessUnit $bu) use(&$emails) {
         $emails = array_merge($emails, $bu->getNotificationEmails());
     });
     return new ArrayCollection($emails);
 }
All Usage Examples Of Doctrine\Common\Collections\ArrayCollection::forAll