Trait Yiisoft\ActiveRecord\Trait\ArrayIteratorTrait
Trait to implement {@see IteratorAggregate} interface for ActiveRecord.
See also \Yiisoft\ActiveRecord\Trait\ActiveRecordInterface::propertyValues().
Public Methods
| Method | Description | Defined By |
|---|---|---|
| getIterator() | Returns an iterator for traversing the properties in the ActiveRecord. | Yiisoft\ActiveRecord\Trait\ArrayIteratorTrait |
| propertyValues() | Yiisoft\ActiveRecord\Trait\ArrayIteratorTrait |
Method Details
Returns an iterator for traversing the properties in the ActiveRecord.
This method is required by the interface {@see \IteratorAggregate}.
| public ArrayIterator getIterator ( ) | ||
| return | ArrayIterator |
An iterator for traversing the items in the list. |
|---|---|---|
public function getIterator(): ArrayIterator
{
$values = $this->propertyValues();
return new ArrayIterator($values);
}
Signup or Login in order to comment.