Hi fellow symfonians,
I'am currently building a web application for a faculty of my local
university.
I have not used symfony nor doctrine before, but found the documentation
a real good help.
However, since my data model (see below) requires m2m relations with
extra fields, I am desperately looking for help on embedding forms.
I tried to embed the TeachingOfferStudyCategory form into the
TeachingOffer form, but that leads to only partial data beeing saved,
the embedded forms are somewhat not linked to the main form on saving.
(Although an hidden id-field is present within the generated HTML)
And on editing, the saved data is not displayed.
Am I missing something? Perhaps binding/saving the embedded forms by
hand?
Or is there another way which allows to define m2m relations and
collecting extra field data?
(The DoctrineChoiceMany widget does not, although the
doctrine:build-forms task will use this in generated code for my data
model.)
Schema Sample
---
TeachingOffer:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
submitter: { type: string(255), notnull: true }
name: { type: string(255), notnull: true }
old_name: string(255)
abbr: string(8)
relations:
StudyCategories: { class: StudyCategory, refClass:
TeachingOfferStudyCategory, foreign: study_category_id, local:
teaching_offer_id, foreignAlias: TeachingOffers }
OldCategories: { class: StudyCategory, refClass:
TeachingOfferStudyCategory, foreign: old_category_id, local:
teaching_offer_id, foreignAlias: OldTeachingOffer }
StudyCategory:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
name: string(255)
abbr: string(255)
url: { type: clob, notnull: true }
relations:
TeachingOffers: { class: TeachingOffer, refClass:
TeachingOfferStudyCategory, local: study_category_id, foreignAlias:
StudyCategories, foreign: teaching_offer_id }
OldTeachingOffer: { class: TeachingOffer, refClass:
TeachingOfferStudyCategory, local: old_category_id, foreignAlias:
OldCategories, foreign: teaching_offer_id }
TeachingOfferStudyCategory:
columns:
id: { type: integer(4), primary: true, autoincrement: true }
teaching_offer_id: integer(4)
study_category_id: integer(4)
old_category_id: integer(4)
exam_type_id: { type: integer(4) }
module: { type: string(255) }
relations:
TeachingOffer: { local: teaching_offer_id, foreign: id }
StudyCategory: { local: study_category_id, foreign: id }
OldCategory: { class: StudyCategory, local: old_category_id,
foreign: id }
ExamType: { local: exam_type_id, foreign: id, class: ExamType }
---
Embedding code:
---
foreach($this->getObject()->getTeachingOfferStudyCategories() as $sc ){
$scform = new TeachingOfferStudyCategoryForm($sc);
$this->embedForm('study_cat'.$sc->getId(),$scform);
}
---
Anyone, who had a similiar problem and found a working solution?
Greetz,
Daniel Reiche
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---