Skip to content

Commit c75965b

Browse files
committed
Merge pull request #237 from ch3ric/fix-dependencies
Review Symfony components dependencies
2 parents 0e57b98 + fcb6caf commit c75965b

File tree

6 files changed

+63
-42
lines changed

6 files changed

+63
-42
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@ php:
66
- 5.5
77
- 5.6
88
- hhvm
9-
9+
1010
matrix:
1111
allow_failures:
1212
- php: hhvm
1313

1414
env:
15-
- SYMFONY_VERSION="2.1.*"
16-
- SYMFONY_VERSION="2.2.*"
1715
- SYMFONY_VERSION="2.3.*"
16+
- SYMFONY_VERSION="2.4.*"
17+
- SYMFONY_VERSION="2.5.*"
18+
- SYMFONY_VERSION="2.6.*"
1819

1920
before_script:
2021
- composer self-update

Command/BaseRabbitMqCommand.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,30 @@
22

33
namespace OldSound\RabbitMqBundle\Command;
44

5-
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand as Command;
5+
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
6+
use Symfony\Component\DependencyInjection\ContainerInterface;
7+
use Symfony\Component\Console\Command\Command;
68

7-
abstract class BaseRabbitMqCommand extends Command
9+
abstract class BaseRabbitMqCommand extends Command implements ContainerAwareInterface
810
{
11+
/**
12+
* @var ContainerInterface
13+
*/
14+
protected $container;
15+
16+
/**
17+
* {@inheritDoc}
18+
*/
19+
public function setContainer(ContainerInterface $container = null)
20+
{
21+
$this->container = $container;
22+
}
23+
24+
/**
25+
* @return ContainerInterface
26+
*/
27+
public function getContainer()
28+
{
29+
return $this->container;
30+
}
931
}

DependencyInjection/OldSoundRabbitMqExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException;
66
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
7-
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
7+
use Symfony\Component\DependencyInjection\Extension\Extension;
88
use Symfony\Component\DependencyInjection\ContainerBuilder;
99
use Symfony\Component\DependencyInjection\Definition;
1010
use Symfony\Component\DependencyInjection\Reference;

README.md

Lines changed: 18 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ This bundle was presented at [Symfony Live Paris 2011](http://www.symfony-live.c
2525

2626
## Installation ##
2727

28-
### For Symfony >= 2.1.* ###
28+
### For Symfony Framework >= 2.3 ###
2929

3030
Require the bundle in your composer.json file:
3131

@@ -58,40 +58,31 @@ $ composer update oldsound/rabbitmq-bundle
5858
5959
Enjoy !
6060
61-
### For Symfony 2.0.* ###
61+
### For a console application that uses Symfony Console, Dependency Injection and Config components ###
6262
63-
The following instructions have been tested on a project created with the [Symfony2 Standard 2.0.6](http://symfony.com/download?v=Symfony_Standard_2.0.6.tgz)
63+
If you have a console application used to run RabbitMQ consumers, you do not need Symfony HttpKernel and FrameworkBundle.
64+
From version 1.6, you can use the Dependency Injection component to load this bundle configuration and services, and then use the consumer command.
6465
65-
Put the RabbitMqBundle and the [php-amqplib](http://github.com/videlalvaro/php-amqplib) library into the deps file:
66-
67-
```ini
68-
[RabbitMqBundle]
69-
git=http://github.com/videlalvaro/RabbitMqBundle.git
70-
target=/bundles/OldSound/RabbitMqBundle
66+
Require the bundle in your composer.json file:
7167
72-
[php-amqplib]
73-
git=http://github.com/videlalvaro/php-amqplib.git
74-
target=videlalvaro/php-amqplib
68+
````
69+
{
70+
"require": {
71+
"oldsound/rabbitmq-bundle": "~1.6",
72+
}
73+
}
7574
```
7675
77-
Register the bundle and library namespaces in the `app/autoload.php` file:
76+
Register the extension and the compiler pass:
7877
7978
```php
80-
$loader->registerNamespaces(array(
81-
'OldSound' => __DIR__.'/../vendor/bundles',
82-
'PhpAmqpLib' => __DIR__.'/../vendor/videlalvaro/php-amqplib',
83-
));
84-
```
79+
use OldSound\RabbitMqBundle\DependencyInjection\OldSoundRabbitMqExtension;
80+
use OldSound\RabbitMqBundle\DependencyInjection\Compiler\RegisterPartsPass;
8581
86-
Add the RabbitMqBundle to your application's kernel:
82+
// ...
8783
88-
```php
89-
public function registerBundles()
90-
{
91-
$bundles = array(
92-
new OldSound\RabbitMqBundle\OldSoundRabbitMqBundle(),
93-
);
94-
}
84+
$containerBuilder->registerExtension(new OldSoundRabbitMqExtension());
85+
$containerBuilder->addCompilerPass(new RegisterPartsPass());
9586
```
9687

9788
### Warning - BC Breaking Changes ###
@@ -520,7 +511,7 @@ Be aware that all queues are under the same exchange, it's up to you to set the
520511
The `queues_provider` is a optional service that dynamically provides queues.
521512
It must implement `QueuesProviderInterface`.
522513

523-
Be aware that queues providers are responsible for the proper calls to `setDequeuer` and that callbacks are callables
514+
Be aware that queues providers are responsible for the proper calls to `setDequeuer` and that callbacks are callables
524515
(not `ConsumerInterface`). In case service providing queues implements `DequeuerAwareInterface`, a call to
525516
`setDequeuer` is added to the definition of the service with a `DequeuerInterface` currently being a `MultipleConsumer`.
526517

Tests/Command/BaseCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ abstract class BaseCommandTest extends \PHPUnit_Framework_TestCase
1111

1212
protected function setUp()
1313
{
14-
$this->application = $this->getMockBuilder('Symfony\\Bundle\\FrameworkBundle\\Console\\Application')
14+
$this->application = $this->getMockBuilder('Symfony\\Component\\Console\\Application')
1515
->disableOriginalConstructor()
1616
->getMock();
1717
$this->definition = $this->getMockBuilder('Symfony\\Component\\Console\\Input\\InputDefinition')
@@ -26,4 +26,4 @@ protected function setUp()
2626
->method('getArguments')
2727
->will($this->returnValue(array()));
2828
}
29-
}
29+
}

composer.json

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
11
{
22
"name": "oldsound/rabbitmq-bundle",
33
"description": "Integrates php-amqplib with Symfony2 and RabbitMq",
4-
"keywords": ["symfony2", "rabbitmq", "message", "queue"],
4+
"keywords": ["symfony2", "rabbitmq", "message", "queue", "amqp"],
55
"type": "symfony-bundle",
66
"license": "MIT",
77
"authors": [{
88
"name" : "Alvaro Videla"
99
}],
1010
"require": {
11-
"php" : ">=5.3.0",
12-
"symfony/framework-bundle" : "~2.1",
13-
"symfony/yaml": "~2.0",
14-
"videlalvaro/php-amqplib" : "~2.4.0"
11+
"php" : ">=5.3.0",
12+
"symfony/dependency-injection" : "~2.3",
13+
"symfony/event-dispatcher" : "~2.3",
14+
"symfony/config" : "~2.3",
15+
"symfony/yaml" : "~2.3",
16+
"symfony/console" : "~2.3",
17+
"videlalvaro/php-amqplib" : "~2.4.0"
18+
},
19+
"suggest": {
20+
"symfony/framework-bundle" : "To use this lib as a full Symfony Bundle and to use the profiler data collector"
1521
},
1622
"require-dev": {
17-
"symfony/console": "~2.0",
18-
"symfony/serializer": "~2.6"
23+
"symfony/serializer": "~2.3",
24+
"symfony/debug" : "~2.3",
25+
"phpunit/phpunit" : ">=3.7.0"
1926
},
2027
"extra": {
2128
"branch-alias": {

0 commit comments

Comments
 (0)