-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from kronostof/feat/update-php7.4
- Loading branch information
Showing
7 changed files
with
123 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace M6Web\Bundle\AmqpBundle\Amqp; | ||
|
||
class Locator | ||
{ | ||
/** @var Consumer[] */ | ||
protected $consumers = []; | ||
|
||
/** @var Producer[] */ | ||
protected $producers = []; | ||
|
||
public function getConsumer(string $id): Consumer | ||
{ | ||
return $this->consumers[$id]; | ||
} | ||
|
||
/** @param Consumer[] $consumers */ | ||
public function setConsumers(array $consumers) | ||
{ | ||
$this->consumers = $consumers; | ||
} | ||
|
||
public function getProducer(string $id): Producer | ||
{ | ||
return $this->producers[$id]; | ||
} | ||
|
||
/** @param Producer[] $producers */ | ||
public function setProducers(array $producers) | ||
{ | ||
$this->producers = $producers; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
src/AmqpBundle/DependencyInjection/CompilerPass/M6webAmqpLocatorPass.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,32 @@ | ||
<?php | ||
|
||
namespace M6Web\Bundle\AmqpBundle\DependencyInjection\CompilerPass; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Reference; | ||
|
||
class M6webAmqpLocatorPass implements CompilerPassInterface | ||
{ | ||
public function process(ContainerBuilder $container) | ||
{ | ||
if (!$container->has('m6_web_amqp.locator')) { | ||
return; | ||
} | ||
$locator = $container->getDefinition('m6_web_amqp.locator'); | ||
$consumers = []; | ||
$producers = []; | ||
|
||
$taggedServices = $container->findTaggedServiceIds('m6_web_amqp.consumers'); | ||
foreach ($taggedServices as $id => $taggedService) { | ||
$consumers[$id] = new Reference($id); | ||
} | ||
$locator->addMethodCall('setConsumers', [$consumers]); | ||
|
||
$taggedServices = $container->findTaggedServiceIds('m6_web_amqp.producers'); | ||
foreach ($taggedServices as $id => $taggedService) { | ||
$producers[$id] = new Reference($id); | ||
} | ||
$locator->addMethodCall('setProducers', [$producers]); | ||
} | ||
} |
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
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