ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilComponentFactoryExistsObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22
27{
31 public function getHash(): string
32 {
33 return hash("sha256", self::class);
34 }
35
39 public function getLabel(): string
40 {
41 return "ilComponentFactory is initialized and stored into the environment.";
42 }
43
47 public function isNotable(): bool
48 {
49 return true;
50 }
51
55 public function getPreconditions(Setup\Environment $environment): array
56 {
57 return [
58 new \ilDatabaseUpdatedObjective(),
59 new \ilComponentRepositoryExistsObjective()
60 ];
61 }
62
66 public function achieve(Setup\Environment $environment): Setup\Environment
67 {
68 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
69 $component_repository = $environment->getResource(Setup\Environment::RESOURCE_COMPONENT_REPOSITORY);
70
71 $component_factory = new ilComponentFactoryImplementation(
72 $component_repository,
73 $db
74 );
75
76 return $environment->withResource(
77 Setup\Environment::RESOURCE_COMPONENT_FACTORY,
78 $component_factory
79 );
80 }
81
85 public function isApplicable(Setup\Environment $environment): bool
86 {
87 return is_null($environment->getResource(Setup\Environment::RESOURCE_COMPONENT_FACTORY));
88 }
89}
isApplicable(Setup\Environment $environment)
@inheritDoc
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...