2006-06-01 15:58:05 +04:00
|
|
|
<?php
|
2006-12-29 17:40:47 +03:00
|
|
|
class Doctrine_Record_Iterator extends ArrayIterator
|
|
|
|
{
|
2006-06-01 15:58:05 +04:00
|
|
|
/**
|
|
|
|
* @var Doctrine_Record $record
|
|
|
|
*/
|
|
|
|
private $record;
|
|
|
|
/**
|
|
|
|
* @var Doctrine_Null $null
|
|
|
|
*/
|
|
|
|
private static $null;
|
|
|
|
/**
|
|
|
|
* constructor
|
|
|
|
*
|
|
|
|
* @param Doctrine_Record $record
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public function __construct(Doctrine_Record $record)
|
|
|
|
{
|
2006-06-01 15:58:05 +04:00
|
|
|
$this->record = $record;
|
|
|
|
parent::__construct($record->getData());
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* initNullObject
|
|
|
|
*
|
|
|
|
* @param Doctrine_Null $null
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public static function initNullObject(Doctrine_Null $null)
|
|
|
|
{
|
2006-06-01 15:58:05 +04:00
|
|
|
self::$null = $null;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* current
|
|
|
|
*
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2006-12-29 17:40:47 +03:00
|
|
|
public function current()
|
|
|
|
{
|
2006-06-01 15:58:05 +04:00
|
|
|
$value = parent::current();
|
|
|
|
|
2006-12-29 17:01:31 +03:00
|
|
|
if ($value === self::$null) {
|
2006-06-01 15:58:05 +04:00
|
|
|
return null;
|
2006-12-29 17:01:31 +03:00
|
|
|
} else {
|
2006-06-01 15:58:05 +04:00
|
|
|
return $value;
|
2006-12-29 17:01:31 +03:00
|
|
|
}
|
2006-06-01 15:58:05 +04:00
|
|
|
}
|
|
|
|
}
|