Skip to content

Commit ed583f0

Browse files
committed
Bindings Feature
- Modified compiler pass to include bindings - Register Parts Pass return empty array if type is not set - changed dynamic binding service name
1 parent 6efe0fd commit ed583f0

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

DependencyInjection/Compiler/RegisterPartsPass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function process(ContainerBuilder $container)
1818

1919
$tags = array(
2020
'old_sound_rabbit_mq.base_amqp',
21+
'old_sound_rabbit_mq.binding',
2122
'old_sound_rabbit_mq.producer',
2223
'old_sound_rabbit_mq.consumer',
2324
'old_sound_rabbit_mq.multi_consumer',

DependencyInjection/OldSoundRabbitMqExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ protected function loadBindings()
118118
// in the context of a binding, I don't thing logged channels are needed?
119119
$this->injectLoggedChannel($definition, $key, $binding['connection']);
120120
}
121-
$this->container->setDefinition(sprintf('old_sound_rabbit_mq.%s_binding', $key), $definition);
121+
$this->container->setDefinition(sprintf('old_sound_rabbit_mq.binding.%s', $key), $definition);
122122
}
123123
}
124124

RabbitMq/AmqpPartsHolder.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ public function addPart($type, BaseAmqp $part)
1818

1919
public function getParts($type)
2020
{
21-
return $this->parts[(string) $type];
21+
$type = (string) $type;
22+
return isset($this->parts[$type]) ? $this->parts[$type] : array();
2223
}
2324
}

Tests/DependencyInjection/OldSoundRabbitMqExtensionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public function testFooBinding()
129129
);
130130
ksort($binding);
131131
$key = md5(json_encode($binding));
132-
$name = sprintf('old_sound_rabbit_mq.%s_binding', $key);
132+
$name = sprintf('old_sound_rabbit_mq.binding.%s', $key);
133133
$this->assertTrue($container->has($name));
134134
$definition = $container->getDefinition($name);
135135
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default');
@@ -151,7 +151,7 @@ public function testMooBinding()
151151
);
152152
ksort($binding);
153153
$key = md5(json_encode($binding));
154-
$name = sprintf('old_sound_rabbit_mq.%s_binding', $key);
154+
$name = sprintf('old_sound_rabbit_mq.binding.%s', $key);
155155
$this->assertTrue($container->has($name));
156156
$definition = $container->getDefinition($name);
157157
$this->assertEquals((string) $definition->getArgument(0), 'old_sound_rabbit_mq.connection.default2');

0 commit comments

Comments
 (0)