From 883471cf96be5060ebf9c52a6c3fd3038ac484fa Mon Sep 17 00:00:00 2001 From: Guy Sartorelli <36352093+GuySartorelli@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:53:39 +1300 Subject: [PATCH] ENH Update code to reflect changes in template layer (#287) --- src/Controllers/ModuleInitialisationController.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Controllers/ModuleInitialisationController.php b/src/Controllers/ModuleInitialisationController.php index b8718547..e87f2e29 100644 --- a/src/Controllers/ModuleInitialisationController.php +++ b/src/Controllers/ModuleInitialisationController.php @@ -15,7 +15,8 @@ use Exception; use SilverStripe\Core\Manifest\Module; use SilverStripe\Model\ArrayData; -use SilverStripe\View\SSViewer; +use SilverStripe\View\SSTemplateEngine; +use SilverStripe\View\ViewLayerData; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -148,8 +149,8 @@ protected function initFeaturesPath(OutputInterface $output, Module $module) ); // Create dummy feature - $featureContent = ArrayData::create([]) - ->renderWith(__DIR__.'/../../templates/SkeletonFeature.ss'); + $engine = SSTemplateEngine::create(__DIR__.'/../../templates/SkeletonFeature.ss'); + $featureContent = $engine->render(ViewLayerData::create([])); file_put_contents($fullPath.'/placeholder.feature', $featureContent); } @@ -184,7 +185,8 @@ protected function initClassPath(OutputInterface $output, Module $module, $names 'Namespace' => $fullNamespace, 'ClassName' => $class, ]); - $classContent = $obj->renderWith(__DIR__.'/../../templates/FeatureContext.ss'); + $engine = SSTemplateEngine::create(__DIR__.'/../../templates/FeatureContext.ss'); + $classContent = $engine->render(ViewLayerData::create($obj)); file_put_contents($classPath ?? '', $classContent); // Log