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条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大