41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?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\Proxy $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();
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output){
|
|
$output->writeln(get_class($this->_productAction));
|
|
$this->_productAction->updateAttributes([1], ['name'=>'nice'], 1);
|
|
}
|
|
}
|