Search code examples
phpsymfony1propel

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.


Solution

  • 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