drozwmi5440 2014-05-14 08:03
浏览 24
已采纳

cakephp:结构数据库数据返回

a possible return of a DB query looks like this:

array(
    (int) 0 => array(
        'Question' => array(
            'id' => '737',
            'question' => 'what is 1x7?',
        ),
        'Answer' => array(
            (int) 0 => array(
                'id' => '2373',
                'question_id' => '737',
                'correct' => true,
                'answer' => 'possible answer1',
                'created' => '2014-05-08 13:46:43',
                'modified' => '2014-05-08 13:46:43'
            ),
            (int) 1 => array(
                'id' => '2374',
                'question_id' => '737',
                'correct' => false,
                'answer' => 'possible answer2',
                'created' => '2014-05-08 13:46:43',
                'modified' => '2014-05-08 13:46:43'
            )
        ),
        'Linkquestioncategory' => array(
            (int) 0 => array(
                'id' => '608',
                'question_id' => '737',
                'category_id' => '5',
                'created' => '2014-05-08 13:46:47',
                'modified' => '2014-05-08 13:46:47',
                'Category' => array(
                    'id' => '5',
                    'name' => 'Simple Math',
                    'active' => true,
                    'linkquestioncategory_count' => '64',
                    'created' => '2014-02-03 09:20:54',
                    'modified' => '2014-03-04 14:47:05'
                )
            )
        )
    ),

In order to clean it up to avoid sending to much unwanted data => my questions is => how can I get rid of those fields like

  • Answer.created
  • Linkquestioncategory.created
  • Linkquestioncategory.Category.created

I know that I can use conditions 'fields' to select the selected fields, but as far as I know, this works only for 'Question', but how can I manipulate those deeper array data? Can I do this also with the 'fields' condition? If yes, how?

Thanks!!

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 急matlab编程仿真二阶震荡系统
  • ¥20 TEC-9的数据通路实验
  • ¥15 ue5 .3之前好好的现在只要是激活关卡就会崩溃
  • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
  • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
  • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
  • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
  • ¥15 python爬取bilibili校园招聘网站
  • ¥30 求解达问题(有红包)
  • ¥15 请解包一个pak文件