public static function getAllKeys() { $oMysqli = Database::getInstance(); $oResults = $oMysqli->query("SELECT a.*,u.login FROM tks_apikeys a \r\n JOIN tks_users u \r\n ON u.id = a.id_user"); $aResults = array(); while ($aResult = $oResults->fetch_assoc()) { $oKey = new ApiKey($aResult['apikey'], $aResult['id_user'], $aResult['read'], $aResult['write']); $oKey->setUserLogin($aResult['login']); $aResults[] = $oKey; } return $aResults; }