I suggest adding a data depth parameter to enable pulling a chain of related entities when printing to PDF and to support loops through nested references.
Example:
For this, I suggest fixing three places in the code: replace {1} with {2}
Example:
Code:
List of tariff points: {{serviceTariffsIds}} {{#each serviceTariffs}} Tariff point: {{name}} Type in tariff point: {{serviceType.name}} Scope of work in tariff point {{serviceType.serviceScopesIds}} {{#each serviceType.serviceScopes}} serviceScopeName:{{name}} {{/each}} {{/each}}
Code:
$list[] = $this->getDataFromEntity($item, $skipLinks, $level + 1); ---|--- $list[] = $this->getDataFromEntity($item, $skipLinks, $level + 1, $template);
Code:
$data[$relation] = $this->getDataFromEntity($relatedEntity, true, $level + 1); ---|--- $data[$relation] = $this->getDataFromEntity($relatedEntity, $level>5, $level + 1, $template);
Code:
mb_stripos($template, '{{#each ' . $relation . '}}') !== false ---|--- (preg_match('/{{#each.*' . preg_quote($relation, '/') . '.*}}/i', $template))