_init('aw_hdu3/gateway_mail', 'id'); } /** * @param string $messageUid * * @return bool */ public function isMailExistByMailUid($messageUid) { $read = $this->_getReadAdapter(); $select = $read->select() ->from(array('gm' => $this->getTable('aw_hdu3/gateway_mail')), 'count(id)') ->where('gm.uid = ?', $messageUid) ; return (bool)$read->fetchOne($select->__toString()); } /** * @param int $gatewayId * * @return array */ public function getExistMailUIDs($gatewayId) { $read = $this->_getReadAdapter(); $select = $read->select() ->from(array('gm' => $this->getTable('aw_hdu3/gateway_mail')) , 'REPLACE(gm.uid, CONCAT(g.email, g.id),"")') ->joinLeft( array( 'g' => $this->getTable('aw_hdu3/gateway') ), 'gm.gateway_id = g.id', array() ) ->where('gm.gateway_id = ?', $gatewayId) ; return $read->fetchCol($select->__toString()); } }