Add namespace.
This commit is contained in:
40
Model/SqlResultCollection.php
Normal file
40
Model/SqlResultCollection.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php namespace Majestic\Model;
|
||||
|
||||
class SqlResultCollection extends \ArrayIterator implements iSqlResultItems
|
||||
{
|
||||
private $items;
|
||||
|
||||
public function __construct($items)
|
||||
{
|
||||
$this->items = $items;
|
||||
foreach ($items as $item) {
|
||||
parent::append($item);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return DbStatement[]
|
||||
*/
|
||||
public function fetchAll()
|
||||
{
|
||||
return (array) $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $field
|
||||
* @return mixed
|
||||
*/
|
||||
public function fetchField($field)
|
||||
{
|
||||
$item = $this->offsetGet(0);
|
||||
return $item->{$field};
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function fetch()
|
||||
{
|
||||
return $this->offsetGet(0);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user