forked from ezsystems/ezplatform-ee-demo
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EZEE-1900: Installer fails if auto_increment_increment != 1 (ezsystem…
…s#51) * EZEE-1900: Installer fails if auto_increment_increment != 1 https://jira.ez.no/browse/EZEE-1900
- Loading branch information
Showing
6 changed files
with
58 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/AppBundle/DependencyInjection/Compiler/MigrationParameterPass.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (C) eZ Systems AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
namespace AppBundle\DependencyInjection\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\Yaml\Yaml; | ||
|
||
class MigrationParameterPass implements CompilerPassInterface | ||
{ | ||
/* | ||
* Loads migration result file to parameters if present. | ||
*/ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
$referenceFile = $container->getParameter('kernel.project_dir') . $container->getParameter('app.migration_reference_file'); | ||
$migrationValuesMapping = $container->getParameter('app.migration.values_mapping'); | ||
|
||
if (!is_readable($referenceFile)) { | ||
return; | ||
} | ||
|
||
$references = Yaml::parseFile($referenceFile); | ||
|
||
foreach ($migrationValuesMapping as $parameterName => $migrationParameterName) { | ||
if (!array_key_exists($migrationParameterName, $references)) { | ||
continue; | ||
} | ||
|
||
$container->setParameter($parameterName, $references[$migrationParameterName]); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters