Skip to content

Commit 1b5791e

Browse files
author
Ashutosh Srivastva
authored
Merge pull request #36 from VikasTiwari-Webkul/feature/compatible-with-m2.4.6
Feature: Compatible with Magento 2.4.6
2 parents 693e204 + 3c39f4a commit 1b5791e

File tree

15 files changed

+88
-27
lines changed

15 files changed

+88
-27
lines changed

Console/Command/Generate.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ protected function configure()
5151
);
5252
parent::configure();
5353
}
54+
5455
/**
5556
* {@inheritdoc}
5657
*/
@@ -62,18 +63,21 @@ protected function execute(InputInterface $input, OutputInterface $output)
6263

6364
if (isset($this->validators[$data['type']])) {
6465
$data = $this->validators[$data['type']]->validate($data);
65-
$this->generate($data, $output);
66+
if ($this->generate($data, $output)){
67+
return 0;
68+
}
6669
} else {
6770
throw new \InvalidArgumentException(__("invalid type"));
6871
}
72+
exit;
6973
}
7074

7175
/**
7276
* generate code
7377
*
7478
* @param [] $data
7579
* @param Output $output
76-
* @return void
80+
* @return bool
7781
*/
7882
private function generate($data, $output)
7983
{
@@ -88,10 +92,12 @@ private function generate($data, $output)
8892
$output->writeln("<error>====> ".$response['message'].'</error>');
8993
} else {
9094
$output->writeln("<info>====> ".$response['message'].'</info>');
95+
return true;
9196
}
9297
} catch (\Exception $e) {
9398
$output->writeln("<error>====> ".$e->getMessage().'</error>');
9499
}
100+
return false;
95101
}
96102
}
97103

Model/Generate/Command.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Command implements GenerateInterface
2222
{
2323
protected $helper;
2424

25-
protected $xmlGeneratorFactory;
25+
protected $xmlGenerator;
2626

2727
/**
2828
* Constructor

Model/Generate/Controller.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,17 @@
2020
*/
2121
class Controller implements GenerateInterface
2222
{
23+
protected $helper;
24+
25+
/**
26+
* @var \Magento\Framework\Filesystem\Driver\File
27+
*/
2328
protected $fileDriver;
2429

25-
protected $helper;
30+
/**
31+
* @var Webkul\CodeGenerator\Model\XmlGenerator
32+
*/
33+
protected $xmlGenerator;
2634

2735
public function __construct(
2836
CodeHelper $helper,
@@ -106,7 +114,9 @@ public function createAdminController($dir, $data)
106114
$nameArray = explode("_", $nameSpace);
107115
$nameSpace = implode("\\", $nameArray);
108116
$actionPath = explode("/", $pathParts[1]);
117+
109118
$nameSpace = $nameSpace . "\\Controller\\Adminhtml\\" . implode("\\", $actionPath);
119+
110120
$controllerFile = $this->helper->getTemplatesFiles('templates/controller/controller_admin.php.dist');
111121
$controllerFile = str_replace('%module_name%', $data['module'], $controllerFile);
112122
$controllerFile = str_replace('%class_name%', $fileName, $controllerFile);

Model/Generate/Cron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Cron implements GenerateInterface
2222
{
2323
protected $helper;
2424

25-
protected $xmlGeneratorFactory;
25+
protected $xmlGenerator;
2626

2727
/**
2828
* Constructor

Model/Generate/Email.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Email implements GenerateInterface
2222
{
2323
protected $helper;
2424

25-
protected $xmlGeneratorFactory;
25+
protected $xmlGenerator;
2626

2727
/**
2828
* Constructor

Model/Generate/Logger.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Logger implements GenerateInterface
2222
{
2323
protected $helper;
2424

25-
protected $xmlGeneratorFactory;
25+
protected $xmlGenerator;
2626

2727
/**
2828
* Constructor

Model/Generate/NewModule.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,17 @@ class NewModule implements GenerateInterface
2929

3030
protected $helper;
3131

32+
/**
33+
* @var \Magento\Framework\Module\Status
34+
*/
35+
protected $moduleStatus;
36+
37+
/**
38+
* Construct
39+
*
40+
* @param Helper $helper
41+
* @param StatusFactory $moduleStatusFactory
42+
*/
3243
public function __construct(
3344
Helper $helper,
3445
StatusFactory $moduleStatusFactory

Model/Generate/Observer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class Observer implements GenerateInterface
1919
{
2020
protected $helper;
2121

22-
protected $xmlGeneratorFactory;
22+
protected $xmlGenerator;
2323
/**
2424
* Constructor
2525
*

Model/Generate/Payment.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,26 @@ class Payment implements GenerateInterface
2727

2828
protected $helper;
2929

30+
/**
31+
* @var \Magento\Framework\Filesystem\Driver\File
32+
*/
33+
protected $fileDriver;
34+
35+
/**
36+
* @var \Magento\Framework\Filesystem\Io\File
37+
*/
38+
protected $file;
39+
40+
/**
41+
* @var Json
42+
*/
43+
protected $jsonHelper;
44+
45+
/**
46+
* @var Webkul\CodeGenerator\Model\XmlGenerator
47+
*/
48+
protected $xmlGenerator;
49+
3050
/**
3151
* Default xml node attributes
3252
*

Model/Generate/Plugin.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@
2121
class Plugin implements GenerateInterface
2222
{
2323
protected $helper;
24-
25-
protected $xmlGeneratorFactory;
24+
25+
/**
26+
* @var Webkul\CodeGenerator\Model\XmlGenerator
27+
*/
28+
protected $xmlGenerator;
2629

2730
/**
2831
* Constructor

0 commit comments

Comments
 (0)