Skip to content

Commit

Permalink
Merge pull request #49 from facile-it/resolve-deprecations
Browse files Browse the repository at this point in the history
Register commands manually to avoid SF 3.4 deprecation
  • Loading branch information
Algatux authored Jan 3, 2018
2 parents eda5510 + beca503 commit d28fd22
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/DependencyInjection/MongoDbBundleExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Facile\MongoDbBundle\DependencyInjection;

use Facile\MongoDbBundle\Command\DropCollectionCommand;
use Facile\MongoDbBundle\Command\DropDatabaseCommand;
use Facile\MongoDbBundle\Command\LoadFixturesCommand;
use Facile\MongoDbBundle\DataCollector\MongoDbDataCollector;
use Facile\MongoDbBundle\Event\ConnectionEvent;
use Facile\MongoDbBundle\Event\Listener\DataCollectorListener;
Expand Down Expand Up @@ -42,6 +45,7 @@ public function load(array $configs, ContainerBuilder $container)
$this->defineClientRegistry($config['clients'], $container->getParameter("kernel.environment"));
$this->defineConnectionFactory();
$this->defineConnections($config['connections']);
$this->defineCommands();

if ($this->mustCollectData($config)) {
$this->defineLoggers();
Expand Down Expand Up @@ -199,4 +203,18 @@ private function defineExplainQueryService()

$this->containerBuilder->setDefinition('mongo.explain_query_service', $explainServiceDefinition);
}

private function defineCommands()
{
$commandClasses = [
DropCollectionCommand::class,
DropDatabaseCommand::class,
LoadFixturesCommand::class,
];

foreach ($commandClasses as $command) {
$this->containerBuilder->setDefinition($command, new Definition($command))
->addTag('console.command');
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Facile\MongoDbBundle\Tests\functional\DependencyInjection;
namespace Facile\MongoDbBundle\Tests\Functional\DependencyInjection;

use Facile\MongoDbBundle\Capsule\Database as LoggerDatabase;
use Facile\MongoDbBundle\DependencyInjection\MongoDbBundleExtension;
Expand Down

0 comments on commit d28fd22

Please sign in to comment.