public function ajaxListPhonesAction()
 {
     $patientId = (int) $this->_getParam('patientId');
     $rows = array();
     $tmp = array();
     $db = Zend_Registry::get('dbAdapter');
     $sqlSelect = $db->select()->from('number')->where('person_id = ?', $patientId);
     $phoneNumberIterator = new PhoneNumberIterator();
     $phoneNumberIterator->setDbSelect($sqlSelect);
     foreach ($phoneNumberIterator as $phone) {
         $tmp = array();
         $tmp['id'] = $phone->number_id;
         $tmp['data'][] = $phone->name;
         $tmp['data'][] = $phone->type;
         $tmp['data'][] = $phone->number;
         $tmp['data'][] = $phone->notes;
         $tmp['data'][] = $phone->active;
         $rows[] = $tmp;
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }
 public function ajaxListPhonesAction()
 {
     $personId = (int) $this->_getParam('personId');
     $rows = array();
     $tmp = array();
     $db = Zend_Registry::get('dbAdapter');
     $sqlSelect = $db->select()->from('number')->where('person_id = ?', $personId);
     $phoneNumberIterator = new PhoneNumberIterator();
     $phoneNumberIterator->setDbSelect($sqlSelect);
     foreach ($phoneNumberIterator as $phone) {
         $rows[] = $this->_toJSON($phone, 'phoneNumberId', array('name', 'type', 'number', 'notes', 'active'));
     }
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct(array('rows' => $rows));
 }