Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.DbObjectList.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Document list class
8  *
9  * @author Anakeen
10  * @version $Id: $
11  * @package FDL
12  */
13 /**
14  */
15 class DbObjectList implements Iterator
16 {
17  private $object = null;
18  private $res = null;
19  private $index = 0;
20  public $length = 0;
21 
22  public function __construct($dbaccess, $res, $classname)
23  {
24  if ($res) {
25  $this->res = $res;
26  $this->object = new $classname($dbaccess);
27  $this->length = pg_num_rows($this->res);
28  }
29  }
30 
31  public function rewind()
32  {
33  $this->index = 0;
34  }
35  public function next()
36  {
37  $this->index++;
38  }
39  public function key()
40  {
41  return $this->index;
42  }
43  public function current()
44  {
45  /*print_r2(array(
46  "type" => __METHOD__,
47  "index" => $this->index,
48  "length" => $this->length
49  ));*/
50 
51  $this->object->affect(pg_fetch_array($this->res, $this->index, PGSQL_ASSOC));
52 
53  return $this->object;
54  }
55  public function valid()
56  {
57  return ($this->index < $this->length);
58  }
59 }
60 ?>
__construct($dbaccess, $res, $classname)
$dbaccess
Definition: checkVault.php:17
← centre documentaire © anakeen