Skip to content

Commit

Permalink
BAP-13894: Cron scheduled workflow transitions are not working
Browse files Browse the repository at this point in the history
- updated HandleProcessTriggerCommand now implements CronCommandInterface
- updated cron command
  • Loading branch information
vtsykun committed Feb 17, 2017
1 parent 7886c15 commit fdb1ce0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
12 changes: 12 additions & 0 deletions src/Oro/Bundle/CronBundle/Command/CronCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
if ($cronExpression->isDue()) {
/** @var CronCommandInterface $command */
$command = $this->getApplication()->get($schedule->getCommand());

if (!$command instanceof CronCommandInterface) {
$output->writeln(
sprintf(
'<error>The cron command %s must be implements CronCommandInterface</error>',
$schedule->getCommand()
)
);

continue;
}

if ($command->isActive()) {
$output->writeln(
'Scheduling run for command ' . $schedule->getCommand(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\ORM\EntityManager;

use Oro\Bundle\WorkflowBundle\Model\ProcessData;
use Oro\Bundle\WorkflowBundle\Model\ProcessHandler;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;

use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class HandleProcessTriggerCommand extends ContainerAwareCommand
use Oro\Bundle\CronBundle\Command\CronCommandInterface;
use Oro\Bundle\WorkflowBundle\Model\ProcessData;
use Oro\Bundle\WorkflowBundle\Model\ProcessHandler;

class HandleProcessTriggerCommand extends ContainerAwareCommand implements CronCommandInterface
{
const NAME = 'oro:process:handle-trigger';

Expand Down Expand Up @@ -129,4 +130,12 @@ public function isActive()
{
return true;
}

/**
* {@inheritdoc}
*/
public function getDefaultDefinition()
{
return '*/5 * * * *';
}
}

0 comments on commit fdb1ce0

Please sign in to comment.