I used a CSqlDataProvider class with query for a few tables with join clause that don’t have a id column, because they don’t need it. Unfortunately, I’m getting error ‘Undefined index: id’. Query is simple:
SELECT t., t1.
FROM tableA t
JOIN tableB t1 ON t1.unique_id=t.unique_id AND t1.instance_id=t.instance_id
(
unique_id is indeed a varchar(13) type field filled by uniqueid() function in php
Hey, I’m having the same problem with CSqlDataProvider. What needs to be specified for this id parameter? The API says it’s just a unique identifier for the dataProvider, but nothing I do seems to work and it doesn’t appear to be optional.
This is roughly what I’m trying to accomplish.
//sample sql showing the fields i'm retrieving
$sql = 'select t.tech_name, j.tech_time from journal j left join tech t on j.tech_id = t.tech_id';
$dataProvider = new CSqlDataProvider($sql, array(
'id'=>'??',//<--HERE IS MY PROBLEM.
'totalItemCount'=>$itemCount,
'sort'=>$sort,
'pagination'=>array(
'pageSize'=>20,
),
));