Skip to content

Commit 1f1a4d0

Browse files
authored
Merge pull request #1005 from cakephp/3.x-plugin-class-template
add note to remove method hooks in generated template if not needed
2 parents d9bbe8e + 02a449b commit 1f1a4d0

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

templates/bake/Plugin/src/Plugin.php.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ class {{ name }}Plugin extends BasePlugin
4141
*/
4242
public function bootstrap(PluginApplicationInterface $app): void
4343
{
44+
// remove this method hook if you don't need it
4445
}
4546

4647
/**
@@ -54,6 +55,7 @@ class {{ name }}Plugin extends BasePlugin
5455
*/
5556
public function routes(RouteBuilder $routes): void
5657
{
58+
// remove this method hook if you don't need it
5759
$routes->plugin(
5860
'{{ plugin }}',
5961
['path' => '/{{ routePath }}'],
@@ -75,6 +77,7 @@ class {{ name }}Plugin extends BasePlugin
7577
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
7678
{
7779
// Add your middlewares here
80+
// remove this method hook if you don't need it
7881

7982
return $middlewareQueue;
8083
}
@@ -88,6 +91,7 @@ class {{ name }}Plugin extends BasePlugin
8891
public function console(CommandCollection $commands): CommandCollection
8992
{
9093
// Add your commands here
94+
// remove this method hook if you don't need it
9195

9296
$commands = parent::console($commands);
9397

@@ -104,5 +108,6 @@ class {{ name }}Plugin extends BasePlugin
104108
public function services(ContainerInterface $container): void
105109
{
106110
// Add your services here
111+
// remove this method hook if you don't need it
107112
}
108113
}

tests/comparisons/Plugin/Company/Example/src/ExamplePlugin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ExamplePlugin extends BasePlugin
2626
*/
2727
public function bootstrap(PluginApplicationInterface $app): void
2828
{
29+
// remove this method hook if you don't need it
2930
}
3031

3132
/**
@@ -39,6 +40,7 @@ public function bootstrap(PluginApplicationInterface $app): void
3940
*/
4041
public function routes(RouteBuilder $routes): void
4142
{
43+
// remove this method hook if you don't need it
4244
$routes->plugin(
4345
'Company/Example',
4446
['path' => '/company/example'],
@@ -60,6 +62,7 @@ function (RouteBuilder $builder) {
6062
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
6163
{
6264
// Add your middlewares here
65+
// remove this method hook if you don't need it
6366

6467
return $middlewareQueue;
6568
}
@@ -73,6 +76,7 @@ public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
7376
public function console(CommandCollection $commands): CommandCollection
7477
{
7578
// Add your commands here
79+
// remove this method hook if you don't need it
7680

7781
$commands = parent::console($commands);
7882

@@ -89,5 +93,6 @@ public function console(CommandCollection $commands): CommandCollection
8993
public function services(ContainerInterface $container): void
9094
{
9195
// Add your services here
96+
// remove this method hook if you don't need it
9297
}
9398
}

tests/comparisons/Plugin/SimpleExample/src/SimpleExamplePlugin.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class SimpleExamplePlugin extends BasePlugin
2626
*/
2727
public function bootstrap(PluginApplicationInterface $app): void
2828
{
29+
// remove this method hook if you don't need it
2930
}
3031

3132
/**
@@ -39,6 +40,7 @@ public function bootstrap(PluginApplicationInterface $app): void
3940
*/
4041
public function routes(RouteBuilder $routes): void
4142
{
43+
// remove this method hook if you don't need it
4244
$routes->plugin(
4345
'SimpleExample',
4446
['path' => '/simple-example'],
@@ -60,6 +62,7 @@ function (RouteBuilder $builder) {
6062
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
6163
{
6264
// Add your middlewares here
65+
// remove this method hook if you don't need it
6366

6467
return $middlewareQueue;
6568
}
@@ -73,6 +76,7 @@ public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
7376
public function console(CommandCollection $commands): CommandCollection
7477
{
7578
// Add your commands here
79+
// remove this method hook if you don't need it
7680

7781
$commands = parent::console($commands);
7882

@@ -89,5 +93,6 @@ public function console(CommandCollection $commands): CommandCollection
8993
public function services(ContainerInterface $container): void
9094
{
9195
// Add your services here
96+
// remove this method hook if you don't need it
9297
}
9398
}

0 commit comments

Comments
 (0)