diff options
author | Andrew Dolgov <[email protected]> | 2021-02-21 10:35:39 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2021-02-21 10:35:39 +0300 |
commit | fb471652c00abec604e07c2383685c0e352c897e (patch) | |
tree | dfa709287b28318173c8c327ee358a1f28667e1d /classes/labels.php | |
parent | 9e56896bd428114ff9bfd979c2d4ff8d93f99485 (diff) | |
parent | 3b8d69206ccc24b41b45acd55f0c63681e749fd1 (diff) |
Merge branch 'wip-filter-stuff'
Diffstat (limited to 'classes/labels.php')
-rw-r--r-- | classes/labels.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/classes/labels.php b/classes/labels.php index f72d7d84b..570f24f4f 100644 --- a/classes/labels.php +++ b/classes/labels.php @@ -37,7 +37,18 @@ class Labels } } - static function get_all_labels($owner_uid) { + static function get_as_hash($owner_uid) { + $rv = []; + $labels = Labels::get_all($owner_uid); + + foreach ($labels as $i => $label) { + $rv[$label["id"]] = $labels[$i]; + } + + return $rv; + } + + static function get_all($owner_uid) { $rv = array(); $pdo = Db::pdo(); @@ -46,7 +57,7 @@ class Labels WHERE owner_uid = ? ORDER BY caption"); $sth->execute([$owner_uid]); - while ($line = $sth->fetch()) { + while ($line = $sth->fetch(PDO::FETCH_ASSOC)) { array_push($rv, $line); } |