Re: DataObject setFrom with array values

From: Date: Wed, 26 Jan 2005 21:00:49 +0000
Subject: Re: DataObject setFrom with array values
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17186@lists.php.net to get a copy of this message
On Wed, 26 Jan 2005 14:51:15 -0600, Julie Knoll <k_julie@hotmail.com> wrote: > Hello, > > I'm using quickform and dataobject together. In the form I have a date > element that submits its value as an array. In my dataobject I have a > custom setDate method. > > When I use setFrom($form->exportValues()), it doesn't call my setDate method > or set the var at all. It doesn't actually call the custom set methods for > any of the elements that are arrays. > > I think its because of this code in the setFrom method in DataObject.php: > > if (is_array($from[sprintf($format,$k)])) { > continue; > } > > Is this supposed to work like this? If so why? Otherwise is there > something I'm missing? > Interesting....Alan, why is it this way? If you use a set method any type should be valid. I would suggest moving the if !isset, is_object, and is_array calls below the use of the set methods. -- Justin Patrin

« previous php.pear.general (#17186) next »