public static function getUser($id) { $cursor = ConnectionModel::getConnection()->query("Select * From user where id = :id", ["id" => $id]); if ($cursor && \sizeof($cursor) == 1) { $user = new UserModel("", ""); $user->hydrate($cursor[0]); return $user; } return new UserModel("", ""); }
/** * Supprime la traduction de la base de données * @return type */ public function delete() { return ConnectionModel::getConnection()->query('Delete from translation where layoutId = :layoutId', ['layoutId' => $this->_layoutId]); }
/** * Supprime la structure de la base de données * @return type */ public function delete() { return ConnectionModel::getConnection()->query('Delete from layout where id = :id', ['id' => $this->_id]); }
/** * Return the list of the last commented algorithm * @param type $numPage the number of the search page */ public static function getMostRecentHelped($numPage = 0, $displayPerPage = 6) { $result = []; $cursor = ConnectionModel::getConnection()->query("Select function.*\r\n From function, (SELECT max( date ) as commentDate , subjectId\r\n FROM mail\r\n GROUP BY subjectId) as lastComment\r\n Where function.id = lastComment.subjectId\r\n Order by lastComment.commentDate Desc", [], [$numPage * $displayPerPage, ($numPage + 1) * $displayPerPage]); $i = 0; while ($i < \sizeof($cursor) && $cursor) { $newAlgo = new AlgorithmModel(); $newAlgo->hydrate($cursor[$i]); array_push($result, $newAlgo); $i += 1; } return $result; }
public function update() { $statement = ConnectionModel::getConnection()->query('Update backup set content = :content, date = NOW(),' . ' label = :label, type = :type where functionId = :functionId and versionId = :versionId', ['content' => $this->_content, 'label' => $this->_label, 'type' => $this->_type, 'functionId' => $this->_functionId, 'versionId' => $this->_versionId]); return $statement; }