0
誰能告訴我如何在控制器中正確地格式化查詢。幫助需要在Zend Framework中格式化原則查詢
目前它在我的FilteringSelect中沒有提供任何內容。但是,如果我將其更改爲> =,我還會返回所有不正確的kennelID,但至少我得到了一些東西。
我測試過,會話變量已設置,並且可以確認有匹配容量的狗舍。
// Create autocomplete selection for the service of this booking
public function servkennelAction()
{
$sessionKennelBooking = new Zend_Session_Namespace('sessionKennelBooking');
// disable layout and view rendering
$this->_helper->layout->disableLayout();
$this->getHelper('viewRenderer')->setNoRender(true);
// get list of grooming services for dogs from the table
$qry= Doctrine_Query::create()
->from('PetManager_Model_Kennels k');
//This should be set by default and narrows down the search criteria
if(isset($sessionKennelBooking->numPets)){
$b=(int)$sessionKennelBooking->numPets;
$qry->addWhere('k.capacity = ?','$b');
}
$result=$qry->fetchArray();
//generate and return JSON string using the primary key of the table
$data = new Zend_Dojo_Data('kennelID',$result);
echo $data->toJson();
}
非常感謝提前。
格雷厄姆
你是對的。謝謝ischenkodv – Graham 2011-04-25 12:08:12