0
嗨,我寫了包含在我的模型,它只對第一條記錄和其他人 包含所有不必要的記錄。 我的控制器邏輯:CakePHP包含密鑰問題
$findFiles['conditions']['Content.created_by'] = $curUser;
$findFiles['conditions']['KmpContent.is_approved'] = false;
$findFiles['conditions']['KmpContent.is_file'] = true;
$findFiles['contain'] = array('Parent' => array('SectionApprover' => array('Approver')));
$findFiles['recursive'] = 3;
$findFiles['fields'] = array('id', 'file_path', 'url_path', 'is_approved', 'name', 'created', 'approved_by','parent_id','display_text','is_active');
$fileData = $this->KmpContent->find('all', $findFiles);
數組詳情如下
0 =>
array (
'KmpContent' =>
array (
'id' => '881',
'file_path' => '/uploads/test_file_for_multiple_approvers_backend_validations.docx',
'url_path' => '/uploads/test_file_for_multiple_approvers_backend_validations.docx',
'is_approved' => '0',
'name' => 'file_test_file_for_multiple_approvers_backend_validations.docx',
'created' => '2013-08-20 11:49:58',
'approved_by' => NULL,
'parent_id' => '143',
'display_text' => 'test file for multiple approvers',
'is_active' => '1',
),
'Parent' =>
array (
'id' => '143',
'name' => 'sct_Services.html',
'display_text' => 'Services',
'Parent' =>
array (
),
'Uploader' =>
array (
),
'SectionApprover' =>
array (
0 =>
array (
'id' => '104',
'kmp_content_id' => '143',
'approver_id' => '882',
'Approver' =>
array (
'id' => '882',
'first_name' => 'Prakasha',
'last_name' => 'Matte',
),
),
1 =>
array (
'id' => '256',
'kmp_content_id' => '143',
'approver_id' => '1168',
'Approver' =>
array (
'id' => '1168',
'first_name' => 'Rima Roy',
'last_name' => 'Chowdhury',
),
),
2 =>
array (
'id' => '257',
'kmp_content_id' => '143',
'approver_id' => '1171',
'Approver' =>
array (
'id' => '1171',
'first_name' => 'Durga Venkatesh',
'last_name' => 'Sambhani',
),
),
3 =>
array (
'id' => '258',
'kmp_content_id' => '143',
'approver_id' => '1172',
'Approver' =>
array (
'id' => '1172',
'first_name' => 'Gowtham Babu',
'last_name' => 'Tummala',
),
),
4 =>
array (
'id' => '259',
'kmp_content_id' => '143',
'approver_id' => '889',
'Approver' =>
array (
'id' => '889',
'first_name' => 'Sandeep',
'last_name' => 'Pathuri',
),
),
),
),
'SectionApprover' =>
array (
),
),
1 =>
array (
'KmpContent' =>
array (
'id' => '882',
'file_path' => '/uploads/test_file_for_ma_contentcontroller_save.txt',
'url_path' => '/uploads/test_file_for_ma_contentcontroller_save.txt',
'is_approved' => '0',
'name' => 'file_test_file_for_ma_contentcontroller_save.txt',
'created' => '2013-08-20 11:54:15',
'approved_by' => NULL,
'parent_id' => '28',
'display_text' => 'test file for MA',
'is_active' => '1',
),
'Parent' =>
array (
'id' => '28',
'name' => 'sct_domain.html',
'display_text' => 'Domains',
'Parent' =>
array (
),
'Uploader' =>
array (
),
'SectionApprover' =>
array (
0 =>
array (
'id' => '26',
'kmp_content_id' => '28',
'approver_id' => '467',
'KmpContent' =>
array (
'id' => '28',
'name' => 'sct_domain.html',
'description' => NULL,
'page_title' => 'IVV Knowledge Portal :: mckesson :: domain',
'display_logo_path' => '../images/domains.png',
'display_text' => 'Domains',
'top_logo_path' => '/mckesson_ban.jpg',
'top_logo_url' => 'http://www.mckesson.com/en_us/McKesson.com/',
'header_text' => 'Domains',
'header_desc' => NULL,
'header_logo_path' => '',
'is_section' => '1',
'url_path' => '/university/mckesson/domains.html',
'can_upload_files' => '1',
'is_file' => '0',
'file_path' => NULL,
'display_order' => '1',
'aco_path' => '',
'menu_name' => 'mckesson',
'view_path' => 'download_files',
'is_approved' => '1',
'parent_id' => '11',
'is_active' => '1',
'created' => '2013-06-22 21:18:27',
'created_by' => NULL,
'modified' => '2013-06-22 21:21:01',
'approved_by' => NULL,
),
'Approver' =>
array (
'id' => '467',
'first_name' => 'Nageswara Rao',
'last_name' => 'Menda',
),
),
),
),
'SectionApprover' =>
array (
),
),
我不想讓kmpContent與在sectionapprovers所有記錄