보기/계획/index.ctp세트() 데이터
<?php debug($plans); ?>
컨트롤러/plans_controller.php (지수 함수) 여기서
function index() {
$plansC = $this->Plan->find('all',
array('contain' => array('PlanDetail' => array('fields' => array('id',
'effective_date',
'expiration_date',
'active',
'name',
'plan_type_id',
'max_benefit',
'deductible',
'preventive',
'basic',
'major',
'ortho',
'company_id',
'plan_type_id',
'plan_detail_note_id'),
'Company' => array('fields' => array(
'id',
'company_logo_url'
)),
'PlanType' => array('fields' => array(
'id',
'name'
))
))));
debug($plansC);
$this->set('plans',$this->paginate($planC));
인을 볼에 전달되지 않을 plans_controller.php의 샘플 index() 디버그 레코드 (containable을 사용하여 모든 데이터가 올바르게 포함 된 것을 볼 수 있듯이) :
[0] => Array
(
[Plan] => Array
(
[id] => 7
[created] => 2011-01-10 14:11:40
[modified] => 2011-02-03 18:35:29
[plan_detail_id] => 32
[monthly_cost] => 25.49
[dental_cost] => 0.00
[age_id] => 2
[applicant_id] => 1
[state_id] => 1
)
[PlanDetail] => Array
(
[id] => 32
[effective_date] => 2011-01-10 14:07:00
[expiration_date] => 2011-01-10 14:07:00
[active] => 1
[name] => Classic 1500
[plan_type_id] => 2
[max_benefit] => 0.00
[deductible] => $75/year
[preventive] => 90%
[basic] => 75%
[major] => 50%
[ortho] =>
N/A
[company_id] => 4
[plan_detail_note_id] => 9
[Company] => Array
(
[id] => 4
[company_logo_url] => nationwide_logo.png
)
[PlanType] => Array
(
[id] => 2
[name] => Indemnity
)
)
)
포함 할 수있는 데이터가 전달되지 않습니다. Plan 및 PlanDetail과 관련된 데이터 (회사 또는 계획 유형과 같은 PlanDetail보다 더 깊은 관계가 없음) 만 인덱스 컨트롤러의 디버그를 통해 모든 데이터가 전달됩니다! 그러나이 데이터 중 어느 것도 뷰 디버그에 들어가 있지 않습니까 ???
이 버그가 포함 된 버그인지 아는 사람이 있습니까?
컴팩트는 해결책이 아니며 단지 편의를위한 것입니다. 문제 해결사는 $ this-> paginate()와 변수 $ this-> paginate입니다. –
뭔가 잘못하고 있었음에 틀림 없지만 set()은 뷰에 데이터를 전달하지 않고 compact() 스위치를 사용하여 필요에 따라 작동하게했습니다. 그래서 무엇이 잘못되었는지는 모르지만 지금은 작동하고 두통은 사라졌습니다.) – OldWest