<?php

class EntityHandler
{    
    public function getEntities(): array
    {
        global $db;

        $result = [];

        $sql = "
            SELECT *
            FROM ".MAIN_DB_PREFIX."entity
            WHERE active=1
            ORDER BY label ASC
        ";

        $rows = $db->query($sql);
        if ($rows) {
            while ($row = $db->fetch_object($rows)) {
                $result[] = [
                    'id' => $row->rowid,
                    'label' => $row->label
                ];
            }
        }

        return $result;
    }
}