initial
This commit is contained in:
commit
65a7ac1fab
42
Command/TestCommand.php
Normal file
42
Command/TestCommand.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
namespace Test\Test\Command;
|
||||
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class TestCommand extends Command{
|
||||
|
||||
private $_state;
|
||||
private $_objectManager;
|
||||
private $_productRepository;
|
||||
private $_productAction;
|
||||
|
||||
public function __construct(
|
||||
\Magento\Catalog\Model\ProductRepository $productRepository,
|
||||
\Magento\Framework\ObjectManagerInterface $objectManager,
|
||||
\Magento\Framework\App\State $state,
|
||||
\Magento\Catalog\Model\ResourceModel\Product\Action $productAction
|
||||
) {
|
||||
$this->_state=$state;
|
||||
$this->_objectManager=$objectManager;
|
||||
$this->_productRepository=$productRepository;
|
||||
$this->_productAction=$productAction;
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function configure(){
|
||||
$this->setName('test:test')
|
||||
->setDescription('Test')
|
||||
;
|
||||
parent::configure();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output){
|
||||
$output->writeln(get_class($this->_productAction));
|
||||
}
|
||||
}
|
11
etc/di.xml
Normal file
11
etc/di.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0"?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
|
||||
<type name="Magento\Framework\Console\CommandList">
|
||||
<arguments>
|
||||
<argument name="commands" xsi:type="array">
|
||||
<item name="test_test_test_command" xsi:type="object">Test\Test\Command\TestCommand</item>
|
||||
</argument>
|
||||
</arguments>
|
||||
</type>
|
||||
</config>
|
||||
|
5
etc/module.xml
Normal file
5
etc/module.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0"?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
|
||||
<module name="Test_Test" setup_version="0.0.0"/>
|
||||
</config>
|
||||
|
7
registration.php
Normal file
7
registration.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
\Magento\Framework\Component\ComponentRegistrar::register(
|
||||
\Magento\Framework\Component\ComponentRegistrar::MODULE,
|
||||
'Test_Test',
|
||||
__DIR__
|
||||
);
|
Loading…
Reference in New Issue
Block a user