Command" doctrine:generate:entities"没有定义

时间:2015-02-16 14:36:15

标签: symfony doctrine composer-php command-line-interface

我遇到了Symfony和Doctrine实体生成器的问题。

当我调用php app/console doctrine:generate:entities MyCompany时,命令失败并抛出此异常:

[InvalidArgumentException]                            
Command "doctrine:generate:entities" is not defined.  
Did you mean one of these?                            
    doctrine:generate:entity                          
    doctrine:generate:form                            
    doctrine:generate:crud

我在许多有类似问题的帖子中看到过。但他们的相关doctrine:generate:entity命令。他们忘记了:

"sensio/generator-bundle": "2.3.*" // in composer.json

new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); // in AppKernel

在我的情况下,使用composer.json和AppKernel一切正常。例如,这些命令有效:doctrine:generate:entitydoctrine:generate:formdoctrine:generate:crud

但是doctrine:generate:entities没有:/

以下是我php app/console list命令的摘录:

[...]
doctrine
  doctrine:cache:clear-metadata         Clears all metadata cache for an entity manager
  doctrine:cache:clear-query            Clears all query cache for an entity manager
  doctrine:cache:clear-result           Clears result cache for an entity manager
  doctrine:database:create              Creates the configured databases
  doctrine:database:drop                Drops the configured databases
  doctrine:ensure-production-settings   Verify that Doctrine is properly configured for a production environment.
  doctrine:generate:crud                Generates a CRUD based on a Doctrine entity
  doctrine:generate:entity              Generates a new Doctrine entity inside a bundle
  doctrine:generate:form                Generates a form type class based on a Doctrine entity
  doctrine:mapping:convert              Convert mapping information between supported formats.
  doctrine:mapping:import               Imports mapping information from an existing database
  doctrine:mapping:info                 Shows basic information about all mapped entities
  doctrine:query:dql                    Executes arbitrary DQL directly from the command line.
  doctrine:query:sql                    Executes arbitrary SQL directly from the command line.
  doctrine:schema:create                Executes (or dumps) the SQL needed to generate the database schema
  doctrine:schema:drop                  Executes (or dumps) the SQL needed to drop the current database schema
  doctrine:schema:update                Executes (or dumps) the SQL needed to update the database schema to match the current mapping metadata
  doctrine:schema:validate              Validates the doctrine mapping files
[...]
generate
  generate:bundle                       Generates a bundle
  generate:controller                   Generates a controller
  generate:doctrine:crud                Generates a CRUD based on a Doctrine entity
  generate:doctrine:entity              Generates a new Doctrine entity inside a bundle
  generate:doctrine:form                Generates a form type class based on a Doctrine entity
[...]

这里有关于我的项目供应商版本的一些信息

symfony/symfony                      v2.3.24            The Symfony PHP framework
sensio/framework-extra-bundle        v2.3.4             This bundle provides a way to configure your controllers with annotations
sensio/generator-bundle              v2.3.5             This bundle generates code for you
doctrine/annotations                 v1.2.3             Docblock Annotations Parser
doctrine/cache                       v1.4.0             Caching library offering an object-oriented API for many cache backends
doctrine/collections                 v1.2               Collections Abstraction library
doctrine/common                      v2.4.2             Common Library for Doctrine projects
doctrine/dbal                        v2.4.4             Database Abstraction Layer
doctrine/doctrine-bundle             v1.2.0             Symfony DoctrineBundle
doctrine/inflector                   v1.0.1             Common String Manipulations with regard to casing and singular/plural rules.
doctrine/lexer                       v1.0.1             Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm                         v2.4.7             Object-Relational-Mapper for PHP

感谢您的帮助! :)

0 个答案:

没有答案