Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup changes #3

Merged
merged 13 commits into from
Oct 28, 2022
6 changes: 3 additions & 3 deletions app/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
use App\Factories\RendererFactory;
use DI\ContainerBuilder;
use Psr\Log\LoggerInterface;
use Slim\Views\PhpRenderer;

return function (ContainerBuilder $containerBuilder) {
$container = [];

$container[LoggerInterface::class] = DI\factory(LoggerFactory::class);
$container['renderer'] = DI\factory(RendererFactory::class);
$container['PDO'] = DI\factory(PDOFactory::class);

$container[PhpRenderer::class] = DI\factory(RendererFactory::class);
mporam marked this conversation as resolved.
Show resolved Hide resolved
$container[PDO::class] = DI\factory(PDOFactory::class);
$containerBuilder->addDefinitions($container);
};
2 changes: 1 addition & 1 deletion app/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$container = $app->getContainer();

mporam marked this conversation as resolved.
Show resolved Hide resolved
$app->get('/', function ($request, $response, $args) use ($container) {
$renderer = $container->get('renderer');
$renderer = $container->get('Slim\Views\PhpRenderer');
mporam marked this conversation as resolved.
Show resolved Hide resolved
return $renderer->render($response, "index.php", $args);
});

Expand Down
2 changes: 1 addition & 1 deletion app/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
'db' => [
'host' => 'mysql:host=127.0.0.1;',
'name' => 'dbname=example',
'name' => 'dbname=cheeses',
mporam marked this conversation as resolved.
Show resolved Hide resolved
'user' => 'root',
'password' => 'password',
'debug' => true
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/CoursesAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class CoursesAPIController
{
protected CoursesModel $model;
private CoursesModel $model;

// Here, the parameter is automatically supplied by the Dependency Injection Container based on the type hint
public function __construct(CoursesModel $model)
Expand Down