|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / app / Firebear / ImportExport / Console / Command / |
Filename | /home/dev2.destoffenstraat.com/app/Firebear/ImportExport/Console/Command/ExportJobEnableCommand.php |
Size | 1.89 kb |
Permission | rwxr-xr-x |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 07-Nov-2022 06:44 |
Last accessed | 22-Aug-2025 03:27 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* @copyright: Copyright © 2017 Firebear Studio. All rights reserved.
* @author : Firebear Studio <fbeardev@gmail.com>
*/
namespace Firebear\ImportExport\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
/**
* Command prints list of available currencies
*/
class ExportJobEnableCommand extends ExportJobAbstractCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->setName('export:job:enable')
->setDescription('Enable Firebear Export Jobs')
->setDefinition(
[
new InputArgument(
self::JOB_ARGUMENT_NAME,
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
'Space-separated list of job ids or omit to enable all jobs.'
)
]
);
parent::configure();
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$requestedIds = $input->getArgument(self::JOB_ARGUMENT_NAME);
$requestedIds = array_filter(array_map('trim', $requestedIds), 'strlen');
$jobCollection = $this->job->getCollection();
if ($requestedIds) {
$jobCollection->addFieldToFilter('entity_id', ['in' => $requestedIds]);
}
if ($jobCollection->getSize()) {
foreach ($jobCollection as $job) {
$job->setIsActive(1);
$this->repository->save($job);
$this->addLogComment('Job #' . $job->getEntityId() . ' was enabled.', $output, 'info');
}
} else {
$this->addLogComment('No jobs found', $output, 'error');
}
}
}
/**
* @copyright: Copyright © 2017 Firebear Studio. All rights reserved.
* @author : Firebear Studio <fbeardev@gmail.com>
*/
namespace Firebear\ImportExport\Console\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
/**
* Command prints list of available currencies
*/
class ExportJobEnableCommand extends ExportJobAbstractCommand
{
/**
* {@inheritdoc}
*/
protected function configure()
{
$this->setName('export:job:enable')
->setDescription('Enable Firebear Export Jobs')
->setDefinition(
[
new InputArgument(
self::JOB_ARGUMENT_NAME,
InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
'Space-separated list of job ids or omit to enable all jobs.'
)
]
);
parent::configure();
}
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$requestedIds = $input->getArgument(self::JOB_ARGUMENT_NAME);
$requestedIds = array_filter(array_map('trim', $requestedIds), 'strlen');
$jobCollection = $this->job->getCollection();
if ($requestedIds) {
$jobCollection->addFieldToFilter('entity_id', ['in' => $requestedIds]);
}
if ($jobCollection->getSize()) {
foreach ($jobCollection as $job) {
$job->setIsActive(1);
$this->repository->save($job);
$this->addLogComment('Job #' . $job->getEntityId() . ' was enabled.', $output, 'info');
}
} else {
$this->addLogComment('No jobs found', $output, 'error');
}
}
}