Skip to content

Commit

Permalink
Merge pull request #2 from b13/issue-1
Browse files Browse the repository at this point in the history
[TASK] Use __invoke as default backend controller method
  • Loading branch information
o-ba authored Dec 21, 2021
2 parents 40e8b43 + 089fdbd commit fbad6bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 1 addition & 4 deletions Classes/Command/Component/BackendControllerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@ protected function createComponent(): ComponentInterface
)
)
->setMethodName(
(string)$this->io->ask(
'Enter the method, which should handle the request?',
$this->getProposalFromEnvironment('BACKEND_CONTROLLER_METHOD_NAME', 'handleRequest')
)
(string)$this->io->ask('Enter the method, which should handle the request - LEAVE EMPTY FOR USING __invoke()')
);
}

Expand Down
4 changes: 2 additions & 2 deletions Classes/Component/BackendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function getArrayConfiguration(): array
{
return [
'path' => $this->routePath,
'target' => $this->getClassName() . '::' . $this->methodName,
'target' => $this->getClassName() . ($this->methodName !== '' ? '::' . $this->methodName : ''),
];
}

Expand All @@ -80,7 +80,7 @@ public function __toString(): string
[
'NAMESPACE' => $this->getNamespace(),
'NAME' => $this->name,
'METHOD' => $this->methodName
'METHOD' => $this->methodName ?: '__invoke',
]
);
}
Expand Down

0 comments on commit fbad6bd

Please sign in to comment.