Skip to content

Commit af7cc1d

Browse files
authored
Merge pull request #642 from kefzce/3.6.x
Make commands lazily loaded
2 parents 7d69fb1 + f58d723 commit af7cc1d

11 files changed

+34
-12
lines changed

Command/ClearMetadataCacheDoctrineODMCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
*/
1515
class ClearMetadataCacheDoctrineODMCommand extends MetadataCommand
1616
{
17+
/** @var string */
18+
protected static $defaultName = 'doctrine:mongodb:cache:clear-metadata';
19+
1720
protected function configure()
1821
{
1922
parent::configure();
2023

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

Command/CreateSchemaDoctrineODMCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
*/
1616
class CreateSchemaDoctrineODMCommand extends CreateCommand
1717
{
18+
/** @var string */
19+
protected static $defaultName = 'doctrine:mongodb:schema:create';
20+
1821
protected function configure()
1922
{
2023
parent::configure();
2124

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

Command/DropSchemaDoctrineODMCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
*/
1616
class DropSchemaDoctrineODMCommand extends DropCommand
1717
{
18+
/** @var string */
19+
protected static $defaultName = 'doctrine:mongodb:schema:drop';
20+
1821
protected function configure()
1922
{
2023
parent::configure();
2124

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

Command/GenerateHydratorsDoctrineODMCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
*/
1515
class GenerateHydratorsDoctrineODMCommand extends GenerateHydratorsCommand
1616
{
17+
/** @var string */
18+
protected static $defaultName = 'doctrine:mongodb:generate:hydrators';
19+
1720
protected function configure()
1821
{
1922
parent::configure();
2023

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

Command/GenerateProxiesDoctrineODMCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
*/
1515
class GenerateProxiesDoctrineODMCommand extends GenerateProxiesCommand
1616
{
17+
/** @var string */
18+
protected static $defaultName = 'doctrine:mongodb:generate:proxies';
19+
1720
protected function configure()
1821
{
1922
parent::configure();
2023

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

Command/InfoDoctrineODMCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
*/
1919
class InfoDoctrineODMCommand extends DoctrineODMCommand
2020
{
21+
/** @var string */
22+
protected static $defaultName = 'doctrine:mongodb:mapping:info';
23+
2124
protected function configure()
2225
{
2326
$this
24-
->setName('doctrine:mongodb:mapping:info')
2527
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
2628
->setDescription('Show basic information about all mapped documents.')
2729
->setHelp(<<<EOT

Command/LoadDataFixturesDoctrineODMCommand.php

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

3336
public function __construct(?ManagerRegistry $registry = null, ?KernelInterface $kernel = null, ?SymfonyFixturesLoaderInterface $fixturesLoader = null)
@@ -48,7 +51,6 @@ public function isEnabled()
4851
protected function configure()
4952
{
5053
$this
51-
->setName('doctrine:mongodb:fixtures:load')
5254
->setDescription('Load data fixtures to your database.')
5355
->addOption('services', null, InputOption::VALUE_NONE, 'Use services as fixtures')
5456
->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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@
1414
*/
1515
class QueryDoctrineODMCommand extends QueryCommand
1616
{
17+
/** @var string */
18+
protected static $defaultName = 'doctrine:mongodb:query';
19+
1720
protected function configure()
1821
{
1922
parent::configure();
2023

2124
$this
22-
->setName('doctrine:mongodb:query')
2325
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.');
2426
}
2527

Command/ShardDoctrineODMCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
*/
1616
class ShardDoctrineODMCommand extends ShardCommand
1717
{
18+
/** @var string */
19+
protected static $defaultName = 'doctrine:mongodb:schema:shard';
20+
1821
protected function configure()
1922
{
2023
parent::configure();
2124

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

Command/TailCursorDoctrineODMCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ class TailCursorDoctrineODMCommand extends Command implements ContainerAwareInte
2626
{
2727
use ContainerAwareTrait;
2828

29+
/** @var string */
30+
protected static $defaultName = 'doctrine:mongodb:tail-cursor';
31+
2932
protected function configure()
3033
{
3134
$this
32-
->setName('doctrine:mongodb:tail-cursor')
3335
->setDescription('Tails a mongodb cursor and processes the documents that come through')
3436
->addArgument('document', InputArgument::REQUIRED, 'The document we are going to tail the cursor for.')
3537
->addArgument('finder', InputArgument::REQUIRED, 'The repository finder method which returns the cursor to tail.')

0 commit comments

Comments
 (0)