Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Merge details:

(1b8574d) Use stable version of digipolisgent/setting-bundle.
by Jelle Sebreghts on Thu Aug 2 15:01:46 2018

(bb83821) WEBDOM-395: Fixed form test.
by Matthijs Van Assche on Fri Jul 27 16:28:06 2018

(b6ac43c) WEBDOM-395: Added support for optional provisioners that won't run by default.
by Matthijs Van Assche on Fri Jul 27 16:16:34 2018

(d5a3700)  WEBDOM-398: Changed cache clear so failures don't throw an exception.
by Matthijs Van Assche on Fri Jul 27 15:02:54 2018

(dedc13a) Added getconnection method.
by Jelle Sebreghts on Fri Jul 13 10:15:30 2018

(8c14275) WEBDOM-379: Limit the allowed characters for an application name.
by Jelle Sebreghts on Fri Jul 6 16:53:30 2018

(a26a2f3) Fix for doctrine proxies.
by Jelle Sebreghts on Mon Jun 25 09:55:17 2018

(ab81a96) Added compiler passes, fixed ssh command cwd.
by Jelle Sebreghts on Mon Jun 25 09:47:24 2018

(7565e0e) Log cli output when clearing cache.
by Jelle Sebreghts on Fri Jun 22 14:57:40 2018

(08d1644) WEBDOM-390: Fix tests.
by Jelle Sebreghts on Fri Jun 22 11:53:27 2018

(511936d) WEBDOM-390: Use the command builder to execute commands.
by Jelle Sebreghts on Fri Jun 22 11:43:40 2018

(b65024b) WEBDOM-390: Fixed review remarks.
          - Added docblocks.
          - Removed unnecessary whiteline.
by Jelle Sebreghts on Wed Jun 20 14:26:00 2018

(eee0132) WEBDOM-390: Added docblock per @daften's request.
by Jelle Sebreghts on Wed Jun 20 14:24:34 2018

(32e5471) WEBDOM-390: Code style fix.
by Jelle Sebreghts on Wed Jun 20 09:49:58 2018

(c07eca1) WEBDOM-390: Improved error handling and logging.
by Jelle Sebreghts on Wed Jun 20 09:30:51 2018

(8254313) WEBDOM-390: Refactoring based on review comments.
          - Written better exception message when SSH login fails.
          - Used the execute method in the RemoteCli constructor.
          - Added docblock for CliInterface::execute().
          - Introduced finer grained exception handling in
          CacheClearProvider.
          - Introduced finer grained exception handling in
          CliFactoryProvider.
          - Added logging to CacheClearBuildProvisioner.
by Jelle Sebreghts on Tue Jun 19 16:57:22 2018

(7dc5245) WEBDOM-390: Fix tests.
by Jelle Sebreghts on Tue Jun 19 11:22:12 2018

(815e0f3) Fix PHPUnit version constraint.
by Jelle Sebreghts on Tue Jun 19 11:15:52 2018

(b4b56a0) WEBDOM-390: Code style fixes.
by Jelle Sebreghts on Tue Jun 19 11:11:35 2018

(02fa559) WEBDOM-390: Provide a basic framework to support clearing cache during provisioning.
by Jelle Sebreghts on Tue Jun 19 11:01:48 2018

(205c747) Fix service name
by Jelle Sebreghts on Fri Jun 15 16:31:19 2018

(22807f8) WEBDOM-392: Fix tests.
by Jelle Sebreghts on Fri Jun 15 10:43:53 2018

(3b33341) WEBDOM-392: Added getConfig method to SettingsImplementationTrait.
by Jelle Sebreghts on Fri Jun 15 09:55:56 2018

(4212882) WEBDOM-389: Fix codeclimate issues.
by Jelle Sebreghts on Tue Jun 12 11:59:17 2018

(061d6c5) WEBDOM-389: Added tests for new form type.
by Jelle Sebreghts on Tue Jun 12 11:55:34 2018

(5899ec7) WEBDOM-389: Allow selective provisioning.
by Jelle Sebreghts on Tue Jun 12 09:54:05 2018

(3a46d5e) Create a setter for the task on the provisioners.
by Jelle Sebreghts on Mon Jun 11 14:39:04 2018

(0408d8a) Fix services.yml.
by Jelle Sebreghts on Mon Jun 11 13:14:09 2018

(8301e46) WEBDOM-391: Fixed review remarks.
by Jelle Sebreghts on Mon Jun 11 12:34:58 2018

(bbd568d) WEBDOM-391: Move escapeLog method to the task logger service.
by Jelle Sebreghts on Mon Jun 11 12:25:13 2018

(a63d1ba) WEBDOM-391: Fix codeclimate issues.
by Jelle Sebreghts on Fri Jun 8 17:06:12 2018

(284b51a) WEBDOM-391: Handle exceptions thrown while running a task.
by Jelle Sebreghts on Fri Jun 8 17:02:57 2018

(3e11997) WEBDOM-391: [WIP] Fix autowiring.
by Jelle Sebreghts on Fri Jun 8 16:39:50 2018

(1a89bf8) WEBDOM-391: [WIP] Fix codeclimate issues.
by Jelle Sebreghts on Fri Jun 8 16:34:12 2018

(00ee7ec) WEBDOM-391: [WIP] Refactor Task related services.
by Jelle Sebreghts on Fri Jun 8 16:30:16 2018

(81a9d2c) WEBDOM-391: Added (some) test coverage for TaskService.
by Jelle Sebreghts on Fri Jun 8 10:41:27 2018

(99c6f64) WEBDOM-391: Add test for invalid task type.
by Jelle Sebreghts on Fri Jun 8 09:47:26 2018

(8fc0d36) WEBDOM-91: Use newly provided Task methods to check status.
by Jelle Sebreghts on Fri Jun 8 09:37:04 2018

(664f430) WEBDOM-391: Add and fix tests.
by Jelle Sebreghts on Thu Jun 7 16:50:17 2018

(e9044b1) WEBDOM-391: Convert build/destroy event listeners to tagged services.
by Jelle Sebreghts on Thu Jun 7 15:53:13 2018

(f5cedbf) Fix return types for ArrayCollection to Collection.
by Jelle Sebreghts on Wed Jun 6 13:19:39 2018

(0926b9d) Added support for dialog polyfill.
by Jelle Sebreghts on Wed Jun 6 10:24:25 2018

(52a2839) Refactor for readability.
by Jelle Sebreghts on Tue Jun 5 09:14:34 2018

(55233de) Code style fixes.
by Jelle Sebreghts on Mon Jun 4 19:52:50 2018

(d96afd2) Fix indentation.
by Jelle Sebreghts on Mon Jun 4 19:51:11 2018

(58d3634) Code style fixes.
by Jelle Sebreghts on Mon Jun 4 19:39:34 2018

(7ca8296) Fix return types for AbstractApplication.
by Jelle Sebreghts on Mon Jun 4 19:29:58 2018

(ecfa122) Fix code style issues detected by codeclimate.
by Jelle Sebreghts on Mon Jun 4 19:23:31 2018

(9779e4a) Refactoring based on codeclimate remarks.
by Jelle Sebreghts on Mon Jun 4 19:19:15 2018

(8a7c1d4) Added roave/better-reflection dependency.
by Jelle Sebreghts on Mon Jun 4 19:06:58 2018

(d5894cb) Added documentation.
by Jelle Sebreghts on Mon Jun 4 19:03:16 2018

(c6fd909) Fix tests.
by Jelle Sebreghts on Mon Jun 4 17:17:36 2018

(4ef4ce5) Added a template helper twig extension.
by Jelle Sebreghts on Mon Jun 4 15:59:22 2018

(39dec07) Refactor templates to be more generic.
by Jelle Sebreghts on Mon Jun 4 15:57:26 2018

(3232103) Changed the minimum length or an application name to 2.
by Matthijs Van Assche on Fri Jun 1 16:57:05 2018

(573e744) WEBDOM-380: Fixed missing indentation.
by Matthijs Van Assche on Fri May 25 16:45:03 2018

(13772bc) WEBDOM-380: Fixed missing indentation.
by Matthijs Van Assche on Fri May 25 16:34:23 2018

(aa54c66) WEBDOM-380: Convert tabs to spaces when indenting log text.
by Matthijs Van Assche on Fri May 25 16:23:03 2018

(6b00c0e) WEBDOM-380: Changed indentation to tabs.
by Matthijs Van Assche on Thu May 24 17:05:55 2018

(76de6c5) WEBDOM-380: Fixed unneeded newline in the beginning of the log.
by Matthijs Van Assche on Thu May 24 16:29:52 2018

(2149cc1) WEBDOM-380: Removed command tests.
by Matthijs Van Assche on Thu May 24 15:40:38 2018

(ca02c72) WEBDOM-380: Removed old tests.
by Matthijs Van Assche on Thu May 24 14:06:07 2018

(b65f0c4) WEBDOM-380: Added return types.
by Matthijs Van Assche on Thu May 24 14:05:47 2018

(7e207fb) WEBDOM-380: Fixed indentation on task result log.
by Matthijs Van Assche on Thu May 24 11:36:29 2018

(94910cb) WEBDOM-380: Fixed log headers not being added.
by Matthijs Van Assche on Thu May 24 11:30:05 2018

(b9739ce) WEBDOM-380: Fixed Code Climate issues.
by Matthijs Van Assche on Thu May 24 11:18:34 2018

(da063de) WEBDOM-380: Updated commands, services and eventlisteners.
by Matthijs Van Assche on Thu May 24 10:47:44 2018

(7433c9b) WEBDOM-357: Fixed code formatting.
by Matthijs Van Assche on Wed May 16 12:55:31 2018

(95ef685) WEBDOM-357: Fixed failing tests.
by Matthijs Van Assche on Wed May 16 12:51:55 2018

(e4cd0dc) WEBDOM-357: Updated template service to some more human readable code.
by Matthijs Van Assche on Wed May 16 11:25:38 2018

(b11396b) WEBDOM-357: Code style fixes.
by Jelle Sebreghts on Tue Apr 17 17:18:01 2018

(4698011) WEBDOM-357: Rename TokenFormType.php to TokenFormTypeTest.php
by Jelle Sebreghts on Tue Apr 17 16:45:57 2018

(93c9e24) WEBDOM-357: Fix tests.
by Jelle Sebreghts on Tue Apr 17 16:29:14 2018

(b5d92ba) WEBDOM-357: Fix repacement keys should look like function calls.
by Jelle Sebreghts on Tue Apr 17 15:41:51 2018

(c0e63ab) WEBDOM-357: Test fixes.
by Jelle Sebreghts on Tue Apr 17 15:37:59 2018

(54b1983) WEBDOM-357: Code style fixes.
by Jelle Sebreghts on Tue Apr 17 15:05:14 2018

(675b371) WEBDOM-357: Integrate custom tokens in the core bundle, so we don't have to support them in the separate bundles.
by Jelle Sebreghts on Tue Apr 17 15:02:23 2018

(6038750) WEBDOM-357: Code style fixes.
by Jelle Sebreghts on Tue Apr 17 12:25:37 2018

(d93001b) WEBDOM-357: Code style fixes.
by Jelle Sebreghts on Tue Apr 17 12:24:19 2018

(af84721) WEBDOM-357: Added token entity for generic replacements.
by Jelle Sebreghts on Tue Apr 17 12:20:15 2018

(05d1081) table rename
by Pieter MAssoels on Fri Apr 27 15:25:29 2018

(09893a3) WEBDOM-368: add priority to environment
by Pieter MAssoels on Wed Apr 25 16:14:30 2018

(9b659fc) Cancel status added
by Pieter MAssoels on Wed Apr 18 12:48:51 2018

(6f740b6) WEBDOM-343: sort on application type
by Pieter MAssoels on Wed Apr 18 10:46:25 2018

(c16b560) Fixed application type join.
by Matthijs Van Assche on Mon Apr 16 10:20:34 2018

(7bc952d) Fixed loading application environments.
by Matthijs Van Assche on Fri Apr 13 16:19:50 2018

(409bebf) Fix tests for canonical name of 14 characters.
by Jelle Sebreghts on Mon Apr 9 15:10:16 2018

(0045341) Canonical name should be 14 characters.
by Jelle Sebreghts on Mon Apr 9 12:54:56 2018

(bda0797) Fix replacements in templates with arguments.
by Jelle Sebreghts on Tue Mar 27 16:50:43 2018

(2ad05fa) WEBDOM-329: add templating for environment
by Pieter MAssoels on Thu Mar 22 14:18:02 2018

(4e5953d) WEBDOM-320: add gitref field to environment
by Pieter MAssoels on Fri Mar 16 09:28:04 2018

(881c825) Return type fix
by Pieter MAssoels on Fri Mar 16 10:09:35 2018

(aa80f23) WEBDOM-320: add gitref field to environment
by Pieter MAssoels on Fri Mar 16 09:28:04 2018

(6e9018d) WEBDOM-306: Mark build as failed when an error occurs
by Pieter MAssoels on Thu Mar 15 16:29:56 2018

(2ea3d2a) WEBDOM-314: default settings not showing up
by Pieter MAssoels on Tue Mar 13 10:49:14 2018

(5250bde) Fix test failures.
by Jelle Sebreghts on Tue Mar 13 09:30:35 2018

(be42a03) Added domain template.
by Jelle Sebreghts on Mon Mar 12 16:41:09 2018

(e2180dc) Added template values
          - Application: Git repo
          - Application environment: Worker IP
by Jelle Sebreghts on Mon Mar 12 16:32:41 2018

(704724b) Unit test fix
by Pieter MAssoels on Mon Mar 12 10:41:57 2018

(8f5910f) Removed recursive validation
by Pieter MAssoels on Fri Mar 9 14:38:57 2018

(a54fdfc) Extra info to log added when finished
by Pieter MAssoels on Thu Mar 1 16:20:48 2018

(35e2fa2) Template replacement added
by Pieter MAssoels on Wed Feb 21 15:26:41 2018

(fda7e9e) Update composer.json
by Pieter Digipolis on Wed Feb 21 15:21:59 2018

(0ffe94f) Update composer.json
by Pieter Digipolis on Wed Feb 21 15:19:56 2018
  • Loading branch information
Jelle-S committed Aug 2, 2018
2 parents ae9c0e0 + 1b8574d commit 15c000e
Show file tree
Hide file tree
Showing 75 changed files with 3,383 additions and 722 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ before_script:
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
- chmod +x ./cc-test-reporter
- ./cc-test-reporter before-build
- cat /dev/zero | ssh-keygen -q -N ""

script:
- vendor/bin/phpunit --disallow-test-output --strict-coverage -d error_reporting=-1 --coverage-clover=build/logs/clover.xml Tests

after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
17 changes: 17 additions & 0 deletions CLI/CliFactoryInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

namespace DigipolisGent\Domainator9k\CoreBundle\CLI;

interface CliFactoryInterface
{
/**
* Creates a CLI instance for a given object.
*
* @param mixed $object
* The object to get the CLI instance for.
*
* @return CliInterface
* The CLI for the given object.
*/
public function create($object): ?CliInterface;
}
28 changes: 28 additions & 0 deletions CLI/CliInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace DigipolisGent\Domainator9k\CoreBundle\CLI;

use DigipolisGent\CommandBuilder\CommandBuilder;

interface CliInterface
{
/**
* Executes a command.
*
* @param CommandBuilder $command
* The command to execute.
*
* @return bool
* True on success, false on failure.
*/
public function execute(CommandBuilder $command);

/**
* Get the output of the last execution.
*
* @return string
*/
public function getLastOutput();

public function getConnection();
}
58 changes: 58 additions & 0 deletions CLI/DefaultCliFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace DigipolisGent\Domainator9k\CoreBundle\CLI;

use DigipolisGent\Domainator9k\CoreBundle\CLI\CliFactoryInterface;
use DigipolisGent\Domainator9k\CoreBundle\CLI\CliInterface;
use DigipolisGent\Domainator9k\CoreBundle\Entity\AbstractApplication;
use DigipolisGent\Domainator9k\CoreBundle\Entity\ApplicationEnvironment;
use DigipolisGent\Domainator9k\CoreBundle\Entity\Environment;
use DigipolisGent\Domainator9k\CoreBundle\Entity\VirtualServer;
use phpseclib\Crypt\RSA;
use phpseclib\Net\SSH2;
use Webmozart\PathUtil\Path;

class DefaultCliFactory implements CliFactoryInterface
{
/**
* {@inheritdoc}
*/
public function create($object): ?CliInterface
{
if (!($object instanceof ApplicationEnvironment)) {
throw new \InvalidArgumentException(
static::class . ' only supports ' . ApplicationEnvironment::class
. ', ' . get_class($object) . ' given.'
);
}
$appEnv = $object;
/** @var Environment $environment */
$environment = $appEnv->getEnvironment();
/** @var AbstractApplication $application */
$application = $appEnv->getApplication();

/** @var VirtualServer[] $servers */
$servers = $environment->getVirtualServers();

foreach ($servers as $server) {
if (!$server->isTaskServer()) {
continue;
}

$user = $application->getNameCanonical();
$keyLocation = rtrim(Path::getHomeDirectory(), '/') . '/.ssh/id_rsa';

$host = $server->getHost();
$port = $server->getPort() ?: 22;
$ssh = new SSH2($host, $port);
$key = new RSA();
$key->loadKey(file_get_contents($keyLocation));

if (!$ssh->login($user, $key)) {
throw new \Exception(sprintf('SSH login for %s@%s:%s failed.', $user, $host, $port));
}
return new RemoteCli($ssh);
}
return null;
}
}
78 changes: 78 additions & 0 deletions CLI/RemoteCli.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

namespace DigipolisGent\Domainator9k\CoreBundle\CLI;

use DigipolisGent\CommandBuilder\CommandBuilder;
use phpseclib\Net\SSH2;

class RemoteCli implements CliInterface
{

/**
* @var SSH2
*/
protected $connection;

/**
* @var string
*/
protected $lastOutput;

/**
* @var string
*/
protected $cwd;

/**
* RemoteCli class constructor.
*
* @param SSH2 $connection
* The ssh connection to execute the commands on.
*
* @param string $cwd
* The current working directory to execute the commands from.
*/
public function __construct(SSH2 $connection, $cwd = null)
{
$this->connection = $connection;
$this->cwd = $cwd;
}

/**
* Executes a command.
*
* @param CommandBuilder $command
* The command to execute.
*
* @return bool
* True on success, false on failure.
*/
public function execute(CommandBuilder $command)
{
if ($this->cwd) {
$command = CommandBuilder::create('cd')
->addFlag('P')
->addArgument($this->cwd)
->onSuccess($command);
}
$this->lastOutput = 'Executing ' . $command . "\n";
$result = $this->connection->exec($command->getCommand());
$this->lastOutput .= $result ? $result : '';

return $this->connection->getExitStatus() === 0;
}

/**
* Get the output of the last execution.
*
* @return string
*/
public function getLastOutput()
{
return $this->lastOutput;
}

public function getConnection() {
return $this->connection;
}
}
19 changes: 19 additions & 0 deletions CacheClearer/CacheClearerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace DigipolisGent\Domainator9k\CoreBundle\CacheClearer;

use DigipolisGent\Domainator9k\CoreBundle\CLI\CliInterface;

interface CacheClearerInterface
{
/**
* @param mixed $object
* The object to clear the cache for.
* @param CliInterface $cli
* The cli to execute the cache clear command on.
*
* @return bool
* True on success, false on failure.
*/
public function clearCache($object, CliInterface $cli);
}
23 changes: 23 additions & 0 deletions Command/AbstractCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace DigipolisGent\Domainator9k\CoreBundle\Command;

use DigipolisGent\Domainator9k\CoreBundle\Service\TaskRunnerService;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;

abstract class AbstractCommand extends ContainerAwareCommand
{

/**
* Run the next task of the specified type.
*
* @param string $type
* The task type.
*/
protected function runNextTask(string $type)
{
$this->getContainer()
->get(TaskRunnerService::class)
->runNext($type);
}
}
25 changes: 10 additions & 15 deletions Command/BuildCommand.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
<?php


namespace DigipolisGent\Domainator9k\CoreBundle\Command;

use DigipolisGent\Domainator9k\CoreBundle\Entity\Build;
use DigipolisGent\Domainator9k\CoreBundle\Entity\Task;
use DigipolisGent\Domainator9k\CoreBundle\Event\BuildEvent;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Class BuildCommand
*
* @package DigipolisGent\Domainator9k\CoreBundle\Command
*/
class BuildCommand extends ContainerAwareCommand
class BuildCommand extends AbstractCommand
{

/**
* Configure the command properties.
*/
public function configure()
{
$this->setName('domainator:build');
}

/**
* Run the command.
*
* @param InputInterface $input
* The input.
* @param OutputInterface $output
* The output.
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$entityManager = $this->getContainer()->get('doctrine.orm.default_entity_manager');
$eventDispatcher = $this->getContainer()->get('event_dispatcher');
$task = $entityManager->getRepository(Task::class)->getNextTask(Task::TYPE_BUILD);

if (!$task) {
return;
}

$event = new BuildEvent($task);
$eventDispatcher->dispatch(BuildEvent::NAME, $event);
$this->runNextTask(Task::TYPE_BUILD);
}
}
25 changes: 10 additions & 15 deletions Command/DestroyCommand.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,37 @@
<?php


namespace DigipolisGent\Domainator9k\CoreBundle\Command;

use DigipolisGent\Domainator9k\CoreBundle\Entity\Build;
use DigipolisGent\Domainator9k\CoreBundle\Entity\Task;
use DigipolisGent\Domainator9k\CoreBundle\Event\DestroyEvent;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Class DestroyCommand
*
* @package DigipolisGent\Domainator9k\CoreBundle\Command
*/
class DestroyCommand extends ContainerAwareCommand
class DestroyCommand extends AbstractCommand
{

/**
* Configure the command properties.
*/
public function configure()
{
$this->setName('domainator:destroy');
}

/**
* Run the command.
*
* @param InputInterface $input
* The input.
* @param OutputInterface $output
* The output.
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$entityManager = $this->getContainer()->get('doctrine.orm.default_entity_manager');
$eventDispatcher = $this->getContainer()->get('event_dispatcher');
$task = $entityManager->getRepository(Task::class)->getNextTask(Task::TYPE_DESTROY);

if (!$task) {
return;
}

$event = new DestroyEvent($task);
$eventDispatcher->dispatch(DestroyEvent::NAME, $event);
$this->runNextTask(Task::TYPE_DESTROY);
}
}
31 changes: 31 additions & 0 deletions DependencyInjection/Compiler/CacheClearProviderCompilerPass.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace DigipolisGent\Domainator9k\CoreBundle\DependencyInjection\Compiler;

use DigipolisGent\Domainator9k\CoreBundle\Provider\CacheClearProvider;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Reference;

class CacheClearProviderCompilerPass implements CompilerPassInterface
{

/**
* @param ContainerBuilder $container
*/
public function process(ContainerBuilder $container)
{
if (!$container->has(CacheClearProvider::class)) {
return;
}
$definition = $container->getDefinition(CacheClearProvider::class);

$taggedServices = $container->findTaggedServiceIds('domainator.cacheclearer');

foreach ($taggedServices as $id => $tags) {
foreach ($tags as $attributes) {
$definition->addMethodCall('registerCacheClearer', array(new Reference($id), $attributes['for']));
}
}
}
}
Loading

0 comments on commit 15c000e

Please sign in to comment.