Commit 48a3f457 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Correction signature de fonction + recussion du remplacement de macro

parent b94b3323
Pipeline #11627 passed with stage
in 21 seconds
......@@ -145,12 +145,14 @@ class RenduService {
* @param array $variables
* @return Rendu
*/
public function genereateRenduByTemplateCode(string $code, array $variables) : Rendu
public function generateRenduByTemplateCode(string $code, array $variables) : Rendu
{
$template = $this->getTemplateService()->getTemplateByCode($code);
if ($template === null) throw new RuntimeException('Aucun template de trouvé avec le code ['.$code.']');
$rendu = $this->generateRenduByTemplate($template, $variables);
//todo faire mieux pour rappliquer
$rendu->setCorps($this->getTemplateService()->replaceMacros($rendu->getCorps(), $variables));
return $rendu;
}
}
......@@ -149,7 +149,7 @@ class TemplateService {
* @param array $variables
* @return string
*/
private function replaceMacros(string $texteInitial, array $variables) : string
public function replaceMacros(string $texteInitial, array $variables) : string
{
$matches = [];
preg_match_all('/VAR\[[a-zA-Z0-9_]*#[a-zA-Z0-9_]*\]/', $texteInitial, $matches);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment