I have updated my project based on Slim Framework to Slim 4 today. I'm working with the Medoo (database framework) here.
https://medoo.in/api/collaboration Here the Slim integration is explained:
use Medoo\Medoo;
$container = $app->getContainer();
$container['database'] = function () {
return new Medoo([
'database_type' => 'mysql',
'database_name' => 'name',
'server' => 'localhost',
'username' => 'your_username',
'password' => 'your_password'
]);
};
The Query looks like:
$datas = $this->database->select("accounts", "*");
The error message I have received since the update is the following:
Got error 'PHP message: Slim Application Error:\nType: Error\nCode: 0\nMessage: Using $this when not in object
Have any of you had the problem? I have tried everything that I have in experience. I can't get any further here