1
0
mirror of synced 2025-01-18 06:21:40 +03:00
doctrine2/lib/Doctrine/Record/Iterator.php

47 lines
925 B
PHP
Raw Normal View History

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