mirror of
https://github.com/php/web-pecl.git
synced 2026-03-23 23:02:08 +01:00
Move Category entity to container
This commit is contained in:
@@ -37,11 +37,7 @@ $generateFixturesCommand = new GenerateFixturesCommand();
|
||||
$generateFixturesCommand->setDatabase($database);
|
||||
$generateFixturesCommand->setConfig($config);
|
||||
|
||||
$category = new Category();
|
||||
$category->setDatabase($database);
|
||||
$category->setRest($rest);
|
||||
|
||||
$fixtures = new AppFixtures($database, Factory::create(), $category, $packageEntity);
|
||||
$fixtures = new AppFixtures($database, Factory::create(), $container->get(Category::class), $packageEntity);
|
||||
$generateFixturesCommand->setFixtures($fixtures);
|
||||
|
||||
$application->add($generateFixturesCommand);
|
||||
|
||||
@@ -136,4 +136,12 @@ $container->set(App\PackageDll::class, function ($c) {
|
||||
return new App\PackageDll($c->get('tmp_dir'));
|
||||
});
|
||||
|
||||
$container->set(App\Entity\Category::class, function ($c) {
|
||||
$category = new App\Entity\Category();
|
||||
$category->setDatabase($c->get(App\Database::class));
|
||||
$category->setRest($c->get(App\Rest::class));
|
||||
|
||||
return $category;
|
||||
});
|
||||
|
||||
return $container;
|
||||
|
||||
@@ -32,9 +32,7 @@ use App\TreeMenu\DynamicHtml;
|
||||
|
||||
$auth->secure(true);
|
||||
|
||||
$category = new Category();
|
||||
$category->setDatabase($database);
|
||||
$category->setRest($rest);
|
||||
$category = $container->get(Category::class);
|
||||
|
||||
/**
|
||||
* Function to recurse thru the tree adding nodes to treemenu
|
||||
|
||||
@@ -25,9 +25,6 @@ use App\User;
|
||||
require_once __DIR__.'/../../include/pear-prepend.php';
|
||||
|
||||
$releaseRepository = $container->get(ReleaseRepository::class);
|
||||
$category = new Category();
|
||||
$category->setDatabase($database);
|
||||
$category->setRest($rest);
|
||||
|
||||
function rssBailout() {
|
||||
header('HTTP/1.0 404 Not Found');
|
||||
@@ -84,7 +81,7 @@ switch ($type) {
|
||||
case 'cat':
|
||||
$categoryName = $argument;
|
||||
|
||||
if (false === $category->isValid($categoryName)) {
|
||||
if (false === $container->get(Category::class)->isValid($categoryName)) {
|
||||
rssBailout();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,4 @@ header('Content-type: text/plain; charset=utf-8');
|
||||
|
||||
print htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES)."\n\n";
|
||||
|
||||
$category = new Category();
|
||||
$category->setDatabase($database);
|
||||
$category->setRest($rest);
|
||||
$category->renumberVisitations(true);
|
||||
$container->get(Category::class)->renumberVisitations(true);
|
||||
|
||||
Reference in New Issue
Block a user