1
votes

I use Symfony 1.4 with Propel. I deleted a table (name: company_show_field), deleted from database and schema.yml too. Then I added a new table named agency_company (it is exists in DB too). So I have this now:

  company:
    _attributes: { phpName: EdimaCompany }
    id: { type: INTEGER, size: '11',  autoIncrement: true, required: true }
    name: { type: VARCHAR, size: '100', required: true }
    ...

  agency_company:
    _attributes: { phpName: EdimaAgencyCompany }
    _propel_behaviors:
      symfony:
        form: false
        filter: false
    agency_id: { type: INTEGER, size: '11', required: true, primaryKey: true, foreignTable: company, foreignReference: id, onDelete: CASCADE }
    company_id: { type: INTEGER, size: '11', required: true, primaryKey: true, foreignTable: company, foreignReference: id, onDelete: CASCADE }

Then I did:

symfony cc
symfony propel:build-model
symfony propel:build-forms

but the BaseEdimaCompanyForm class throws an exception: "Call to undefined method BaseEdimaCompany::getEdimaCompanyShowFields". I deleted some lines from this file (to test the generation is make a new file), and regenerate the models/forms again, but symfony generated a bad code again.

I'm sure this table (company_show_fields) isn't exists in the schema and in the DB. And I don't see the new table in this form class (agency_company).

Can somebody help me please? Why this happen? Where can symfony get the table name, what not exists?

PS: sorry for my English, this is not my native language.

1
I don't understand what happened, but I'm deleted the model/map/EdimaCompanyShowFieldsTableMap.php, and now works. Sorry for your time!gopher

1 Answers

0
votes

It's easier to use symfony propel:build --all than just using build-model or build-forms when you have changes in your model, because it will generate all related scheme (e.g. model, filters, forms, db, etc).

Also, you don't need to delete the table in the real database manually, symfony will do it for you when you use build --all helper. If you want to remove a table from scheme, you just delete the table code in the scheme file, and delete all the associate file in the filter, form, and model folder inside /lib folder. This method will keep the connection between ORM and real database.