Skip to content

Commit 8d47390

Browse files
committed
Добавил метод setMap для ручного добавления карт трансформации
1 parent 54a7220 commit 8d47390

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/MapsManager.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,20 @@ public function setMapDir(string $entityName, string $dir): void
2222
$this->mapsDirs[$entityName] = $dir;
2323
}
2424

25-
/**
26-
* @param string $entityName
27-
* @param string $mapName
28-
*
29-
* @return array[]
30-
*/
3125
public function getMap(string $entityName, string $mapName = 'dto'): array
3226
{
3327
$map = $this->cache[$entityName][$mapName] ?? null;
3428
if ($map === null) {
3529
$dir = $this->mapsDirs[$entityName];
3630
$rules = require $dir.'/'.$mapName.'.php';
37-
$this->cache[$entityName][$mapName] = $this->normalizer->normalize($rules);
31+
$this->setMap($rules, $entityName, $mapName);
3832
}
3933

4034
return $this->cache[$entityName][$mapName];
4135
}
36+
37+
public function setMap(array $rules, string $entityName, $mapName = 'dto'): void
38+
{
39+
$this->cache[$entityName][$mapName] = $this->normalizer->normalize($rules);
40+
}
4241
}

0 commit comments

Comments
 (0)