modelsManager error

this is my simple code

$app->get(
    '/users',
    function () use ($app) {
        $phql = "SELECT * FROM users";
        $users = $app->modelsManager->executeQuery($phql);
        $data = [];
        foreach ($users as $user) {
            $data[] = [
                'id'     => $user->id,
                'email'  => $user->email
            ];
        }
        echo json_encode($data);
    }
);

but it always goes 500 (internal server error) in my browser, if i just echoing something, it works well,

Use Fully Qualified Class Name for PHQL. For example:

$phql = "SELECT * FROM \My\Namespace\Users";


29.9k

Hi,

with error 500, you should have a look at your webserver logs, usually you will find tgere the reason of that error.