int $DB_DataObject->find (
boolean $autoFetch
)
find メソッドは、オブジェクト変数と WhereAdd() 条件に基づいた現在のクエリを作成し実行します。 もし、AutoFetch が TRUE ならは、 fetch メソッドも自動的にコールされます。
boolean $autoFetch
-
最初の結果をフェッチするかどうかを指定します
int
- データベースバックエンドが numRows()
メソッドをサポートする場合は見つかった件数。そうでなければ 1
(あるいは、1.7.13以降は true が返されます)
This function can not be called statically.
オブジェクト変数に基づいたデータの単純な find()
<?php
$person = new DataObjects_Person;
$person->hair = 'red';
$person->has_glasses = 1;
$number_of_rows = $person->find();
?>
結果の SQL
<?php
SELECT * FROM person WHERE hair='red' and has_glasses = 1
?>