Procházet zdrojové kódy

Merge pull request #2997 from jvasseur/optional-generator-bundle

Make the SensioGeneratorBundle an optional dependency
Thomas před 10 roky
rodič
revize
c26ac009e6

+ 8 - 0
Command/GenerateAdminCommand.php

@@ -59,6 +59,14 @@ class GenerateAdminCommand extends ContainerAwareCommand
         ;
         ;
     }
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
+    public function isEnabled()
+    {
+        return class_exists('Sensio\\Bundle\\GeneratorBundle\\SensioGeneratorBundle');
+    }
+
     /**
     /**
      * {@inheritDoc}
      * {@inheritDoc}
      */
      */

+ 6 - 0
Resources/doc/reference/console.rst

@@ -33,6 +33,12 @@ As an argument you need to specify the fully qualified model class.
 All passed arguments and options are used as default values in interactive mode.
 All passed arguments and options are used as default values in interactive mode.
 You can disable the interactive mode with ``--no-interaction`` option.
 You can disable the interactive mode with ``--no-interaction`` option.
 
 
+The command require the SensioGeneratorBundle to work. If you don't already have it, you can install it with :
+
+.. code-block:: bash
+
+    composer require --dev sensio/generator-bundle
+
 Options are:
 Options are:
  * ``bundle``: the bundle name (the default value is determined by the given model class, e.g. "YourNSFooBundle")
  * ``bundle``: the bundle name (the default value is determined by the given model class, e.g. "YourNSFooBundle")
  * ``admin``: the admin class basename (by default this adds "Admin" to the model class name, e.g. "BarAdmin")
  * ``admin``: the admin class basename (by default this adds "Admin" to the model class name, e.g. "BarAdmin")

+ 2 - 1
composer.json

@@ -27,7 +27,6 @@
         "symfony/twig-bridge": "~2.3",
         "symfony/twig-bridge": "~2.3",
         "symfony/class-loader":"~2.3",
         "symfony/class-loader":"~2.3",
         "symfony/expression-language": "~2.4",
         "symfony/expression-language": "~2.4",
-        "sensio/generator-bundle": "~2.3",
         "symfony/translation":"~2.3",
         "symfony/translation":"~2.3",
         "symfony/dependency-injection": "~2.3,>=2.3.3",
         "symfony/dependency-injection": "~2.3,>=2.3.3",
         "symfony/property-access": "~2.3",
         "symfony/property-access": "~2.3",
@@ -42,12 +41,14 @@
     },
     },
     "require-dev": {
     "require-dev": {
         "jms/translation-bundle": "~1.1",
         "jms/translation-bundle": "~1.1",
+        "sensio/generator-bundle": "~2.3",
         "symfony/yaml": "~2.3",
         "symfony/yaml": "~2.3",
         "sonata-project/intl-bundle": "~2.1",
         "sonata-project/intl-bundle": "~2.1",
         "symfony/phpunit-bridge": "2.7.*@dev"
         "symfony/phpunit-bridge": "2.7.*@dev"
     },
     },
     "suggest": {
     "suggest": {
         "jms/translation-bundle": "Extract message keys from Admins",
         "jms/translation-bundle": "Extract message keys from Admins",
+        "sensio/generator-bundle": "Add sonata:admin:generate command",
         "sonata-project/intl-bundle": "Add localized date and number into the list"
         "sonata-project/intl-bundle": "Add localized date and number into the list"
     },
     },
     "autoload": {
     "autoload": {