B
B
boing4162015-01-11 14:35:50
Yii
boing416, 2015-01-11 14:35:50

Yii: Pagination error with together = true and HAS_MANY link. How to fix?

Need help on how to properly link four tables into one grid.
public function relations()
{
return array(
'bindTaskShop' => array(self::HAS_MANY, 'BindTaskShop', array('task_id' => 'task_id')),
'bindTaskAgent' => array(self::HAS_MANY, 'BindTaskAgent', array('task_id' => 'task_id')),
'agents' => array(self::HAS_MANY, 'Agent', array('agent_id' => 'agent_id'), 'through' => 'bindTaskAgent'),
'shops' => array(self::HAS_MANY, 'Shop', array('shop_id' => 'shop_id'), 'through' => 'bindTaskShop'),
);
}
public function search()
{
$Criteria = $this->criteria($Criteria);
$Criteria->with = array(
'agents' => array('select' => 'agent_name'),
'bindTaskAgent' => array('select' => false),
'shops' => array('select' => 'shop_title'),
' bindTaskShop' => array('select' => false),
);
// $Criteria->group='bindTaskAgent.bind_id';
// $Criteria->group='bindTaskShop.bind_id';
// $Criteria->group='agents.agent_id';
// $Criteria->group='shops.shop_id';
$criteria->together = true;
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question