I found that if I used a numeral for the name of an embedded form, the  
values for the embedded fields aren't filled. I get this effect when  
any number, not just zero is used. However, I'm using sfPropelForm and  
I'm guessing that you're using doctrine. So maybe thats why we get  
different results.

I did some experiments.....

> public function updateDefaultsFromObject()
> {
>       parent::updateDefaultsFromObject();
>       print_r($this->getDefaults());
>       exit;
> }
>
> Array
> (
>     [0] => Array
>         (
>             [id] => 4
>             [owner_class] => Product
>             [owner_id] => 1
>             [file] => /Users/jonathan/Sites/sfPolaroids/web/uploads/ 
> ae2c6d6b77d80e5e14c7c531515528abccc2c08f.jpg
>             [rank] => 1
>         )
>
>     [id] => 1
>     [stocknumber] => 1234
>     [name] => basket
>     [description] => a big big basket
>     [price] => 1200
>     [type_id] => 1
> )

The embedded values are there but the array key is zero???

>   public function updateObject()
>   {
>     parent::updateObject();
>     print_r($this->getValues());
>     exit;
>   }
>
> Array
> (
>     [stocknumber] => 1234
>     [name] => basket
>     [description] => a big big basket
>     [price] => 1200
>     [type_id] => 1
>     [4] => Array
>         (
>             [owner_class] =>
>             [owner_id] =>
>             [id] =>
>             [file] =>
>         )
>
>     [id] => 1
> )

The array key is correct but the values are gone!!

Regards

Jonathan



On 23 Oct 2008, at 22:34, Jonathan Wage wrote:

> I only encountered problems when the field name is 0. This kind of  
> sucks for creating forms from arrays where the keys of some data  
> collections may be 0, 1, 2, etc. and the data is posted back and  
> merge back in to the data structure the original array came from.
>
> - Jon
>
> On Thu, Oct 23, 2008 at 7:11 AM, Jonathan Franks  
> <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I'm not sure if this is a bug and I don't know how to use the trac
> system to file it but anyway...
>
> If I use a numeral as the name for my embedded form, the auto
> populating fails...
>
> $this->embedForm(1, $form);                             // passing a  
> numeral  - auto populating
> fails
>
> $this->embedForm('1', $form);                           // passing a  
> string of a numeral -
> auto populating fails
>
> if I change the name to a string which isn't a number, it works as
> expected.
>
> Hope thats interesting to someone??
> Regards
> Jonathan
>
>
>
>
>
> -- 
> Jonathan H. Wage
> Open Source Software Developer & Evangelist
> http://www.jwage.com
> http://www.doctrine-project.org
> http://www.symfony-project.org
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" 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-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to