A
A
asdz2015-02-21 14:59:33
symfony
asdz, 2015-02-21 14:59:33

How to generate classes for Doctrine 2 from an existing mysql database?

I'm trying to make
an xml schema first, but doctrine.php says that

[InvalidArgumentException]
 There are no commands defined in the "mapping" namespace.

Command line:
/vendor/bin/doctrine.php doctrine:mapping:import --force MyBundle xml

Running /vendor/bin/doctrine.php with no arguments gives:
Doctrine Command Line Interface version 2.3.5

Usage:
 [options] command [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debu
g
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question

Available commands:
 help                             Displays help for a command
 list                             Lists commands
dbal
 dbal:import                      Import SQL file(s) directly to Database.
 dbal:run-sql                     Executes arbitrary SQL directly from the command line.
orm
 orm:clear-cache:metadata         Clear all metadata cache of the various cache drivers.
 orm:clear-cache:query            Clear all query cache of the various cache drivers.
 orm:clear-cache:result           Clear all result cache of the various cache drivers.
 orm:convert-d1-schema            Converts Doctrine 1.X schema into a Doctrine 2.X schema.
 orm:convert-mapping              Convert mapping information between supported formats.
 orm:ensure-production-settings   Verify that Doctrine is properly configured for a production environment.
 orm:generate-entities            Generate entity classes and method stubs from your mapping information.
 orm:generate-proxies             Generates proxy classes for entity classes.
 orm:generate-repositories        Generate repository classes from your mapping information.
 orm:info                         Show basic information about all mapped entities
 orm:run-dql                      Executes arbitrary DQL directly from the command line.
 orm:schema-tool:create           Processes the schema and either create it directly on EntityManager Storage Connection
 or generate the SQL output.
 orm:schema-tool:drop             Drop the complete database schema of EntityManager Storage Connection or generate the
corresponding SQL output.
 orm:schema-tool:update           Executes (or dumps) the SQL needed to update the database schema to match the current
mapping metadata.
 orm:validate-schema              Validate the mapping files.

It can be seen that doctrine:mapping:import is not provided in the arguments, it is not clear which script is run in the instruction that takes the arguments "doctrine:mapping:import"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question