我正在构建我的第一个 zend 应用程序,我想使用 Ajax 调用还对 DB 进行自定义查询,我的代码是:
BookingTable 类
public function getAjaxBooking()
{
$rowset = $this->tableGateway->select(array('id' => 2));
return $rowset;
}
BookingController 类
public function getbookingsAction() {
//get post request (standart approach)
$request = $this->getRequest()->getPost();
// TODO change to real function
$json = Json::encode('foo bar');
echo $json;
}
来自 fullcalendar 的 jQuery ajax 调用
url: 'booking/getbookings',
type: 'POST'
在 BookingTable 我想获得类似于
SELECT template AS temp, s.params
FROM rtz2n_template_styles as s
LEFT JOIN rtz2n_extensions as e
ON e.type='template'
AND e.element=s.template
AND e.client_id=s.client_id
WHERE s.client_id = 1
AND home = 1
我阅读了有关 Zend\Db\TableGateway\TableGateway::select
但无法使其工作的文档