im building my first zend application and i want to use Ajax call also make custom Query to DB my code is :
BookingTable class
public function getAjaxBooking()
{
$rowset = $this->tableGateway->select(array('id' => 2));
return $rowset;
}
BookingController class
public function getbookingsAction() {
//get post request (standart approach)
$request = $this->getRequest()->getPost();
// TODO change to real function
$json = Json::encode('foo bar');
echo $json;
}
jQuery ajax call from fullcalendar
url: 'booking/getbookings',
type: 'POST'
in BookingTable i want to get query similar to
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
i read docs about Zend\Db\TableGateway\TableGateway::select
but can't make it to work