Hello,

2009/10/22 xhe <hexuf...@gmail.com>

>
> I am using sfAmfPlugin to communicate with frontend flex.
>
> in PHP, I used this:
>
> function getFlexUsers($nickname){
> $u=array();
> $user["firstname"]="name1";
> $user["lastname"]="name2";
> array_push($u,$user);
> $user["firstname"]="name3";
> $user["lastname"]="name4";
> array_push($u,$user);
>
> return $u;
>
> }
>
> Ideally, I hope to retrieve the value in flex by using the key
> directly, but when I read from flex, the key value, firstname,lastname
> is not passed, instead, I can only use 0,1,2... to retrieve the array
> value.
>
>
In ActionScript there is no associative array like in PHP.
You must passed an simple object:
$u=array();
$user = new Object();
$user->firstname="name1";
$user->lastname="name2";
array_push($u,$user);
$user->firstname="name3";
$user->lastname="name4";
array_push($u,$user);

return $u;

To be more precise you could create a Value object class in PHP for mapping
with all the properties to pass in the AS side.

Be careful to select the AMF3 protocol in your ActionScript and not the
AMF0.

I think it should work.
Bye
NairuS


> It seemed the afm converted the associate array in PHP to regular
> array.
>
> Is this a defect in afmphp? Or anything wrong here? How can I keep
> associate array key value?
>
> Thanks for help
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to