Skip to content

Commit

Permalink
Merge pull request #1005 from cakephp/3.x-plugin-class-template
Browse files Browse the repository at this point in the history
add note to remove method hooks in generated template if not needed
  • Loading branch information
markstory authored Oct 4, 2024
2 parents d9bbe8e + 02a449b commit 1f1a4d0
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions templates/bake/Plugin/src/Plugin.php.twig
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class {{ name }}Plugin extends BasePlugin
*/
public function bootstrap(PluginApplicationInterface $app): void
{
// remove this method hook if you don't need it
}

/**
Expand All @@ -54,6 +55,7 @@ class {{ name }}Plugin extends BasePlugin
*/
public function routes(RouteBuilder $routes): void
{
// remove this method hook if you don't need it
$routes->plugin(
'{{ plugin }}',
['path' => '/{{ routePath }}'],
Expand All @@ -75,6 +77,7 @@ class {{ name }}Plugin extends BasePlugin
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
{
// Add your middlewares here
// remove this method hook if you don't need it

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

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

Expand All @@ -104,5 +108,6 @@ class {{ name }}Plugin extends BasePlugin
public function services(ContainerInterface $container): void
{
// Add your services here
// remove this method hook if you don't need it
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class ExamplePlugin extends BasePlugin
*/
public function bootstrap(PluginApplicationInterface $app): void
{
// remove this method hook if you don't need it
}

/**
Expand All @@ -39,6 +40,7 @@ public function bootstrap(PluginApplicationInterface $app): void
*/
public function routes(RouteBuilder $routes): void
{
// remove this method hook if you don't need it
$routes->plugin(
'Company/Example',
['path' => '/company/example'],
Expand All @@ -60,6 +62,7 @@ function (RouteBuilder $builder) {
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
{
// Add your middlewares here
// remove this method hook if you don't need it

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

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

Expand All @@ -89,5 +93,6 @@ public function console(CommandCollection $commands): CommandCollection
public function services(ContainerInterface $container): void
{
// Add your services here
// remove this method hook if you don't need it
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class SimpleExamplePlugin extends BasePlugin
*/
public function bootstrap(PluginApplicationInterface $app): void
{
// remove this method hook if you don't need it
}

/**
Expand All @@ -39,6 +40,7 @@ public function bootstrap(PluginApplicationInterface $app): void
*/
public function routes(RouteBuilder $routes): void
{
// remove this method hook if you don't need it
$routes->plugin(
'SimpleExample',
['path' => '/simple-example'],
Expand All @@ -60,6 +62,7 @@ function (RouteBuilder $builder) {
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
{
// Add your middlewares here
// remove this method hook if you don't need it

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

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

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

0 comments on commit 1f1a4d0

Please sign in to comment.