mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 10:38:45 +02:00
N°8910 - Upgrade Symfony packages (#811)
This commit is contained in:
@@ -50,6 +50,11 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
*/
|
||||
private array $resourceHierarchyLevels = [];
|
||||
|
||||
/**
|
||||
* @var array<string, array<string, bool>>
|
||||
*/
|
||||
private array $resourceInheritability = [];
|
||||
|
||||
/**
|
||||
* Creates a new renderer engine.
|
||||
*
|
||||
@@ -75,7 +80,17 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
// Unset instead of resetting to an empty array, in order to allow
|
||||
// implementations (like TwigRendererEngine) to check whether $cacheKey
|
||||
// is set at all.
|
||||
unset($this->resources[$cacheKey], $this->resourceHierarchyLevels[$cacheKey]);
|
||||
unset($this->resources[$cacheKey], $this->resourceHierarchyLevels[$cacheKey], $this->resourceInheritability[$cacheKey]);
|
||||
}
|
||||
|
||||
protected function setResourceInheritability(string $cacheKey, string $blockName, bool $inheritable): void
|
||||
{
|
||||
$this->resourceInheritability[$cacheKey][$blockName] = $inheritable;
|
||||
}
|
||||
|
||||
protected function isResourceInheritable(string $cacheKey, string $blockName): bool
|
||||
{
|
||||
return $this->resourceInheritability[$cacheKey][$blockName] ?? false;
|
||||
}
|
||||
|
||||
public function getResourceForBlockName(FormView $view, string $blockName): mixed
|
||||
@@ -144,6 +159,7 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
// cache. The only missing thing is to set the hierarchy level at which
|
||||
// the template was found.
|
||||
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $hierarchyLevel;
|
||||
$this->setResourceInheritability($cacheKey, $blockName, true);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -167,6 +183,7 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
// Cache the shortcuts for further accesses
|
||||
$this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName];
|
||||
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName];
|
||||
$this->setResourceInheritability($cacheKey, $blockName, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -175,6 +192,7 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
// Cache the shortcuts for further accesses
|
||||
$this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName];
|
||||
$this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName];
|
||||
$this->setResourceInheritability($cacheKey, $blockName, false);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -183,6 +201,7 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
// Cache the result for further accesses
|
||||
$this->resources[$cacheKey][$blockName] = false;
|
||||
$this->resourceHierarchyLevels[$cacheKey][$blockName] = false;
|
||||
$this->setResourceInheritability($cacheKey, $blockName, true);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -193,5 +212,6 @@ abstract class AbstractRendererEngine implements FormRendererEngineInterface, Re
|
||||
$this->useDefaultThemes = [];
|
||||
$this->resources = [];
|
||||
$this->resourceHierarchyLevels = [];
|
||||
$this->resourceInheritability = [];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user