-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #202 from akeneo/release/100.4.6
Release/100.4.6
- Loading branch information
Showing
14 changed files
with
556 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
|
||
namespace Akeneo\Connector\Controller\Adminhtml\Import; | ||
|
||
use Magento\Backend\App\Action; | ||
use Magento\Backend\App\Action\Context; | ||
use Magento\Framework\App\RequestInterface; | ||
use Magento\Framework\Controller\Result\Json; | ||
use Akeneo\Connector\Api\ImportRepositoryInterface; | ||
use Akeneo\Connector\Converter\ArrayToJsonResponseConverter; | ||
use Akeneo\Connector\Helper\Output as OutputHelper; | ||
use Akeneo\Connector\Job\Import; | ||
use Akeneo\Connector\Job\Product as JobProduct; | ||
|
||
/** | ||
* Class RunProduct | ||
* | ||
* @package Akeneo\Connector\Controller\Adminhtml\Import | ||
* @author Agence Dn'D <[email protected]> | ||
* @copyright 2020 Agence Dn'D | ||
* @license https://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @link https://www.dnd.fr/ | ||
*/ | ||
class RunProduct extends Action | ||
{ | ||
/** | ||
* This variable contains an OutputHelper | ||
* | ||
* @var OutputHelper $outputHelper | ||
*/ | ||
protected $outputHelper; | ||
/** | ||
* This variable contains an ImportRepositoryInterface | ||
* | ||
* @var ImportRepositoryInterface $importRepository | ||
*/ | ||
protected $importRepository; | ||
/** | ||
* This variable contains a ArrayToJsonResponseConverter | ||
* | ||
* @var ArrayToJsonResponseConverter $arrayToJsonResponseConverter | ||
*/ | ||
protected $arrayToJsonResponseConverter; | ||
/** | ||
* This variable contains a JobProduct | ||
* | ||
* @var JobProduct $jobProduct | ||
*/ | ||
protected $jobProduct; | ||
|
||
/** | ||
* Run constructor. | ||
* | ||
* @param Context $context | ||
* @param ImportRepositoryInterface $importRepository | ||
* @param OutputHelper $output | ||
* @param ArrayToJsonResponseConverter $arrayToJsonResponseConverter | ||
* @param JobProduct $jobProduct | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
ImportRepositoryInterface $importRepository, | ||
OutputHelper $output, | ||
ArrayToJsonResponseConverter $arrayToJsonResponseConverter, | ||
JobProduct $jobProduct | ||
) { | ||
parent::__construct($context); | ||
|
||
$this->outputHelper = $output; | ||
$this->importRepository = $importRepository; | ||
$this->arrayToJsonResponseConverter = $arrayToJsonResponseConverter; | ||
$this->jobProduct = $jobProduct; | ||
} | ||
|
||
/** | ||
* Action triggered by request | ||
* | ||
* @return Json | ||
*/ | ||
public function execute() | ||
{ | ||
/** @var string[] $families */ | ||
$families = $this->jobProduct->getFamiliesToImport(); | ||
|
||
if (!count($families)) { | ||
$families['message'] = __('No family to import'); | ||
} | ||
|
||
return $this->arrayToJsonResponseConverter->convert($families); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function _isAllowed() | ||
{ | ||
return $this->_authorization->isAllowed('Akeneo_Connector::import'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.