modify maker
This commit is contained in:
25
maker/Controller.tpl.php
Normal file
25
maker/Controller.tpl.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?= "<?php\n" ?>
|
||||
|
||||
namespace <?= $namespace; ?>;
|
||||
|
||||
<?= $use_statements; ?>
|
||||
|
||||
class <?= $class_name; ?> extends AbstractController
|
||||
{
|
||||
<?= $generator->generateRouteForControllerMethod($route_path, $route_name); ?>
|
||||
public function <?= $method_name ?>(): <?php if ($with_template) { ?>Response<?php } else { ?>JsonResponse<?php } ?>
|
||||
|
||||
{
|
||||
<?php if ($with_template) { ?>
|
||||
return $this->render('<?= $template_name ?>', [
|
||||
'controller_name' => '<?= $class_name ?>',
|
||||
'debug' => null,
|
||||
]);
|
||||
<?php } else { ?>
|
||||
return $this->json([
|
||||
'message' => 'Welcome to your new controller!',
|
||||
'path' => '<?= $relative_path; ?>',
|
||||
]);
|
||||
<?php } ?>
|
||||
}
|
||||
}
|
||||
13
maker/twig_template.tpl.php
Normal file
13
maker/twig_template.tpl.php
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends '@nytwig/master.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
<div class="example-wrapper">
|
||||
<h1>Hello {{ controller_name }}! ✅</h1>
|
||||
|
||||
This friendly message is coming from:
|
||||
<ul>
|
||||
<li>Your controller at <code><?= $root_directory ?>/<?= $controller_path ?></code></li>
|
||||
<li>Your template at <code><?= $root_directory ?>/<?= $relative_path ?></code></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user