使用Zend框架1.9。我有一個表中有許多列的數據庫。我只取某些列:Zend Framerwork 1.9填充數據庫查詢中的複選框
$select = $table->select();
$select->from($table, array('skill_id', 'description'))->where('parent_skill IS NULL');
$rows = $table->fetchAll($select);
print_r($rows->toArray());
//This is the output :
Array ([0] => Array ([skill_id] => 1 [description] => Soccorso stradale) [1] => Array ([skill_id] => 4 [description] => Carrozziere))
現在我想填充一個複選框元素:
$form->skills->setMultiOptions ($rows->toArray());
我的問題是方法setMultiOptions
期待一個陣列array(key=>value)
。 是否可以將我的$rows
數組轉換爲格式良好的數組?