简体   繁体   中英

Adding new tables to Propel and Symfony

I'm new to Propel and Symfony. Well actually more Propel, than Symfony. I'm working on already existing project and my task is to expand it database for some new features. I have read manual for Propel and Symfony, but I still don't understand if I already have new structure, where should I place the description of new tables and how should I regenerate them so there be classes.

Also I use old symfony 1.2

Thanks for help.

Once you've added the table definitions in schema.yml or schema.xml depending on what you are using, you can then rebuild the models, forms and filters using:

symfony propel:build-model

symfony propel:build-forms

symfony propel:build-filters

This will create the base models and forms along with the skeleton forms that you can edit in lib/model and lib/form

You can then create the SQL schema from the models you've defined in the schema.xml or schema.yml using the following command:

symfony propel:build-sql - this will create a file in your 'data/sql' folder. Something like lib.model.schema.sql

You can open that file in a text editor and then just copy the new tables and the insert the code to create the new table(s) in phpmyadmin

I really think you should walk through a tutorial for symfony 1.2 and make your own simple test project to get familiar with symfony.

Here some links:

http://www.symfony-project.org/book/1_2/ there "Inside the model layer"

And also helpful: http://www.symfony-project.org/reference/1_2/en/

After that you can ask more specific questions that are more "answerable" :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM