Skip to content

Commit

Permalink
fixed issue 17 and added email template code generator
Browse files Browse the repository at this point in the history
  • Loading branch information
ashutosh committed Jan 3, 2020
1 parent 29c6acb commit 8b1fef8
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Model/Generate/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public function createAdminController($dir, $data)
{
$fileName = ucfirst($data['name']);
$nameSpace = $data['module'];
$resource = $data['resource'];
$pathParts = explode("Controller/", $data['path']);

$nameArray = explode("_", $nameSpace);
Expand All @@ -111,6 +112,7 @@ public function createAdminController($dir, $data)
$controllerFile = str_replace('%module_name%', $data['module'], $controllerFile);
$controllerFile = str_replace('%class_name%', $fileName, $controllerFile);
$controllerFile = str_replace('%namespace%', $nameSpace, $controllerFile);
$controllerFile = str_replace('%resource_name%', $resource, $controllerFile);
$this->helper->saveFile(
$dir.DIRECTORY_SEPARATOR.$fileName.'.php',
$controllerFile
Expand Down
3 changes: 3 additions & 0 deletions Model/Generate/Controller/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public function validate($data)
$name = $data['name'];
$area = $data['area'] ?? null;
$path = $data['path'] ?? null;
$resource = $data['resource'] ?? null;
$response = [];
if ($module) {
$moduleManager = \Magento\Framework\App\ObjectManager::getInstance()
Expand All @@ -42,6 +43,8 @@ public function validate($data)
throw new \InvalidArgumentException(__("name is required"));
}

$response['resource'] = $resource;

$dir = \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Module\Dir::class);

Expand Down
7 changes: 7 additions & 0 deletions Model/OptionsPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ public function getOptions()
'enter router name'
),

new InputOption(
'resource',
're',
InputArgument::OPTIONAL,
'enter resource name for admin user authorization'
),

//plugin specific
new InputOption(
'plugin',
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "webkul/code-generator",
"description": "module lets you generate models, controller, helpers in seconds so that you can focus more on application logic ",
"type": "magento2-module",
"version": "2.0.4",
"version": "2.0.5",
"license": [
"proprietary"
],
Expand Down

0 comments on commit 8b1fef8

Please sign in to comment.