Skip to content

Commit 4e7dbaf

Browse files
committed
add comments
1 parent 8d8d28d commit 4e7dbaf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cloud_sql/mysql/pdo/src/app.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@
2424
use Slim\Views\Twig;
2525
use Slim\Views\TwigMiddleware;
2626

27+
// Create and set the dependency injection container.
2728
$container = new Container;
2829
AppFactory::setContainer(new Psr11Container($container));
29-
$app = AppFactory::create();
3030

31+
// add the votes manager to the container.
3132
$container['votes'] = function (Container $container) {
3233
return new Votes($container['db']);
3334
};
3435

36+
// Setup the database connection in the container.
3537
$container['db'] = function () {
3638
$username = getenv("DB_USER");
3739
$password = getenv("DB_PASS");
@@ -75,12 +77,18 @@
7577
return $conn;
7678
};
7779

80+
// Configure the templating engine.
7881
$container['view'] = function() {
7982
return Twig::create(__DIR__ . '/../views');
8083
};
8184

85+
// Create the application.
86+
$app = AppFactory::create();
87+
88+
// Add the twig middleware
8289
$app->add(TwigMiddleware::createFromContainer($app));
8390

91+
// Setup error handlinmg
8492
$app->addErrorMiddleware(true, false, false);
8593

8694
return $app;

0 commit comments

Comments
 (0)