Switch 'Handler_Public->getProfiles' to ORM

master
wn_ 4 years ago
parent db0315e596
commit b6ae280446

@ -266,17 +266,17 @@ class Handler_Public extends Handler {
$rv = []; $rv = [];
if ($login) { if ($login) {
$sth = $this->pdo->prepare("SELECT ttrss_settings_profiles.* FROM ttrss_settings_profiles,ttrss_users $profiles = ORM::for_table('ttrss_settings_profiles')
WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND LOWER(login) = LOWER(?) ORDER BY title"); ->table_alias('p')
$sth->execute([$login]); ->join('ttrss_users', ['p.owner_uid', '=', 'u.id'], 'u')
->where_raw('LOWER(u.login) = LOWER(?)', [$login])
->order_by_asc('title')
->find_many();
$rv = [ [ "value" => 0, "label" => __("Default profile") ] ]; $rv = [ [ "value" => 0, "label" => __("Default profile") ] ];
while ($line = $sth->fetch()) { foreach ($profiles as $profile) {
$id = $line["id"]; array_push($rv, [ "label" => $profile->title, "value" => $profile->id ]);
$title = $line["title"];
array_push($rv, [ "label" => $title, "value" => $id ]);
} }
} }

Loading…
Cancel
Save