/** * this is code is created for api msgs send * * */ public function getApiQueue() { $return = array(); $sql = "CALL api_message_get_queue()"; $this->_writeLog("About to fetch queue with {$sql}"); $rs = $this->query($sql); $this->_writeLog("Query ran..."); $this->_writeLog(print_r($rs, 1)); if (!$this->hasError()) { // Since this query only returns IDs (message and user), use those to assemble message models while ($row = $rs->fetchObject()) { if ($row->userid) { $this->_writeLog("Building a new message model with user {$row->userid}"); $m = new Application_Model_Message(new Application_Model_User($row->userid)); $this->_writeLog("Message model created, about to load with message {$row->id}"); $m->api_loadFromQueueId($row->id); $rcount = count($m->recipients); $this->_writeLog("Message id {$row->id} loaded... adding it to the stack with {$rcount} recipients"); $return[$row->id] = $m; } else { $this->_writeLog("There is no user id for this message.... skipping"); } } } else { $this->setError($this->_dbh->error); $this->_writeLog("Error: {$this->_dbh}->error"); } return $return; }