0

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

Muntasim
  • 6,689
  • 3
  • 46
  • 69
Viszman
  • 1,378
  • 1
  • 17
  • 47
  • 1
    Well I guess your problem is about making sql queries in Zend, here you go http://framework.zend.com/manual/1.12/en/zend.db.table.html this should be a good start, that's how I learned! – Uffo Aug 01 '13 at 12:30
  • 1
    But it's for Zend 1.12 and i suppose Zend 2.2 is different – Viszman Aug 01 '13 at 12:32
  • http://framework.zend.com/manual/2.0/en/modules/zend.db.table-gateway.html for 2.x – DonOfDen Aug 01 '13 at 19:22

0 Answers0