Skip to content

Add Symfony4 support #269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ matrix:
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true
- php: 7.0
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true
- php: 7.1
env: SYMFONY_VERSION=v4.0.0-BETA4 UNIT_TESTS=true
- php: 7.1
services: docker
env: SYMFONY_VERSION=2.8.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
Expand All @@ -31,6 +33,9 @@ matrix:
- php: 7.1
services: docker
env: SYMFONY_VERSION=3.3.* FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
- php: 7.1
services: docker
env: SYMFONY_VERSION=v4.0.0-BETA4 FUNCTIONAL_TESTS=true PREPARE_CONTAINER=true
- php: 7.1
services: docker
env: SYMFONY_VERSION=3.3.* RDKAFKA_TESTS=true PREPARE_CONTAINER=true
Expand Down
15 changes: 8 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "enqueue/enqueue-dev",
"type": "project",
"minimum-stability": "stable",
"minimum-stability": "beta",
"homepage": "https://github.com/php-enqueue/enqueue-dev",
"require": {
"php": ">=5.6",
Expand Down Expand Up @@ -34,13 +34,14 @@
"phpunit/phpunit": "^5",
"doctrine/doctrine-bundle": "~1.2",
"predis/predis": "^1.1",
"symfony/monolog-bundle": "^2.8|^3",
"symfony/browser-kit": "^2.8|^3",
"symfony/expression-language": "^2.8|^3",
"symfony/event-dispatcher": "^2.8|^3",
"symfony/console": "^2.8|^3",
"symfony/monolog-bundle": "^2.8|^3|^4",
"symfony/browser-kit": "^2.8|^3|^4",
"symfony/expression-language": "^2.8|^3|^4",
"symfony/event-dispatcher": "^2.8|^3|^4",
"symfony/console": "^2.8|^3|^4",
"friendsofphp/php-cs-fixer": "^2",
"empi89/php-amqp-stubs": "*@dev"
"empi89/php-amqp-stubs": "*@dev",
"php-http/client-common": "^1.7@dev"
},
"autoload": {
"files": [
Expand Down
34 changes: 17 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@ services:
- AMQP_DSN=amqp://guest:guest@rabbitmq:5672/mqdev
- AMQPS_DSN=amqps://guest:guest@rabbitmqssl:5671
- DOCTINE_DSN=mysql://root:rootpass@mysql/mqdev
- SYMFONY__RABBITMQ__HOST=rabbitmq
- SYMFONY__RABBITMQ__USER=guest
- SYMFONY__RABBITMQ__PASSWORD=guest
- SYMFONY__RABBITMQ__VHOST=mqdev
- SYMFONY__RABBITMQ__AMQP__PORT=5672
- SYMFONY__RABBITMQ__STOMP__PORT=61613
- SYMFONY__DB__DRIVER=pdo_mysql
- SYMFONY__DB__HOST=mysql
- SYMFONY__DB__PORT=3306
- SYMFONY__DB__NAME=mqdev
- SYMFONY__DB__USER=root
- SYMFONY__DB__PASSWORD=rootpass
- SYMFONY__REDIS__HOST=redis
- SYMFONY__REDIS__PORT=6379
- AWS__SQS__KEY=$ENQUEUE_AWS__SQS__KEY
- AWS__SQS__SECRET=$ENQUEUE_AWS__SQS__SECRET
- AWS__SQS__REGION=$ENQUEUE_AWS__SQS__REGION
- RABBITMQ_HOST=rabbitmq
- RABBITMQ_USER=guest
- RABBITMQ_PASSWORD=guest
- RABBITMQ_VHOST=mqdev
- RABBITMQ_AMQP__PORT=5672
- RABBITMQ_STOMP_PORT=61613
- DOCTRINE_DRIVER=pdo_mysql
- DOCTRINE_HOST=mysql
- DOCTRINE_PORT=3306
- DOCTRINE_DB_NAME=mqdev
- DOCTRINE_USER=root
- DOCTRINE_PASSWORD=rootpass
- REDIS_HOST=redis
- REDIS_PORT=6379
- AWS_SQS_KEY=$ENQUEUE_AWS__SQS__KEY
- AWS_SQS_SECRET=$ENQUEUE_AWS__SQS__SECRET
- AWS_SQS_REGION=$ENQUEUE_AWS__SQS__REGION
- BEANSTALKD_HOST=beanstalkd
- BEANSTALKD_PORT=11300
- BEANSTALKD_DSN=beanstalk://beanstalkd:11300
Expand Down
4 changes: 2 additions & 2 deletions pkg/amqp-bunny/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"enqueue/enqueue": "^0.8@dev",
"enqueue/null": "^0.8@dev",
"queue-interop/queue-spec": "^0.5.3@dev",
"symfony/dependency-injection": "^2.8|^3",
"symfony/config": "^2.8|^3"
"symfony/dependency-injection": "^2.8|^3|^4",
"symfony/config": "^2.8|^3|^4"
},
"autoload": {
"psr-4": { "Enqueue\\AmqpBunny\\": "" },
Expand Down
4 changes: 2 additions & 2 deletions pkg/amqp-ext/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"enqueue/null": "^0.8@dev",
"queue-interop/queue-spec": "^0.5.3@dev",
"empi89/php-amqp-stubs": "*@dev",
"symfony/dependency-injection": "^2.8|^3",
"symfony/config": "^2.8|^3"
"symfony/dependency-injection": "^2.8|^3|^4",
"symfony/config": "^2.8|^3|^4"
},
"autoload": {
"psr-4": { "Enqueue\\AmqpExt\\": "" },
Expand Down
10 changes: 5 additions & 5 deletions pkg/amqp-ext/examples/consume.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
use Enqueue\AmqpExt\AmqpConnectionFactory;

$config = [
'host' => getenv('SYMFONY__RABBITMQ__HOST'),
'port' => getenv('SYMFONY__RABBITMQ__AMQP__PORT'),
'user' => getenv('SYMFONY__RABBITMQ__USER'),
'pass' => getenv('SYMFONY__RABBITMQ__PASSWORD'),
'vhost' => getenv('SYMFONY__RABBITMQ__VHOST'),
'host' => getenv('RABBITMQ_HOST'),
'port' => getenv('RABBITMQ_AMQP__PORT'),
'user' => getenv('RABBITMQ_USER'),
'pass' => getenv('RABBITMQ_PASSWORD'),
'vhost' => getenv('RABBITMQ_VHOST'),
];

$factory = new AmqpConnectionFactory($config);
Expand Down
10 changes: 5 additions & 5 deletions pkg/amqp-ext/examples/produce.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
use Interop\Amqp\Impl\AmqpBind;

$config = [
'host' => getenv('SYMFONY__RABBITMQ__HOST'),
'port' => getenv('SYMFONY__RABBITMQ__AMQP__PORT'),
'user' => getenv('SYMFONY__RABBITMQ__USER'),
'pass' => getenv('SYMFONY__RABBITMQ__PASSWORD'),
'vhost' => getenv('SYMFONY__RABBITMQ__VHOST'),
'host' => getenv('RABBITMQ_HOST'),
'port' => getenv('RABBITMQ_AMQP__PORT'),
'user' => getenv('RABBITMQ_USER'),
'pass' => getenv('RABBITMQ_PASSWORD'),
'vhost' => getenv('RABBITMQ_VHOST'),
];

$factory = new AmqpConnectionFactory($config);
Expand Down
4 changes: 2 additions & 2 deletions pkg/amqp-lib/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"enqueue/enqueue": "^0.8@dev",
"enqueue/null": "^0.8@dev",
"queue-interop/queue-spec": "^0.5.3@dev",
"symfony/dependency-injection": "^2.8|^3",
"symfony/config": "^2.8|^3"
"symfony/dependency-injection": "^2.8|^3|^4",
"symfony/config": "^2.8|^3|^4"
},
"autoload": {
"psr-4": { "Enqueue\\AmqpLib\\": "" },
Expand Down
10 changes: 5 additions & 5 deletions pkg/amqp-lib/examples/consume.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
use Enqueue\AmqpLib\AmqpConnectionFactory;

$config = [
'host' => getenv('SYMFONY__RABBITMQ__HOST'),
'port' => getenv('SYMFONY__RABBITMQ__AMQP__PORT'),
'user' => getenv('SYMFONY__RABBITMQ__USER'),
'pass' => getenv('SYMFONY__RABBITMQ__PASSWORD'),
'vhost' => getenv('SYMFONY__RABBITMQ__VHOST'),
'host' => getenv('RABBITMQ_HOST'),
'port' => getenv('RABBITMQ_AMQP__PORT'),
'user' => getenv('RABBITMQ_USER'),
'pass' => getenv('RABBITMQ_PASSWORD'),
'vhost' => getenv('RABBITMQ_VHOST'),
'receive_method' => 'basic_consume',
];

Expand Down
10 changes: 5 additions & 5 deletions pkg/amqp-lib/examples/produce.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
use Interop\Amqp\Impl\AmqpBind;

$config = [
'host' => getenv('SYMFONY__RABBITMQ__HOST'),
'port' => getenv('SYMFONY__RABBITMQ__AMQP__PORT'),
'user' => getenv('SYMFONY__RABBITMQ__USER'),
'pass' => getenv('SYMFONY__RABBITMQ__PASSWORD'),
'vhost' => getenv('SYMFONY__RABBITMQ__VHOST'),
'host' => getenv('RABBITMQ_HOST'),
'port' => getenv('RABBITMQ_AMQP__PORT'),
'user' => getenv('RABBITMQ_USER'),
'pass' => getenv('RABBITMQ_PASSWORD'),
'vhost' => getenv('RABBITMQ_VHOST'),
];

$factory = new AmqpConnectionFactory($config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

use Enqueue\AsyncEventDispatcher\OldAsyncEventDispatcher;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Alias;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Extension\Extension;
Expand All @@ -20,7 +21,7 @@ public function load(array $configs, ContainerBuilder $container)
{
$config = $this->processConfiguration(new Configuration(), $configs);

$container->setAlias('enqueue.events.context', $config['context_service']);
$container->setAlias('enqueue.events.context', new Alias($config['context_service'], true));

$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
Expand Down
4 changes: 4 additions & 0 deletions pkg/async-event-dispatcher/Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,20 @@ services:

enqueue.events.async_listener:
class: 'Enqueue\AsyncEventDispatcher\AsyncListener'
public: public
arguments: ['@enqueue.events.context', '@enqueue.events.registry', '%enqueue_events_queue%']


enqueue.events.event_dispatcher:
class: 'Enqueue\AsyncEventDispatcher\AsyncEventDispatcher'
public: public
arguments:
- '@event_dispatcher'
- '@enqueue.events.async_listener'

enqueue.events.async_processor:
class: 'Enqueue\AsyncEventDispatcher\AsyncProcessor'
public: public
arguments:
- '@enqueue.events.registry'
- '@enqueue.events.event_dispatcher'
Expand All @@ -39,6 +42,7 @@ services:

enqueue.events.php_serializer_event_transofrmer:
class: 'Enqueue\AsyncEventDispatcher\PhpSerializerEventTransformer'
public: public
arguments:
- '@enqueue.events.context'
tags:
Expand Down
12 changes: 6 additions & 6 deletions pkg/async-event-dispatcher/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
"require": {
"php": ">=5.6",
"enqueue/enqueue": "^0.8@dev",
"symfony/event-dispatcher": "^2.8|^3"
"symfony/event-dispatcher": "^2.8|^3|^4"
},
"require-dev": {
"phpunit/phpunit": "~5.5",
"symfony/dependency-injection": "^2.8|^3",
"symfony/config": "^2.8|^3",
"symfony/http-kernel": "^2.8|^3",
"symfony/filesystem": "^2.8|^3",
"symfony/dependency-injection": "^2.8|^3|^4",
"symfony/config": "^2.8|^3|^4",
"symfony/http-kernel": "^2.8|^3|^4",
"symfony/filesystem": "^2.8|^3|^4",
"enqueue/null": "^0.8@dev",
"enqueue/fs": "^0.8@dev",
"enqueue/test": "^0.8@dev"
},
"suggest": {
"symfony/dependency-injection": "^2.8|^3 If you'd like to use async event dispatcher container extension."
"symfony/dependency-injection": "^2.8|^3|^4 If you'd like to use async event dispatcher container extension."
},
"autoload": {
"psr-4": { "Enqueue\\AsyncEventDispatcher\\": "" },
Expand Down
2 changes: 2 additions & 0 deletions pkg/dbal/Symfony/DbalTransportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function createContext(ContainerBuilder $container, array $config)
$factoryId = sprintf('enqueue.transport.%s.connection_factory', $this->getName());

$context = new Definition(DbalContext::class);
$context->setPublic(true);
$context->setFactory([new Reference($factoryId), 'createContext']);

$contextId = sprintf('enqueue.transport.%s.context', $this->getName());
Expand All @@ -114,6 +115,7 @@ public function createContext(ContainerBuilder $container, array $config)
public function createDriver(ContainerBuilder $container, array $config)
{
$driver = new Definition(DbalDriver::class);
$driver->setPublic(true);
$driver->setArguments([
new Reference(sprintf('enqueue.transport.%s.context', $this->getName())),
new Reference('enqueue.client.config'),
Expand Down
4 changes: 2 additions & 2 deletions pkg/dbal/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"enqueue/enqueue": "^0.8@dev",
"enqueue/null": "^0.8@dev",
"queue-interop/queue-spec": "^0.5.3@dev",
"symfony/dependency-injection": "^2.8|^3",
"symfony/config": "^2.8|^3"
"symfony/dependency-injection": "^2.8|^3|^4",
"symfony/config": "^2.8|^3|^4"
},
"autoload": {
"psr-4": { "Enqueue\\Dbal\\": "" },
Expand Down
12 changes: 6 additions & 6 deletions pkg/dbal/examples/consume.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

$config = [
'connection' => [
'dbname' => getenv('SYMFONY__DB__NAME'),
'user' => getenv('SYMFONY__DB__USER'),
'password' => getenv('SYMFONY__DB__PASSWORD'),
'host' => getenv('SYMFONY__DB__HOST'),
'port' => getenv('SYMFONY__DB__PORT'),
'driver' => getenv('SYMFONY__DB__DRIVER'),
'dbname' => getenv('DOCTRINE_DB_NAME'),
'user' => getenv('DOCTRINE_USER'),
'password' => getenv('DOCTRINE_PASSWORD'),
'host' => getenv('DOCTRINE_HOST'),
'port' => getenv('DOCTRINE_PORT'),
'driver' => getenv('DOCTRINE_DRIVER'),
],
];

Expand Down
12 changes: 6 additions & 6 deletions pkg/dbal/examples/produce.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

$config = [
'connection' => [
'dbname' => getenv('SYMFONY__DB__NAME'),
'user' => getenv('SYMFONY__DB__USER'),
'password' => getenv('SYMFONY__DB__PASSWORD'),
'host' => getenv('SYMFONY__DB__HOST'),
'port' => getenv('SYMFONY__DB__PORT'),
'driver' => getenv('SYMFONY__DB__DRIVER'),
'dbname' => getenv('DOCTRINE_DB_NAME'),
'user' => getenv('DOCTRINE_USER'),
'password' => getenv('DOCTRINE_PASSWORD'),
'host' => getenv('DOCTRINE_HOST'),
'port' => getenv('DOCTRINE_PORT'),
'driver' => getenv('DOCTRINE_DRIVER'),
],
];

Expand Down
8 changes: 8 additions & 0 deletions pkg/enqueue-bundle/Profiler/MessageQueueCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,12 @@ public function getName()
{
return 'enqueue.message_queue';
}

/**
* {@inheritdoc}
*/
public function reset()
{
$this->data = [];
}
}
Loading