Enable Discovery debug logging for production troubleshooting
- Add DISCOVERY_LOG_LEVEL=debug - Add DISCOVERY_SHOW_PROGRESS=true - Temporary changes for debugging InitializerProcessor fixes on production
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Framework\View\Processors;
|
||||
|
||||
use App\Framework\DI\Container;
|
||||
use App\Framework\Meta\MetaData;
|
||||
use App\Framework\View\DomProcessor;
|
||||
use App\Framework\Template\Processing\DomProcessor;
|
||||
use App\Framework\View\DomWrapper;
|
||||
use App\Framework\View\RenderContext;
|
||||
use App\Framework\View\TemplateProcessor;
|
||||
@@ -14,7 +16,6 @@ final class ForProcessor implements DomProcessor
|
||||
public function __construct(
|
||||
private Container $container,
|
||||
private ?TemplateProcessor $templateProcessor = null,
|
||||
|
||||
) {
|
||||
// Falls kein TemplateProcessor übergeben wird, erstellen wir einen mit den Standard-Prozessoren
|
||||
if ($this->templateProcessor === null) {
|
||||
@@ -35,9 +36,12 @@ final class ForProcessor implements DomProcessor
|
||||
|
||||
$output = '';
|
||||
|
||||
$items = $context->data[$in] ?? null;
|
||||
if (isset($context->model->{$in}) && $items === null) {
|
||||
$items = $context->model->{$in};
|
||||
// Handle nested property paths (e.g., "redis.key_sample")
|
||||
$items = $this->resolveValue($context->data, $in);
|
||||
|
||||
// Fallback to model if not found in data
|
||||
if ($items === null && isset($context->model)) {
|
||||
$items = $this->resolveValue(['model' => $context->model], 'model.' . $in);
|
||||
}
|
||||
|
||||
if (is_iterable($items)) {
|
||||
@@ -69,4 +73,25 @@ final class ForProcessor implements DomProcessor
|
||||
|
||||
return $dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolves nested property paths like "redis.key_sample"
|
||||
*/
|
||||
private function resolveValue(array $data, string $expr): mixed
|
||||
{
|
||||
$keys = explode('.', $expr);
|
||||
$value = $data;
|
||||
|
||||
foreach ($keys as $key) {
|
||||
if (is_array($value) && array_key_exists($key, $value)) {
|
||||
$value = $value[$key];
|
||||
} elseif (is_object($value) && isset($value->$key)) {
|
||||
$value = $value->$key;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user