Skip to main content
Commonmark migration
Source Link

Collection itself

As Minesh pointed out indirectly: There is no way using the API of the colletion directly.

The problem is, that magento only implements IteratorAggregate, so the Collection itself doesn't offer what you want.

##The Iterator is an ArrayIterator

The Iterator is an ArrayIterator

public function getIterator()
{
    $this->load();
    return new ArrayIterator($this->_items);
}

But even with it, you don't have a previous method, but a lot of other methods, have a look in the doc.

Collection itself

As Minesh pointed out indirectly: There is no way using the API of the colletion directly.

The problem is, that magento only implements IteratorAggregate, so the Collection itself doesn't offer what you want.

##The Iterator is an ArrayIterator

public function getIterator()
{
    $this->load();
    return new ArrayIterator($this->_items);
}

But even with it, you don't have a previous method, but a lot of other methods, have a look in the doc.

Collection itself

As Minesh pointed out indirectly: There is no way using the API of the colletion directly.

The problem is, that magento only implements IteratorAggregate, so the Collection itself doesn't offer what you want.

The Iterator is an ArrayIterator

public function getIterator()
{
    $this->load();
    return new ArrayIterator($this->_items);
}

But even with it, you don't have a previous method, but a lot of other methods, have a look in the doc.

Source Link
Fabian Blechschmidt
  • 35.4k
  • 8
  • 75
  • 182

Collection itself

As Minesh pointed out indirectly: There is no way using the API of the colletion directly.

The problem is, that magento only implements IteratorAggregate, so the Collection itself doesn't offer what you want.

##The Iterator is an ArrayIterator

public function getIterator()
{
    $this->load();
    return new ArrayIterator($this->_items);
}

But even with it, you don't have a previous method, but a lot of other methods, have a look in the doc.