Here’s a fun pestle
command I forgot about.
pestle.phar magento2:search:search_controllers
This command accepts a file path as a single argument, searches through the specified folder for anything that looks like a Magento controller file, and then displays that controller file’s execute
method along with its relative file path.
Pipe the resulting output to a file or text editor, and you can quickly search through all Magento’s controller files. For example, today I forgot the syntax for adding a custom handle to a layout update XML file – but with magento2:search:search_controllers
the syntax was and a “Ctrl-F
handle” away.
$ pestle.phar magento2:search:search_controllers
//...
vendor/magento/module-backend/Controller/Adminhtml/Denied.php
--------------------------------------------------
function execute()
{
if (!$this->_auth->isLoggedIn()) {
/** @var MagentoBackendModelViewResultRedirect $resultRedirect */
$resultRedirect = $this->resultRedirectFactory->create();
$resultRedirect->setStatusHeader(403, '1.1', 'Forbidden');
return $resultRedirect->setPath('*/auth/login');
}
/** @var MagentoBackendModelViewResultPage $resultPage */
$resultPage = $this->resultPageFactory->create();
$resultPage->setStatusHeader(403, '1.1', 'Forbidden');
$resultPage->addHandle('adminhtml_denied');
return $resultPage;
}
//...