This commit is contained in:
James 2020-12-26 15:38:01 +00:00
parent 65a7ac1fab
commit c1ce7c9d6f

View File

@ -6,6 +6,9 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\OutputInterface;
class TestCommand extends Command{ class TestCommand extends Command{
/**
* {@inheritdoc}
*/
private $_state; private $_state;
private $_objectManager; private $_objectManager;
@ -15,13 +18,14 @@ class TestCommand extends Command{
public function __construct( public function __construct(
\Magento\Catalog\Model\ProductRepository $productRepository, \Magento\Catalog\Model\ProductRepository $productRepository,
\Magento\Framework\ObjectManagerInterface $objectManager, \Magento\Framework\ObjectManagerInterface $objectManager,
\Magento\Framework\App\State $state, \Magento\Framework\App\State $state//,
\Magento\Catalog\Model\ResourceModel\Product\Action $productAction //\Magento\Catalog\Model\ResourceModel\Product\Action $productAction
) { ) {
$this->_state=$state; $this->_state=$state;
$this->_objectManager=$objectManager; $this->_objectManager=$objectManager;
$this->_productRepository=$productRepository; $this->_productRepository=$productRepository;
$this->_productAction=$productAction; //$this->_productAction=$productAction;
//$this->_productAction=$this->_objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\Action');
parent::__construct(); parent::__construct();
} }
@ -37,6 +41,7 @@ class TestCommand extends Command{
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function execute(InputInterface $input, OutputInterface $output){ protected function execute(InputInterface $input, OutputInterface $output){
$this->_productAction=$this->_objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\Action');
$output->writeln(get_class($this->_productAction)); $output->writeln(get_class($this->_productAction));
} }
} }