Skip to content

Commit 8550034

Browse files
committed
WIP
Signed-off-by: alexmerlin <alex.merlin.1985@gmail.com>
1 parent 9b27e01 commit 8550034

6 files changed

Lines changed: 3202 additions & 17 deletions

File tree

src/FileSystem.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -445,26 +445,21 @@ public function serviceInterface(string $name): File
445445
);
446446
}
447447

448-
public function templateFile(string $subDirectory, string $name): File
448+
public function templateDir(string $name): Directory
449449
{
450-
return new File(
451-
$this->templatesDir($subDirectory),
452-
'',
450+
return new Directory(
453451
$name,
454-
'html.twig'
452+
sprintf('%s/src/%s/templates', $this->context->getProjectPath(), $this->moduleName)
455453
);
456454
}
457455

458-
public function templates(string $name = 'templates'): Directory
459-
{
460-
return new Directory($name, sprintf('%s/src/%s', $this->context->getProjectPath(), $this->moduleName));
461-
}
462-
463-
public function templatesDir(string $name): Directory
456+
public function templateFile(string $subDirectory, string $name): File
464457
{
465-
return new Directory(
458+
return new File(
459+
$this->templateDir($subDirectory),
460+
'',
466461
$name,
467-
sprintf('%s/src/%s/templates', $this->context->getProjectPath(), $this->moduleName)
462+
'html.twig'
468463
);
469464
}
470465

src/Type/Handler/GetDeleteResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function render(Component $handler, Component $entity, Component $form, C
119119
\$this->template->render('{$entity->toKebabCase()}::{$entity->toKebabCase()}-delete-form', [
120120
'form' => \$this->{$form->toCamelCase()}->prepare(),
121121
'{$entity->toKebabCase()}' => {$entity->getVariable()},
122-
]),
122+
])
123123
);
124124
BODY);
125125
// phpcs:enable Generic.Files.LineLength.TooLong

src/Type/Handler/PostDeleteResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function render(Component $handler, Component $entity, Component $form, C
134134
135135
return new HtmlResponse(
136136
\$this->template->render('{$entity->toKebabCase()}::{$entity->toKebabCase()}-delete-form', [
137-
'form' => \$this->{$form->toCamelCase()}->prepare(),
137+
'form' => \$this->{$form->toCamelCase()}->prepare(),
138138
'{$entity->toCamelCase()}' => {$entity->getVariable()},
139139
]),
140140
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY

src/Type/Handler/PostEditResourceHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ public function render(Component $handler, Component $entity, Component $form, C
155155
StatusCodeInterface::STATUS_UNPROCESSABLE_ENTITY
156156
);
157157
} catch (Throwable \$exception) {
158+
\$this->messenger->addError(Message::AN_ERROR_OCCURRED);
158159
\$this->logger->err('Update {$entity->getClassName()}', [
159160
'error' => \$exception->getMessage(),
160161
'file' => \$exception->getFile(),
161162
'line' => \$exception->getLine(),
162163
'trace' => \$exception->getTraceAsString(),
163164
]);
164-
\$this->messenger->addError(Message::AN_ERROR_OCCURRED);
165165
166166
return new EmptyResponse(StatusCodeInterface::STATUS_INTERNAL_SERVER_ERROR);
167167
}

test/Type/FormTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testCallToInvokeWillOutputErrorAndWillNotCreateFileWhenNameIsInv
142142
$this->import = new Import($this->context);
143143
$this->module = new Module($this->fileSystem, $this->context, $this->config);
144144

145-
$file = $this->fileSystem->inputFilter($this->resourceName);
145+
$file = $this->fileSystem->form($this->resourceName);
146146
$this->assertFalse($file->exists());
147147
$this->assertFileDoesNotExist($file->getPath());
148148

0 commit comments

Comments
 (0)