Exemple #1
0
 public function getAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->getHelper('layout')->disableLayout();
     $contactDb = new Contacts_Model_DbTable_Contact();
     $contact = $contactDb->fetchRow($contactDb->select()->from(array('c' => 'contact'))->join(array('a' => 'address'), 'c.id = a.contactid', array('street', 'postcode', 'city', 'country'))->joinLeft(array('p' => 'phone'), 'c.id = p.contactid', array('phones' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT p.phone)')))->joinLeft(array('e' => 'email'), 'c.id = e.contactid', array('emails' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT e.email)')))->joinLeft(array('i' => 'internet'), 'c.id = i.contactid', array('internets' => new Zend_Db_Expr('GROUP_CONCAT(DISTINCT i.internet)')))->group('c.id')->where('c.id = ?', $this->_getParam('id', 0))->setIntegrityCheck(false));
     header('Content-type: application/json');
     echo Zend_Json::encode($contact);
 }