tags:

views:

128

answers:

1

i know i can run DQL and all the fancy ORM features using Doctrine. but for development, maybe i want to just initialize the database with defalt data.

say i want to do:

  • truncate the database tables
  • initialize tables with default test data

    1. i am thinking it will be good if i can just go to a page say /initData that truncates database and inserts test data. how can i do that?

    2. i think another way is to run

    php doctrine.php orm:schema-tool:drop php doctrine.php orm:schema-tool:create

i think in doctrine 1 theres a build-all-reload is there such a thing?

but i still think it will be good to know how to run normal SQL in doctrine. is there a way?

A: 

i found out the answer is probably ... Native SQL

A NativeQuery lets you execute native SQL, mapping the results according to your specifications. Such a specification that describes how an SQL result set is mapped to a Doctrine result is represented by a ResultSetMapping.

jiewmeng