From 8af42f6827626a06048b1af5664eda5f107f2245 Mon Sep 17 00:00:00 2001 From: gggeek Date: Sun, 22 Jan 2023 15:39:35 +0000 Subject: [PATCH] make server codegen demo closer to real-life usecase (fixed controller code, autogn dm) --- demo/server/codegen.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/demo/server/codegen.php b/demo/server/codegen.php index 857f6ba0..db06d157 100644 --- a/demo/server/codegen.php +++ b/demo/server/codegen.php @@ -18,7 +18,8 @@ $code = $w->wrapPhpClass( ); $targetClassFile = '/tmp/MyServerClass.php'; -$targetServerFile = '/tmp/myServer.php'; +$targetDispatchMapFile = '/tmp/myServerDispatchMap.php'; +$targetControllerFile = '/tmp/myServerController.php'; // generate a file with a class definition @@ -40,9 +41,11 @@ foreach($code as $methodName => $methodDef) { } file_put_contents($targetClassFile, "}\n", FILE_APPEND) || die('uh oh'); -// generate a separate file with the xml-rpc server instantiation and its dispatch map +// generate separate files with the xml-rpc server instantiation and its dispatch map -file_put_contents($targetServerFile, +file_put_contents($targetDispatchMapFile, "setDebug(2);' . "\n" . @@ -70,4 +73,4 @@ file_put_contents($targetServerFile, // *** NB do not do this in prod! The whole concept of code-generation is to do it offline using console scripts/ci/cd *** -include $targetServerFile; +include $targetControllerFile; -- 2.47.0