toArray was DB_DataObjects and generating search filters
| From: | pear at electroteque dot org | Date: | Thu, 21 Apr 2005 03:22:32 +0000 |
| Subject: | toArray was DB_DataObjects and generating search filters | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18850@lists.php.net to get a copy of this message | ||
Ok this is how i currently have to setup a method to return an array for
list menus as u can see the code is duplicating. toArray returns keys as
0,1,2,3,4,5,6,7 etc ...
keys need to be the primary keys :|
function getDepartments()
{
$this->orderBy('department');
$this->find();
$arr = array();
$arr[''] = "";
while ($this->fetch()) {
$arr[$this->departmentID] = $this->department;
}
return $arr;
}