You are here

public function EntityListWrapper::getIterator in Entity API 7

If we wrap a list, we return an iterator over the data list.

File

includes/entity.wrapper.inc, line 1125
Provides wrappers allowing easy usage of the entity metadata.

Class

EntityListWrapper
Wraps a list of values.

Code

public function getIterator() {

  // In case there is no data available, just iterate over the first item.
  return new EntityMetadataWrapperIterator($this, $this
    ->dataAvailable() && is_array(parent::value()) ? array_keys(parent::value()) : array(
    0,
  ));
}