2015-02-02 8 views

답변

0

시도로 -

$this->Model->find(
'all', 
array(
'fields' => array('table.employee_name', 'table.employee_store', ....), 
'joins' => array(
       'table' => 'store', 
       'conditions' => array('employee_store' => 'store_name') 
      ) 
) 
) 
+0

e.employee_name, e.employee_store, e.employee_phone, s.store_address이 열을 뷰 파에서 표시하려고합니다. t. – user3576366

+0

이 답변을 업데이트했습니다. 별칭을 사용하지 않아도됩니다. 이 경우 Modelname 또는 테이블 이름을 사용할 수 있습니다. –

+0

오류가 발생합니다 : 정의되지 않은 오프셋 : 0 [CORE \ Cake \ Model \ Datasource \ DboSource.php, 1915 줄], 문자열 변환 [CORE \ Cake \ Model \ Datasource \ DboSource.php, 줄 1928] 배열에 – user3576366

0

이 직원이 모델명 시도해야, 저장 테이블의 이름이고 유형은이 오른쪽, 왼쪽 합류 및 내부

$details=$this->Employee->find('all',array('fields' => array('Employee.*','stores.*'), 
     'joins'=>array(
       array(
        'table'=>'store', 
        'type'=>'inner', 
        'conditions'=>array('Emmployee.employee_store=stores.store_name') 
        ) 
       ) 
      ) 
    ); 
0
$this->employee->bindModel(
    array('hasMany' => array(
     'Store' => array(
      'className' => 'Principle' 
       ) 
      ) 
     ) 
    ); 
+0

내가 모델, 컨트롤러에 쓸 필요가있는 세부 사항을 설명 할 수있다. 보기 부분. – user3576366

관련 문제