diff --git a/CHANGELOG.md b/CHANGELOG.md index b95a100c..12031e57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ class name. * fix(`ProxyGenerator`): Borrow `__CG__` marker for compatibility with third-party libraries. +* feat(`MapperDataCollector`): Add lazy badge for lazy results. ## 0.7.0 diff --git a/src/Debug/TraceData.php b/src/Debug/TraceData.php index 292ba170..efdfc975 100644 --- a/src/Debug/TraceData.php +++ b/src/Debug/TraceData.php @@ -17,6 +17,7 @@ use Rekalogika\Mapper\Util\TypeUtil; use Symfony\Component\PropertyInfo\Type; use Symfony\Component\VarDumper\Cloner\Data; +use Symfony\Component\VarExporter\LazyObjectInterface; final class TraceData { @@ -118,6 +119,16 @@ public function getResultType(): string return $this->resultType ?? '__unknown__'; } + public function isLazyLoadingResult(): bool + { + $class = $this->getResultType(); + if (!class_exists($class)) { + return false; + } + + return is_a($class, LazyObjectInterface::class, true); + } + public function getTotalMappingsIncludingSubMappings(): int { $total = 1; diff --git a/templates/data_collector.html.twig b/templates/data_collector.html.twig index b829a462..e15bae87 100644 --- a/templates/data_collector.html.twig +++ b/templates/data_collector.html.twig @@ -3,28 +3,28 @@ {% block toolbar %} {% if collector.totalMappings > 0 %} {% set icon %} - {{ source('@RekalogikaMapper/map.svg') }} -
+ {{ source('@RekalogikaMapper/map.svg') }} + {% endset %} {% set text %} - + - + - + {% endset %} {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url }) }} @@ -77,7 +77,12 @@