나는 Workposition 모델을 가지고있다. belongsTo 관계가있는 Orders를 사용하여 데이터베이스에 연결됩니다. 따라서 주문 모델과 관련된 조건을 구체적으로 찾아야합니다. 내가 가지 찾을 빨아 예를 들어 사용하는 경우 그래서, :CakePHP는 테이블에서 쿼리를 찾는다.
$workpositions = $this->Workposition->find('all', array(
'conditions' => array(
'Order.type' => 'N'
)
));
CakePHP의는 Order.id
표기법을 이해합니다. 하지만 조인 테이블을 사용할 때 :
$workpositions = $this->Workposition->find('all', array(
'conditions' => array(
'Order.type' => 'N'
)
'joins' => array(
array('table' => 'ordergroups_orders',
'alias' => 'OrdergroupsOrder',
'type' => 'INNER',
'conditions' => array(
'Order.id = OrdergroupsOrder.order_id',
'OrdergroupsOrder.ordergroup_id' => '3',
)
)
)));
오류 : Column not found: 1054 Unknown column 'Order.id' in 'on clause'
이 표시됩니다. 그래서 그것은 Order.id
표기법을 이해하지 못합니다. 무엇이 문제 일 수 있습니까?
$workpositions = $this->Workposition->find('all', array(
'conditions' => $conditions,
'joins' => array(
array('table' => 'orders',
'alias' => 'Orders',
'type' => 'INNER',
),
array('table' => 'ordergroups_orders',
'alias' => 'OrdergroupsOrder',
'type' => 'INNER',
'conditions' => array(
'Orders.id = OrdergroupsOrder.order_id',
'OrdergroupsOrder.ordergroup_id' => $ordergroup_ids,
)
)
)));
을하지만 난 찾을 수 없습니다 오류 열 수 : '절에'(문자열 변환 배열)에 1054 알 수없는 열 '배열'. 그래서 그것은 find 메소드가 Order를 볼 때 Order 모델의 바인딩없이 undestands하는 동안 id의 배열을 undestand하지 않습니다.
나는이 –
@MdHasiburRahaman으로 주문 모델을 바인딩해야한다고 생각합니다. 몇 가지 코드를 추가했습니다. 도움이되지 않습니다. – Vladislav