previous->find() (Previous) (Next) ->count()next

View this page in Last updated: Sun, 21 Jun 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

->fetch()

->fetch() – 次の行をフェッチする

Synopsis

boolean $DB_DataObject->fetch ( )

Description

fetch メソッドは次の行を取得し、 行データをオブジェクト変数にセットします。 データが取得できた場合、TRUE を返します。 これ以上データがない場合、FALSE となります。

Return value

boolean - 成功した場合 TRUE、失敗した場合 FALSE

Note

This function can not be called statically.

Fetch は staticGet や get によってコールされますので、 特別なデータ (整形済みの日付など) をオブジェクトに追加するために このクラスをオーバーライドすることができます。

Example

オブジェクト変数に基づいたデータの単純な検索とフェッチ

<?php
$person 
= new DataObjects_Person;

$person->hair 'red';
$person->has_glasses 1;

$number_of_rows $person->find();

$people = array();
while (
$person->fetch()) {
    
/* store the results in an array */
    
$people[] = clone($person);
    echo 
"GOT {$person->name}<BR>";
}
?>

特別なデータを追加するためのオーバーライドされたフェッチ

<?php
function fetch() {

  
$ret parent::fetch();
  if (
$ret === false) {
      return 
false;
  }
  
$this->dateFormated date('d/M/Y'$this->date);
  return 
true;
}
?>
previous->find() (Previous) (Next) ->count()next

Download Documentation Last updated: Sun, 21 Jun 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.