Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit cc6da77e authored by Nicolas's avatar Nicolas
Browse files

Création de la classe de la commande

parent 0ed72969
No related branches found
No related tags found
No related merge requests found
<?php
namespace NicolasBejean\Importer\Console\TestCommand;
use \Symfony\Component\Console\Command\Command;
use \Symfony\Component\Console\Input\InputInterface;
use \Symfony\Component\Console\Output\OutputInterface;
use \NicolasBejean\Importer\Helper\Cron\ProductImages as Helper;
use \Exception;
/**
* Class CreateFeedFromConsole
*
* @category PHP
* @package NicolasBejean\Importer\Console\TestCommand
* @author Nicolas Béjean <nicolas@bejean.eu>
* @license https://github.com/nicolasbejean/importer/blob/master/licence.txt BSD Licence
* @link https://www.bejean.eu
*/
class ProductImages extends Command
{
/**
* Command description
*/
const DESCRIPTION = 'Import images to product';
/**
* @var Helper
*/
protected $helper;
/**
* ProductImages constructor.
*
* @param Helper $helper
* @param string|null $name
*/
public function __construct(
Helper $helper,
?string $name = null
) {
$this->helper = $helper;
parent::__construct($name);
}
/**
* Configuration de la commande
*/
protected function configure()
{
/* Options de la commande */
$options = [];
$this->setDefinition($options);
$this->setDescription(self::DESCRIPTION);
parent::configure();
}
/**
* @param InputInterface $input
* @param OutputInterface $output
* @return int|void|null
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
try {
$this->helper->execute();
$output->writeln('<info>Import success</info>');
} catch (Exception $e){
$output->writeln('<error>' . $e->getMessage() . '</error>');
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment