Skip to content

Commit

Permalink
Merge pull request #62 from youwe-petervanderwal/fix/visualization-en…
Browse files Browse the repository at this point in the history
…v-pimcore-6

fix: force environment in workflow visualization console command
  • Loading branch information
dpfaffenbauer authored Jul 26, 2021
2 parents fe46105 + 6d11954 commit dc12083
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
22 changes: 17 additions & 5 deletions src/WorkflowGui/Controller/WorkflowController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
use Pimcore\Model\User;
use Pimcore\Tool\Console;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Yaml\Yaml;
use Youwe\Pimcore\WorkflowGui\Repository\WorkflowRepositoryInterface;
use Youwe\Pimcore\WorkflowGui\Resolver\ConfigFileResolver;
Expand All @@ -41,14 +42,24 @@ class WorkflowController extends AdminController
*/
protected $configResolver;

/**
* @var KernelInterface
*/
protected $kernel;

/**
* @param WorkflowRepositoryInterface $repository
* @param ConfigFileResolver $configFileResolver
* @param KernelInterface $kernel
*/
public function __construct(WorkflowRepositoryInterface $repository, ConfigFileResolver $configFileResolver)
{
public function __construct(
WorkflowRepositoryInterface $repository,
ConfigFileResolver $configFileResolver,
KernelInterface $kernel
) {
$this->repository = $repository;
$this->configResolver = $configFileResolver;
$this->kernel = $kernel;
}

/**
Expand Down Expand Up @@ -367,7 +378,8 @@ private function getVisualization($workflow, $format) {
throw new \Exception('Please install graphviz to visualize workflows');
}

$cliCommand = '"'.Console::getPhpCli().'" "'.PIMCORE_PROJECT_ROOT . '/bin/console" pimcore:workflow:dump '.$workflow.' | "'.$dotExecutable.'" -T'.$format;
$environment = $this->kernel->getEnvironment();
$cliCommand = '"'.Console::getPhpCli().'" "'.PIMCORE_PROJECT_ROOT . '/bin/console" --env="'.$environment.'" pimcore:workflow:dump '.$workflow.' | "'.$dotExecutable.'" -T'.$format;
return Console::exec($cliCommand);
}
}
1 change: 1 addition & 0 deletions src/WorkflowGui/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ services:
arguments:
- '@Youwe\Pimcore\WorkflowGui\Repository\WorkflowRepository'
- '@Youwe\Pimcore\WorkflowGui\Resolver\ConfigFileResolver'
- '@kernel'
tags:
- { name: controller.service_arguments }

0 comments on commit dc12083

Please sign in to comment.