public static function addToHotList($params = array()) { $posting_id = $params[0]; $member_id = $params[1]; $q = HotListTable::getInstance()->createQuery('h'); $q->where('posting_id = ?', $posting_id); $q->andWhere('member_id = ?', $member_id); if ($q->execute()->count() > 0) { return array('Already added in your Hot list.', false); } else { $hotlist = new HotList(); $hotlist->setMemberId($member_id); $hotlist->setPostingId($posting_id); try { $hotlist->save(); return array('This posting has been added to your HOT List', true); } catch (Exception $e) { return array('Unable to process request. Please try again later!', false); } } }