Skip to content

Commit

Permalink
Make commands lazily loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
kefzce committed Sep 16, 2020
1 parent 7d69fb1 commit f58d723
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 12 deletions.
4 changes: 3 additions & 1 deletion Command/ClearMetadataCacheDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
*/
class ClearMetadataCacheDoctrineODMCommand extends MetadataCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:cache:clear-metadata';

protected function configure()
{
parent::configure();

$this
->setName('doctrine:mongodb:cache:clear-metadata')
->setDescription('Clear all metadata cache for a document manager.')
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
->setHelp(<<<EOT
Expand Down
4 changes: 3 additions & 1 deletion Command/CreateSchemaDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
*/
class CreateSchemaDoctrineODMCommand extends CreateCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:schema:create';

protected function configure()
{
parent::configure();

$this
->setName('doctrine:mongodb:schema:create')
->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command.')
->setHelp(<<<EOT
The <info>doctrine:mongodb:schema:create</info> command creates the default document manager's schema:
Expand Down
4 changes: 3 additions & 1 deletion Command/DropSchemaDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
*/
class DropSchemaDoctrineODMCommand extends DropCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:schema:drop';

protected function configure()
{
parent::configure();

$this
->setName('doctrine:mongodb:schema:drop')
->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command.')
->setHelp(<<<EOT
The <info>doctrine:mongodb:schema:drop</info> command drops the default document manager's schema:
Expand Down
4 changes: 3 additions & 1 deletion Command/GenerateHydratorsDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
*/
class GenerateHydratorsDoctrineODMCommand extends GenerateHydratorsCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:generate:hydrators';

protected function configure()
{
parent::configure();

$this
->setName('doctrine:mongodb:generate:hydrators')
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
->setHelp(<<<EOT
The <info>doctrine:mongodb:generate:hydrators</info> command generates hydrator classes for your documents:
Expand Down
4 changes: 3 additions & 1 deletion Command/GenerateProxiesDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
*/
class GenerateProxiesDoctrineODMCommand extends GenerateProxiesCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:generate:proxies';

protected function configure()
{
parent::configure();

$this
->setName('doctrine:mongodb:generate:proxies')
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
->setHelp(<<<EOT
The <info>doctrine:mongodb:generate:proxies</info> command generates proxy classes for your default document manager:
Expand Down
4 changes: 3 additions & 1 deletion Command/InfoDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
*/
class InfoDoctrineODMCommand extends DoctrineODMCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:mapping:info';

protected function configure()
{
$this
->setName('doctrine:mongodb:mapping:info')
->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.')
->setDescription('Show basic information about all mapped documents.')
->setHelp(<<<EOT
Expand Down
6 changes: 4 additions & 2 deletions Command/LoadDataFixturesDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@
*/
class LoadDataFixturesDoctrineODMCommand extends DoctrineODMCommand
{
/** @var SymfonyFixturesLoaderInterface */
/** @var string */
protected static $defaultName = 'doctrine:mongodb:fixtures:load';

/** @var SymfonyFixturesLoaderInterface */
private $fixturesLoader;

public function __construct(?ManagerRegistry $registry = null, ?KernelInterface $kernel = null, ?SymfonyFixturesLoaderInterface $fixturesLoader = null)
Expand All @@ -48,7 +51,6 @@ public function isEnabled()
protected function configure()
{
$this
->setName('doctrine:mongodb:fixtures:load')
->setDescription('Load data fixtures to your database.')
->addOption('services', null, InputOption::VALUE_NONE, 'Use services as fixtures')
->addOption('group', null, InputOption::VALUE_IS_ARRAY|InputOption::VALUE_REQUIRED, 'Only load fixtures that belong to this group (use with --services)')
Expand Down
4 changes: 3 additions & 1 deletion Command/QueryDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
*/
class QueryDoctrineODMCommand extends QueryCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:query';

protected function configure()
{
parent::configure();

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

Expand Down
4 changes: 3 additions & 1 deletion Command/ShardDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
*/
class ShardDoctrineODMCommand extends ShardCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:schema:shard';

protected function configure()
{
parent::configure();

$this
->setName('doctrine:mongodb:schema:shard')
->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command.')
->setHelp(<<<EOT
The <info>doctrine:mongodb:schema:shard</info> command shards collections based on their metadata:
Expand Down
4 changes: 3 additions & 1 deletion Command/TailCursorDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ class TailCursorDoctrineODMCommand extends Command implements ContainerAwareInte
{
use ContainerAwareTrait;

/** @var string */
protected static $defaultName = 'doctrine:mongodb:tail-cursor';

protected function configure()
{
$this
->setName('doctrine:mongodb:tail-cursor')
->setDescription('Tails a mongodb cursor and processes the documents that come through')
->addArgument('document', InputArgument::REQUIRED, 'The document we are going to tail the cursor for.')
->addArgument('finder', InputArgument::REQUIRED, 'The repository finder method which returns the cursor to tail.')
Expand Down
4 changes: 3 additions & 1 deletion Command/UpdateSchemaDoctrineODMCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
*/
class UpdateSchemaDoctrineODMCommand extends UpdateCommand
{
/** @var string */
protected static $defaultName = 'doctrine:mongodb:schema:update';

protected function configure()
{
parent::configure();

$this
->setName('doctrine:mongodb:schema:update')
->addOption('dm', null, InputOption::VALUE_REQUIRED, 'The document manager to use for this command.')
->setHelp(<<<EOT
The <info>doctrine:mongodb:schema:update</info> command updates the default document manager's schema:
Expand Down

0 comments on commit f58d723

Please sign in to comment.