diff --git a/composer.json b/composer.json index d5f2b3f..c0ca4f3 100644 --- a/composer.json +++ b/composer.json @@ -26,7 +26,7 @@ "require": { "php": "^5.6|^7.0", "slim/slim": "^3.0", - "juliangut/doctrine-manager-builder": "^1.4" + "juliangut/doctrine-manager-builder": "^1.7" }, "require-dev": { "brainmaestro/composer-git-hooks": "^2.1", diff --git a/src/ManagerBuilder.php b/src/ManagerBuilder.php index 9d27b83..9b133e7 100644 --- a/src/ManagerBuilder.php +++ b/src/ManagerBuilder.php @@ -224,9 +224,9 @@ public function getCLIApplication() $application->setCatchExceptions(true); foreach ($this->builders as $builder) { - $helperSet = $builder->getConsoleHelperSet(); - foreach ($builder->getConsoleCommands() as $command) { + $helperSet = $command->getHelperSet(); + $application->add($command)->setHelperSet($helperSet); } } diff --git a/tests/Doctrine/ManagerBuilderTest.php b/tests/Doctrine/ManagerBuilderTest.php index e412544..16f49d7 100644 --- a/tests/Doctrine/ManagerBuilderTest.php +++ b/tests/Doctrine/ManagerBuilderTest.php @@ -24,7 +24,7 @@ class ManagerBuilderTest extends \PHPUnit_Framework_TestCase public function testSingleManagers() { $settings = [ - 'entity_manager' => [ + ManagerBuilder::DEFAULT_RELATIONAL_MANAGER_KEY => [ 'connection' => [ 'driver' => 'pdo_sqlite', 'memory' => true, @@ -36,7 +36,7 @@ public function testSingleManagers() ], ], ], - 'mongodb_document_manager' => [ + ManagerBuilder::DEFAULT_MONGODB_MANAGER_KEY => [ 'connection' => [ 'server' => 'mongodb://localhost:27017', 'options' => ['connect' => false], @@ -48,7 +48,7 @@ public function testSingleManagers() ], ], ], - 'couchdb_document_manager' => [ + ManagerBuilder::DEFAULT_COUCHDB_MANAGER_KEY => [ 'connection' => [ 'host' => 'localhost', 'dbname' => 'doctrine', @@ -85,7 +85,7 @@ public function testSingleManagers() public function testDuplicatedNamedManager() { $settings = [ - 'entity_manager' => [ + ManagerBuilder::DEFAULT_RELATIONAL_MANAGER_KEY => [ 'managerOne' => [ 'connection' => [ 'driver' => 'pdo_sqlite', @@ -99,7 +99,7 @@ public function testDuplicatedNamedManager() ], ], ], - 'mongodb_document_manager' => [ + ManagerBuilder::DEFAULT_MONGODB_MANAGER_KEY => [ 'managerOne' => [ 'connection' => [ 'server' => 'mongodb://localhost:27017', @@ -127,7 +127,7 @@ public function testNoRegisteredManager() self::assertCount(0, (new ManagerBuilder())->getManagers()); $settings = [ - 'entity_manager' => [ + ManagerBuilder::DEFAULT_RELATIONAL_MANAGER_KEY => [ 'connection' => [ 'driver' => 'pdo_sqlite', 'memory' => true, @@ -163,7 +163,7 @@ public function testUnnamedBuilder() public function testCLIApplication() { $settings = [ - 'entity_manager' => [ + ManagerBuilder::DEFAULT_RELATIONAL_MANAGER_KEY => [ 'managerOne' => [ 'connection' => [ 'driver' => 'pdo_sqlite', @@ -177,7 +177,7 @@ public function testCLIApplication() ], ], ], - 'mongodb_document_manager' => [ + ManagerBuilder::DEFAULT_MONGODB_MANAGER_KEY => [ 'managerTwo' => [ 'connection' => [ 'server' => 'mongodb://localhost:27017', @@ -197,7 +197,7 @@ public function testCLIApplication() $application = $managerBuilder->getCLIApplication(); - self::assertTrue($application->has('managerOne:dbal:run-sql')); - self::assertTrue($application->has('managerTwo:odm:query')); + self::assertTrue($application->has('dbal:managerOne:run-sql')); + self::assertTrue($application->has('odm:managerTwo:query')); } }