This looks like it might be a bug. You can file a ticket at
https://trac.cakephp.org/. Be sure to include the *exact* steps to
reproduce. Thanks.
On Apr 11, 10:07 am, "Joshua Benner" <[EMAIL PROTECTED]> wrote:
> I'm trying to pass PHP data to Javascript (pre-loading data).
>
> It's my understanding that JavascriptHelper::object should generate
> JSON representation of the PHP data passed to it, but I'm
> misunderstanding how to apply the method. Below is the test I ran and
> the unexpected result I get. Is this proper behavior of the function?
>
> This is a sample PHP array with similar structure to what I'm trying
> to JSON-ify:
>
> array(
> '2007'=>array(
> 'Spring'=>array(
> '1'=>array('id'=>'1','name'=>'Josh'),
> '2'=>array('id'=>'2','name'=>'Becky')
> ),
> 'Fall'=>array(
> '1'=>array('id'=>'1','name'=>'Josh'),
> '2'=>array('id'=>'2','name'=>'Becky')
> )
> ),
> '2006'=>array(
> 'Spring'=>array(
> '1'=>array('id'=>'1','name'=>'Josh'),
> '2'=>array('id'=>'2','name'=>'Becky')
> ),
> 'Fall'=>array(
> '1'=>array('id'=>'1','name'=>'Josh'),
> '2'=>array('id'=>'2','name'=>'Becky')
> )
> )
> )
>
> And this is the Javascript that it yields:
>
> [{"Spring":[{"id":1, "name":"Josh"}, {"id":2, "name":"Becky"}], "Fall":
> [{"id":1, "name":"Josh"}, {"id":2, "name":"Becky"}]}, {"Spring":[{"id":
> 1, "name":"Josh"}, {"id":2, "name":"Becky"}], "Fall":[{"id":1,
> "name":"Josh"}, {"id":2, "name":"Becky"}]}]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---