我正在尝试拆分一些 JSON 字符串以便被这个RestKit的 iPhone 库解析,但是 CakePHP 正在拆分一个不兼容的字符串。例如,下面的字符串是它当前正在拆分的内容:
1. {"Question":{"id":"1","content":"Test","player_id":"1","points":"0","votes":"0","created":"0000-00-00 00:00:00"},"Player":{"id":"1","username":"player_test"}}
我需要有类似的东西:
2. {"Question":{"id":"1","content":"Test","player_id":"1","points":"0","votes":"0","created":"0000-00-00 00:00:00","Player":{"id":"1","username":"player_test"}}}
请注意,玩家响应应该是问题的一部分。
模型在 Cake 上的设置方式是'Question' belongs to 'Player'
后者hasMany 'Question'
我正在寻找告诉 Cake 输出类似于上面的响应 #2 的正确方法。有什么建议么?