ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilImportMapping.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 public array $mappings;
28 public string $install_id;
29 public string $install_url;
30 public ilLogger $log;
31
32 protected int $target_id = 0;
33
34 public function __construct()
35 {
36 $this->mappings = array();
37 $this->log = ilLoggerFactory::getLogger("exp");
38 $this->log->debug("ilImportMapping Construct this->mappings = array()");
39 }
40
41 final public function setInstallId(string $a_val): void
42 {
43 $this->install_id = $a_val;
44 }
45
46 final public function getInstallId(): string
47 {
48 return $this->install_id;
49 }
50
51 final public function setInstallUrl(string $a_val): void
52 {
53 $this->install_url = $a_val;
54 }
55
56 final public function getInstallUrl(): string
57 {
58 return $this->install_url;
59 }
60
61 final public function setTargetId(int $a_target_id): void
62 {
63 $this->target_id = $a_target_id;
64 $this->log->debug("a_target_id=" . $a_target_id);
65 }
66
67 final public function getTargetId(): int
68 {
69 return $this->target_id;
70 }
71
72 public function addMapping(
73 string $a_comp,
74 string $a_entity,
75 string $a_old_id,
76 string $a_new_id
77 ): void {
78 $this->mappings[$a_comp][$a_entity][$a_old_id] = $a_new_id;
79 //$this->log->debug("ADD MAPPING this->mappings = ", $this->mappings);
80 }
81
82 public function getMapping(
83 string $a_comp,
84 string $a_entity,
85 string $a_old_id
86 ): ?string {
87 $this->log->debug("a_comp = $a_comp, a_entity = $a_entity , a_old_id = $a_old_id");
88
89 if (!isset($this->mappings[$a_comp]) or !isset($this->mappings[$a_comp][$a_entity])) {
90 return null;
91 }
92 if (isset($this->mappings[$a_comp][$a_entity][$a_old_id])) {
93 return $this->mappings[$a_comp][$a_entity][$a_old_id];
94 }
95
96 return null;
97 }
98
99 public function getAllMappings(): array
100 {
101 return $this->mappings;
102 }
103
104 public function getMappingsOfEntity(
105 string $a_comp,
106 string $a_entity
107 ): array {
108 if (isset($this->mappings[$a_comp][$a_entity])) {
109 return $this->mappings[$a_comp][$a_entity];
110 }
111 return array();
112 }
113}
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
setInstallId(string $a_val)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
setTargetId(int $a_target_id)
setInstallUrl(string $a_val)
getMappingsOfEntity(string $a_comp, string $a_entity)
static getLogger(string $a_component_id)
Get component logger.
Component logger with individual log levels by component id.
if(!file_exists('../ilias.ini.php'))