Ask your Symfony questions! Pay money and get answers fast! (more info)

Symfony Doctrain Command Symfony

Symfony Doctrain Command

Answers (3)

2011-03-24

Loban Rahman answers:

I suspect you accidentally pressed "submit" before finishing typing. :-)

Any symfony command-line command is done by running "./symfony ARGS" in the root folder of the symfony project. Just running "./symfony" with no arguments will give you a list of all possible commands and their quick description. For more details, do "./symfony help COMMAND". All the doctrine commands start with prefix "doctrine:".

2011-03-24

Deven Patel answers:

go to project directory root then:

Now lets setup our database configuration in config/databases.yml. Open the file in your favorite editor and place the YAML below inside. For this test we are simply using a SQLite database. Doctrine is able to create the SQLite database at the config/doctrine.db path for you which we will do once we setup our schema and some data fixtures.

all:
doctrine:
class: sfDoctrineDatabase
param:
dsn: sqlite:///< ?php echo dirname(__FILE__); ?>/doctrine.db

./symfony list doctrine
it will display doctrin commands with short help

-----------------------------------------------------
$ ./symfony list doctrine
Available tasks for the "doctrine" namespace:
:build-all Generates Doctrine model, SQL and initializes the database (doctrine-build-all)
:build-all-load Generates Doctrine model, SQL, initializes database, and load data (doctrine-build-all-load)
:build-all-reload Generates Doctrine model, SQL, initializes database, and load data (doctrine-build-all-reload)
:build-all-reload-test-all Generates Doctrine model, SQL, initializes database, load data and run all test suites (doctrine-build-all-reload-test-all)
:build-db Creates database for current model (doctrine-build-db)
:build-forms Creates form classes for the current model (doctrine-build-forms)
:build-model Creates classes for the current model (doctrine-build-model)
:build-schema Creates a schema.xml from an existing database (doctrine-build-schema)
:build-sql Creates SQL for the current model (doctrine-build-sql)
:data-dump Dumps data to the fixtures directory (doctrine-dump-data)
:data-load Loads data from fixtures directory (doctrine-load-data)
:dql Execute a DQL query and view the results (doctrine-dql)
:drop-db Drops database for current model (doctrine-drop-db)
:generate-crud Generates a Doctrine CRUD module (doctrine-generate-crud)
:generate-migration Generate migration class (doctrine-generate-migration)
:generate-migrations-db Generate migration classes from existing database connections (doctrine-generate-migrations-db, doctrine-gen-migrations-from-db)
:generate-migrations-models Generate migration classes from an existing set of models (doctrine-generate-migrations-models, doctrine-gen-migrations-from-models)
:init-admin Initializes a Doctrine admin module (doctrine-init-admin)
:insert-sql Inserts SQL for current model (doctrine-insert-sql)
:migrate Migrates database to current/specified version (doctrine-migrate)
:rebuild-db Creates database for current model (doctrine-rebuild-db)

2011-03-24

Mike answers:

Hi,

It's seems your question is incorrect.

To view all commands for doctrine, enter this:

php symfony list doctrine