Exemplo n.º 1
0
 /**
  * Initializes the object by filling all field values from reader. 
  * @param DBInterfaces\IDatabaseReader $reader
  */
 final function InitFromReader(DBInterfaces\IDatabaseReader $reader)
 {
     $names = $reader->Names();
     foreach ($names as $name) {
         $this->SetInternally($name, $reader->ByName($name));
     }
     $this->initialized = true;
 }
Exemplo n.º 2
0
 /**
  * Returns all object by reading the reader to its end.
  * @param DBInterfaces\IDatabaseReader $reader
  * @return array DatabaseObject
  */
 final function FetchFromReader(DBInterfaces\IDatabaseReader $reader)
 {
     $objects = array();
     while ($reader->Read()) {
         $object = $this->CreateInstance($reader->ByName($this->KeyField()));
         $object->InitFromReader($reader);
         $objects[] = $object;
     }
     $reader->Close();
     return $objects;
 }