ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilComponentRepositoryExistsObjective.php
Go to the documentation of this file.
1 <?php
2 
20 declare(strict_types=1);
21 
22 use ILIAS\Setup;
23 
24 class ilComponentRepositoryExistsObjective implements Setup\Objective
25 {
29  public function getHash(): string
30  {
31  return hash("sha256", self::class);
32  }
33 
37  public function getLabel(): string
38  {
39  return "ilComponentRepository (with database) is initialized and stored into the environment.";
40  }
41 
45  public function isNotable(): bool
46  {
47  return true;
48  }
49 
53  public function getPreconditions(Setup\Environment $environment): array
54  {
55  return [
57  ];
58  }
59 
63  public function achieve(Setup\Environment $environment): Setup\Environment
64  {
65  $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
66 
67  $data_factory = new ILIAS\Data\Factory();
68  $component_repository = new ilArtifactComponentRepository(
69  $data_factory,
71  $data_factory,
72  $db
73  ),
74  $data_factory->version(ILIAS_VERSION_NUMERIC)
75  );
76 
77  return $environment->withResource(
78  Setup\Environment::RESOURCE_COMPONENT_REPOSITORY,
79  $component_repository
80  );
81  }
82 
86  public function isApplicable(Setup\Environment $environment): bool
87  {
88  return is_null($environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY));
89  }
90 }
Implementation of ilPluginStateDB over ilDBInterface.
const ILIAS_VERSION_NUMERIC
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
Repository for component data implemented over artifacts.