public function phoneproviderAction() { $phone_number = $this->getPhoneNumber(); if (!empty($phone_number)) { $status = 1; $transfer_statuses = array('Execute_response', 'Publish_response', 'Return_response'); $where = array('last_transaction IN (?)' => $transfer_statuses); $result = Application_Model_General::getRequests($phone_number, 'phone_number', array('to_provider'), $where, 'id DESC', 1); // if phone number not found return the default provider (by its number) if (empty($result)) { $result = Application_Model_General::getDefaultProvider($phone_number); } } else { $status = 0; $result = array(); } $output = array('status' => $status, 'results' => $result); // print "<pre>"; // print_R($output);die; $this->view->response = $this->encodeResponse($output); }