Skip to content

Commit 8bd843d

Browse files
committed
Make commands lazily loaded
1 parent 7d69fb1 commit 8bd843d

11 files changed

+23
-12
lines changed

Command/ClearMetadataCacheDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
*/
1515
class ClearMetadataCacheDoctrineODMCommand extends MetadataCommand
1616
{
17+
protected static $defaultName = 'doctrine:mongodb:cache:clear-metadata';
18+
1719
protected function configure()
1820
{
1921
parent::configure();
2022

2123
$this
22-
->setName('doctrine:mongodb:cache:clear-metadata')
2324
->setDescription('Clear all metadata cache for a document manager.')
2425
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
2526
->setHelp(<<<EOT

Command/CreateSchemaDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
*/
1616
class CreateSchemaDoctrineODMCommand extends CreateCommand
1717
{
18+
protected static $defaultName = 'doctrine:mongodb:schema:create';
19+
1820
protected function configure()
1921
{
2022
parent::configure();
2123

2224
$this
23-
->setName('doctrine:mongodb:schema:create')
2425
->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command.')
2526
->setHelp(<<<EOT
2627
The <info>doctrine:mongodb:schema:create</info> command creates the default document manager's schema:

Command/DropSchemaDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
*/
1616
class DropSchemaDoctrineODMCommand extends DropCommand
1717
{
18+
protected static $defaultName = 'doctrine:mongodb:schema:drop';
19+
1820
protected function configure()
1921
{
2022
parent::configure();
2123

2224
$this
23-
->setName('doctrine:mongodb:schema:drop')
2425
->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command.')
2526
->setHelp(<<<EOT
2627
The <info>doctrine:mongodb:schema:drop</info> command drops the default document manager's schema:

Command/GenerateHydratorsDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
*/
1515
class GenerateHydratorsDoctrineODMCommand extends GenerateHydratorsCommand
1616
{
17+
protected static $defaultName = 'doctrine:mongodb:generate:hydrators';
18+
1719
protected function configure()
1820
{
1921
parent::configure();
2022

2123
$this
22-
->setName('doctrine:mongodb:generate:hydrators')
2324
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
2425
->setHelp(<<<EOT
2526
The <info>doctrine:mongodb:generate:hydrators</info> command generates hydrator classes for your documents:

Command/GenerateProxiesDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
*/
1515
class GenerateProxiesDoctrineODMCommand extends GenerateProxiesCommand
1616
{
17+
protected static $defaultName = 'doctrine:mongodb:generate:proxies';
18+
1719
protected function configure()
1820
{
1921
parent::configure();
2022

2123
$this
22-
->setName('doctrine:mongodb:generate:proxies')
2324
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
2425
->setHelp(<<<EOT
2526
The <info>doctrine:mongodb:generate:proxies</info> command generates proxy classes for your default document manager:

Command/InfoDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,11 @@
1818
*/
1919
class InfoDoctrineODMCommand extends DoctrineODMCommand
2020
{
21+
protected static $defaultName = 'doctrine:mongodb:mapping:info';
22+
2123
protected function configure()
2224
{
2325
$this
24-
->setName('doctrine:mongodb:mapping:info')
2526
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
2627
->setDescription('Show basic information about all mapped documents.')
2728
->setHelp(<<<EOT

Command/LoadDataFixturesDoctrineODMCommand.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727
*/
2828
class LoadDataFixturesDoctrineODMCommand extends DoctrineODMCommand
2929
{
30-
/** @var SymfonyFixturesLoaderInterface */
30+
protected static $defaultName = 'doctrine:mongodb:fixtures:load';
31+
32+
/** @var SymfonyFixturesLoaderInterface */
3133
private $fixturesLoader;
3234

3335
public function __construct(?ManagerRegistry $registry = null, ?KernelInterface $kernel = null, ?SymfonyFixturesLoaderInterface $fixturesLoader = null)
@@ -48,7 +50,6 @@ public function isEnabled()
4850
protected function configure()
4951
{
5052
$this
51-
->setName('doctrine:mongodb:fixtures:load')
5253
->setDescription('Load data fixtures to your database.')
5354
->addOption('services', null, InputOption::VALUE_NONE, 'Use services as fixtures')
5455
->addOption('group', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'Only load fixtures that belong to this group (use with --services)')

Command/QueryDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
*/
1515
class QueryDoctrineODMCommand extends QueryCommand
1616
{
17+
protected static $defaultName = 'doctrine:mongodb:query';
18+
1719
protected function configure()
1820
{
1921
parent::configure();
2022

2123
$this
22-
->setName('doctrine:mongodb:query')
2324
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.');
2425
}
2526

Command/ShardDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
*/
1616
class ShardDoctrineODMCommand extends ShardCommand
1717
{
18+
protected static $defaultName = 'doctrine:mongodb:schema:shard';
19+
1820
protected function configure()
1921
{
2022
parent::configure();
2123

2224
$this
23-
->setName('doctrine:mongodb:schema:shard')
2425
->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command.')
2526
->setHelp(<<<EOT
2627
The <info>doctrine:mongodb:schema:shard</info> command shards collections based on their metadata:

Command/TailCursorDoctrineODMCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@
2424
*/
2525
class TailCursorDoctrineODMCommand extends Command implements ContainerAwareInterface
2626
{
27+
protected static $defaultName = 'doctrine:mongodb:tail-cursor';
28+
2729
use ContainerAwareTrait;
2830

2931
protected function configure()
3032
{
3133
$this
32-
->setName('doctrine:mongodb:tail-cursor')
3334
->setDescription('Tails a mongodb cursor and processes the documents that come through')
3435
->addArgument('document', InputArgument::REQUIRED, 'The document we are going to tail the cursor for.')
3536
->addArgument('finder', InputArgument::REQUIRED, 'The repository finder method which returns the cursor to tail.')

0 commit comments

Comments
 (0)