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

getIterator() public method

{@inheritDoc}
public getIterator ( )
    public function getIterator()
    {
        return new ArrayIterator($this->elements);
    }

Usage Example

Example #1
1
 /**
  * Get widgets
  *
  * @return \Doctrine\Common\Collections\ArrayCollection
  */
 public function getWidgets()
 {
     // we order by position value.
     $iterator = $this->widgets->getIterator();
     $iterator->uasort(function ($first, $second) {
         if ($first === $second) {
             return 0;
         }
         return (int) $first->getPosition() < (int) $second->getPosition() ? -1 : 1;
     });
     $this->widgets = new \Doctrine\Common\Collections\ArrayCollection(iterator_to_array($iterator));
     return $this->widgets;
 }
All Usage Examples Of Doctrine\Common\Collections\ArrayCollection::getIterator