mirror of
https://github.com/php/web-bugs.git
synced 2026-03-24 15:52:09 +01:00
This reverts commit 5cdac95adc.
Due to the https://github.com/php/web-bugs/pull/77 discussion and
request from a prominent member of the PHP group - Kalle - I'm reverting
this awesome addition because it caused too many conflicts and issues.
So it is not worth of investing more from my side into this neither
having a ruined experience further on from any side here.
This fix has been really helpful with some development ways but people
who maintain this app further better have peace of mind...
93 lines
3.0 KiB
PHP
93 lines
3.0 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Container initialization. Each service is created using Container::set()
|
|
* method and a callable argument for convenience of future customizations or
|
|
* adjustments beyond the scope of this container. See documentation for more
|
|
* information.
|
|
*/
|
|
|
|
use App\Container\Container;
|
|
|
|
$container = new Container(include __DIR__.'/parameters.php');
|
|
|
|
$container->set(\PDO::class, function ($c) {
|
|
return new \PDO(
|
|
'mysql:host='.$c->get('db_host').';dbname='.$c->get('db_name').';charset=utf8',
|
|
$c->get('db_user'),
|
|
$c->get('db_password'),
|
|
[
|
|
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION,
|
|
\PDO::ATTR_DEFAULT_FETCH_MODE => \PDO::FETCH_ASSOC,
|
|
\PDO::ATTR_EMULATE_PREPARES => false,
|
|
\PDO::ATTR_STATEMENT_CLASS => [App\Database\Statement::class],
|
|
]
|
|
);
|
|
});
|
|
|
|
$container->set(App\Repository\BugRepository::class, function ($c) {
|
|
return new App\Repository\BugRepository($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Repository\CommentRepository::class, function ($c) {
|
|
return new App\Repository\CommentRepository($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Repository\DatabaseStatusRepository::class, function ($c) {
|
|
return new App\Repository\DatabaseStatusRepository($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Repository\ObsoletePatchRepository::class, function ($c) {
|
|
return new App\Repository\ObsoletePatchRepository($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Repository\PackageRepository::class, function ($c) {
|
|
return new App\Repository\PackageRepository($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Repository\PatchRepository::class, function ($c) {
|
|
return new App\Repository\PatchRepository($c->get(\PDO::class), $c->get('uploads_dir'));
|
|
});
|
|
|
|
$container->set(App\Repository\PhpInfoRepository::class, function ($c) {
|
|
return new App\Repository\PhpInfoRepository();
|
|
});
|
|
|
|
$container->set(App\Repository\PullRequestRepository::class, function ($c) {
|
|
return new App\Repository\PullRequestRepository($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Repository\ReasonRepository::class, function ($c) {
|
|
return new App\Repository\ReasonRepository($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Repository\VoteRepository::class, function ($c) {
|
|
return new App\Repository\VoteRepository($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Template\Engine::class, function ($c) {
|
|
return new App\Template\Engine($c->get('templates_dir'));
|
|
});
|
|
|
|
$container->set(App\Utils\Captcha::class, function ($c) {
|
|
return new App\Utils\Captcha();
|
|
});
|
|
|
|
$container->set(App\Utils\GitHub::class, function ($c) {
|
|
return new App\Utils\GitHub($c->get(\PDO::class));
|
|
});
|
|
|
|
$container->set(App\Utils\PatchTracker::class, function ($c) {
|
|
return new App\Utils\PatchTracker(
|
|
$c->get(\PDO::class),
|
|
$c->get(App\Utils\Uploader::class),
|
|
$c->get('uploads_dir')
|
|
);
|
|
});
|
|
|
|
$container->set(App\Utils\Uploader::class, function ($c) {
|
|
return new App\Utils\Uploader();
|
|
});
|
|
|
|
return $container;
|