ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilComponentRepositoryExistsObjective.php
Go to the documentation of this file.
1 <?php
19 declare(strict_types=1);
20 
21 use ILIAS\Setup;
22 
23 class ilComponentRepositoryExistsObjective implements Setup\Objective
24 {
28  public function getHash(): string
29  {
30  return hash("sha256", self::class);
31  }
32 
36  public function getLabel(): string
37  {
38  return "ilComponentRepository is initialized and stored into the environment.";
39  }
40 
44  public function isNotable(): bool
45  {
46  return true;
47  }
48 
52  public function getPreconditions(Setup\Environment $environment): array
53  {
54  return [
56  ];
57  }
58 
62  public function achieve(Setup\Environment $environment): Setup\Environment
63  {
64  $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
65 
66  $data_factory = new ILIAS\Data\Factory();
67  $component_repository = new ilArtifactComponentRepository(
68  $data_factory,
70  $data_factory,
71  $db
72  ),
73  $data_factory->version(ILIAS_VERSION_NUMERIC)
74  );
75 
76  return $environment->withResource(
77  Setup\Environment::RESOURCE_COMPONENT_REPOSITORY,
78  $component_repository
79  );
80  }
81 
85  public function isApplicable(Setup\Environment $environment): bool
86  {
87  return is_null($environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY));
88  }
89 }
const ILIAS_VERSION_NUMERIC
Implementation of ilPluginStateDB over ilDBInterface.
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.