This repository has been archived on 2024-08-26. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/maker/Controller.tpl.php

26 lines
705 B
PHP
Raw Permalink Normal View History

2024-04-17 23:44:37 +00:00
<?= "<?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 } ?>
}
}