2009年5月5日星期二

Re: [fw-mvc] 1-m relation into forms

2009/5/5 Cristian Bichis <contact@zftutorials.com>
What would be the possible approaches for this on Zend_Form (to allow edit/add/delete) the elements from dependent table ?

I use a subform for the collection (it is named so in Doctrine) and more subforms for every element, in a structure like this:
- field1
- field2
- collectionName
--0
---fielda
---fieldb
--1
---fielda
---fieldb
--2
---fielda
---fieldb
There was an issue with using 0 as a key, but I override setElementBelongsTo() to admit it. Also I override isValid to produce as many subforms are needed to validate the input (adding or removing them basing on count($_POST['collectionName'])).


--
Giorgio Sironi
Piccolo Principe & Ossigeno Scripter
http://ossigeno.sourceforge.net

没有评论: