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 four places in the code: replace {1} with {2} where is 5 is depth param
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:
$level === 0 && ---|--- $level < [B]5 [/B]&&
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>[B]5[/B], $level + 1, $template);
Code:
mb_stripos($template, '{{#each ' . $relation . '}}') !== false ---|--- (preg_match('/{{#each.*' . preg_quote($relation, '/') . '.*}}/i', $template))
