/** * @param array $data * @param String $where * @return int */ public function update(array $data, $where) { foreach ($data as $key => $value) { $dataToStore = ['user_id' => $this->user->userid, 'profilefield_id' => $key, 'value' => $value]; $query = $this->getAdapter()->select()->from(['p' => $this->getTableName()])->where('profilefield_id = ' . $key . ' AND user_id = ' . $this->user->userid); $result = $this->getAdapter()->fetchOne($query); if ($result === false) { $this->insert($dataToStore); } else { parent::update($dataToStore, 'profilefield_id = ' . $key . ' AND user_id = ' . $this->user->userid); } } }
/** * */ public function __construct() { parent::__construct(); }
/** * */ public function __construct() { parent::__construct(); $this->friendslistQuery = FriendQuery::getFriendListQuery(); $this->eventslistQuery = EventsQuery::getEventsListQuery(); }
/** * @param array $data * @return mixed */ public function insert(array $data) { $conversation = new Conversations(); $conversation->markAsUnRead($data['conversation']); return parent::insert($data); }
/** * */ public function __construct() { parent::__construct(); $this->friendslistQuery = new \Zend_Db_Expr($this->getAdapter()->select()->from($this->_dbprefix . "relations", new \Zend_Db_Expr("(CASE WHEN sender = " . $_SESSION['user']->userid . " THEN receiver WHEN receiver = " . $_SESSION['user']->userid . " THEN sender END)"))->where("status > 0")->where("sender=?", $_SESSION['user']->userid)->orWhere("receiver=?", $_SESSION['user']->userid)); }