-- Andries Seutens <[EMAIL PROTECTED]> wrote
(on Monday, 07 January 2008, 02:17 PM +0100):
> isValid() also throws a notice if there's no validator for a certain
> element.
Good to know; I'll make sure there's a test for this. I'm currently in
the process of taking the API published on the proposal and creating
tests to cover it and the requirements listed, which is resulting in
substantial refactoring of these classes.
> The setDefaults() method in Zend_Form_Abstract is also a little bogus:
>
> public function setDefaults(array $defaults)
> {
> foreach ($defaults as $key => $value) {
> if (isset($this->[$key])) {
> $this[$key]->setValue($value);
> }
> }
>
> return $this;
> }
>
> Should be:
>
> public function setDefaults(array $defaults)
> {
> foreach ($defaults as $key => $value) {
> if (isset($this->_elements[$key])) {
> $this->_elements[$key]->setValue($value);
> }
> }
>
> return $this;
> }
>
> But that's just detail :)
Good to know... I'll make sure the tests cover this.
Remember, it's a PROTOTYPE, not final code. :-)
> Matthew Weier O'Phinney schreef:
>> -- Simon Mundy <[EMAIL PROTECTED]> wrote
>> (on Monday, 07 January 2008, 04:25 PM +1100):
>>
>>> I've had a play with Zend_Form - using Andries Seutens example as a
>>> starting
>>> point.
>>>
>>> Does this look like the correct (read 'efficient'!) way you had intended
>>> the
>>> form to be populated/processed? It's not quite clear on the proposal - if
>>> I
>>> call the isValid() method on a form with an array of values, they don't
>>> actually save their values to each element (is that intended?).
>>>
>>
>> No, unintended -- isValid($data) should also populate. I'll make a note
>> to make a test for that use case.
>>
>> <snip>
>>
>>
>>> I've also 'hacked' in some functionality to allow multidimensional arrays
>>> within element names. So you can have:-
>>>
>>> myelement
>>> myelement[key]
>>> myelement[foo][bar] ..etc...
>>>
>>> Hope this comes in handy - here's the diffs (I imagine you'd probably
>>> want to
>>> write a new separate inflector for these, but it's a start):-
>>>
>>
>> Excellent -- thanks! That's a use case that several have requested.
>>
> Gecontroleerd op virussen door de JOJO Secure Gateway.
--
Matthew Weier O'Phinney
PHP Developer | [EMAIL PROTECTED]
Zend - The PHP Company | http://www.zend.com/