From 99f78f7362f6ca3a832049775fe834c552ed17fe Mon Sep 17 00:00:00 2001 From: User Date: Wed, 14 Aug 2024 21:27:27 +0300 Subject: [PATCH] 20240814#2 --- application/config/factories/templateFactory.php | 2 +- application/config/routes/90-main.yaml | 4 ++-- application/config/routes/routes.php | 12 +++++------- .../config/routes/main => src/Application}/.gitkeep | 0 src/{Main/Application => Domain/Entity}/.gitkeep | 0 .../Domain/Entity => Domain/Repository}/.gitkeep | 0 .../Repository => Domain/ValueObject}/.gitkeep | 0 .../Infrastructure/Controllers/IndexController.php | 11 ++++++----- .../Repository}/.gitkeep | 0 src/{Main => }/Infrastructure/templates/index.tpl | 0 src/Main/Infrastructure/Repository/.gitkeep | 0 11 files changed, 14 insertions(+), 15 deletions(-) rename {application/config/routes/main => src/Application}/.gitkeep (100%) rename src/{Main/Application => Domain/Entity}/.gitkeep (100%) rename src/{Main/Domain/Entity => Domain/Repository}/.gitkeep (100%) rename src/{Main/Domain/Repository => Domain/ValueObject}/.gitkeep (100%) rename src/{Main => }/Infrastructure/Controllers/IndexController.php (68%) rename src/{Main/Domain/ValueObject => Infrastructure/Repository}/.gitkeep (100%) rename src/{Main => }/Infrastructure/templates/index.tpl (100%) delete mode 100644 src/Main/Infrastructure/Repository/.gitkeep diff --git a/application/config/factories/templateFactory.php b/application/config/factories/templateFactory.php index 9e0c67a..4b1cf58 100644 --- a/application/config/factories/templateFactory.php +++ b/application/config/factories/templateFactory.php @@ -1,4 +1,4 @@ setSubtemplatePath('/application/src/Infrastructure/templates/')->setSubtemplatePathAlias([ - "main" => "/src/Main/Infrastructure/templates", + "main" => "/src/Infrastructure/templates", ]); diff --git a/application/config/routes/90-main.yaml b/application/config/routes/90-main.yaml index 5ed7763..9f9eaf4 100644 --- a/application/config/routes/90-main.yaml +++ b/application/config/routes/90-main.yaml @@ -1,13 +1,13 @@ # Index - key: "/" routes: - - action: "App\\Main\\Infrastructure\\Controllers\\IndexController" + - action: "App\\Infrastructure\\Controllers\\IndexController" method: "index" params: "" # Empty - key: "<@any>" routes: - - action: "App\\Main\\Infrastructure\\Controllers\\IndexController" + - action: "App\\nfrastructure\\Controllers\\IndexController" method: "emptyAction" params: "" diff --git a/application/config/routes/routes.php b/application/config/routes/routes.php index 1151ccc..a02ee31 100644 --- a/application/config/routes/routes.php +++ b/application/config/routes/routes.php @@ -1,17 +1,15 @@ addHeader("App-Mode", "Dev"); $this->template()->setValue("title", "Главная"); - $this->template()->setSubtemplate("main", "@main/index.tpl", [ - "date" => (new \DateTime())->format('Y-m-d H:i:s') - ]); } catch(\Throwable $e){$error = $this->checkError($e);} - return $this->render(); + + return $this->renderResponse("main", "@main/index.tpl", [ + "date" => (new \DateTime())->format('Y-m-d H:i:s'), + "error" => $error ?? null + ]); } } diff --git a/src/Main/Domain/ValueObject/.gitkeep b/src/Infrastructure/Repository/.gitkeep similarity index 100% rename from src/Main/Domain/ValueObject/.gitkeep rename to src/Infrastructure/Repository/.gitkeep diff --git a/src/Main/Infrastructure/templates/index.tpl b/src/Infrastructure/templates/index.tpl similarity index 100% rename from src/Main/Infrastructure/templates/index.tpl rename to src/Infrastructure/templates/index.tpl diff --git a/src/Main/Infrastructure/Repository/.gitkeep b/src/Main/Infrastructure/Repository/.gitkeep deleted file mode 100644 index e69de29..0000000