Skip to content

Commit

Permalink
Allow support for per-siteaccess parameters; update docs for 1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
gggeek committed Apr 26, 2018
1 parent 771ad90 commit 1a2e39f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Command/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected function getWorkflowDirectory($bundleName)
}

$bundle = $this->getApplication()->getKernel()->getBundle($bundleName);
$workflowDirectory = $bundle->getPath() . '/' . $this->getContainer()->getParameter('ez_workflowengine_bundle.workflow_directory');
$workflowDirectory = $bundle->getPath() . '/' . $this->getContainer()->get('ez_migration_bundle.helper.config.resolver')->getParameter('ez_workflowengine_bundle.workflow_directory');

return $workflowDirectory;
}
Expand Down
5 changes: 3 additions & 2 deletions Core/Loader/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@

use Kaliop\eZMigrationBundle\Core\Loader\Filesystem as BaseLoader;
use Kaliop\eZWorkflowEngineBundle\API\Value\WorkflowDefinition;
use Kaliop\eZMigrationBundle\API\ConfigResolverInterface;
use Symfony\Component\HttpKernel\KernelInterface;

class Filesystem extends BaseLoader
{
public function __construct(KernelInterface $kernel, $versionDirectory = 'Workflows')
public function __construct(KernelInterface $kernel, $versionDirectoryParameter = 'Workflows', ConfigResolverInterface $configResolver = null)
{
$this->versionDirectory = $versionDirectory;
$this->versionDirectory = $configResolver ? $configResolver->getParameter($versionDirectoryParameter) : $versionDirectoryParameter;
$this->kernel = $kernel;
}

Expand Down
12 changes: 12 additions & 0 deletions Core/StorageHandler/Database/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Kaliop\eZMigrationBundle\Core\StorageHandler\Database\Migration as StorageMigration;
use Kaliop\eZMigrationBundle\API\Value\Migration;
use Kaliop\eZMigrationBundle\API\Value\MigrationDefinition;
use Kaliop\eZMigrationBundle\API\ConfigResolverInterface;
use Kaliop\eZWorkflowEngineBundle\API\Value\Workflow as APIWorkflow;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Doctrine\DBAL\Schema\Schema;
Expand All @@ -16,6 +17,17 @@ class Workflow extends StorageMigration
{
protected $fieldList = 'migration, md5, path, execution_date, status, execution_error, signal_name';

/**
* @param DatabaseHandler $dbHandler
* @param string $tableNameParameter
* @param ConfigResolverInterface $configResolver
* @throws \Exception
*/
public function __construct(DatabaseHandler $dbHandler, $tableNameParameter = 'kaliop_workflows', ConfigResolverInterface $configResolver = null)
{
parent::__construct($dbHandler, $tableNameParameter, $configResolver);
}

/**
* @param MigrationDefinition $migrationDefinition
* @return APIWorkflow
Expand Down
11 changes: 9 additions & 2 deletions Resources/config/services.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
parameters:
# NB: supports per-siteaccess configuration as an override of global configuration. For that, just define parameters:
# ez_workflowengine_bundle.<siteaccess_group>.table_name
ez_workflowengine_bundle.table_name: 'kaliop_workflows'
# NB: supports per-siteaccess configuration as an override of global configuration. For that, just define parameters:
# ez_workflowengine_bundle.<siteaccess_group>.workflow_directory
ez_workflowengine_bundle.workflow_directory: 'WorkflowDefinitions'

# Set to false to disable completely the debug log of executed migration steps (also echoed to cli in verbose mode)
ez_workflowengine_bundle.enable_debug_output: true
# Abort execution when workflows triggered in cascade reach this limit
Expand Down Expand Up @@ -59,7 +64,8 @@ services:
class: '%ez_workflowengine_bundle.loader.filesystem.class%'
arguments:
- '@kernel'
- '%ez_workflowengine_bundle.workflow_directory%'
- 'ez_workflowengine_bundle.workflow_directory'
- '@ez_migration_bundle.helper.config.resolver'

### parsers

Expand Down Expand Up @@ -92,7 +98,8 @@ services:
class: '%ez_workflowengine_bundle.storage_handler.database.class%'
arguments:
- '@ezpublish.connection'
- '%ez_workflowengine_bundle.table_name%'
- 'ez_workflowengine_bundle.table_name'
- '@ez_migration_bundle.helper.config.resolver'

### slots

Expand Down
19 changes: 19 additions & 0 deletions WHATSNEW.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Version 1.1
===========

* New: it is now possible to define the following parameters using siteaccess-aware configuration:

`ez_workflowengine_bundle.table_name`, `ez_workflowengine_bundle.workflow_directory`

This is useful when you need to execute different sets of workflows for each site in a multi-site installation.

* Changed: requires Kaliop eZ-Migration Bundle version 4.7 or later.

NB: recent versions of the eZ-Migration Bundle have introduced support for multiple features useful for
workflows. Be sure to check out its WHATSNEW file.


Version 1.0
===========

Initial release
7 changes: 1 addition & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@
"name": "Gaetano Giunta",
"email": "[email protected]",
"role": "Lead Developer"
},
{
"name": "Daniel Clements",
"email": "[email protected]",
"role": "Developer"
}
],
"require": {
"php": ">=5.6",
"kaliop/ezmigrationbundle": ">=4.0.0-rc4@dev"
"kaliop/ezmigrationbundle": "^4.7"
},
"require-dev": {
"phpunit/phpunit": "~4.0",
Expand Down
4 changes: 2 additions & 2 deletions ezpublish_legacy/ezworkflowenginebridge/extension.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<software>
<metadata>
<name>Kaliop eZ Workflow Engine Bridge</name>
<version>0.1</version>
<version>1.1</version>
<copyright>Copyright (C) 2017-2018 Kaliop UK Ltd</copyright>
<license>GNU General Public License v2.0</license>
</metadata>
</software>
</software>

0 comments on commit 1a2e39f

Please sign in to comment.