CArrayDataProvider with CListWidget

Hi,

I am facing some problems using CArrayDataProvider with CListWidget. I made some queries using findAllByAttributes, and merged the resulting arrays. Then i created a dataprovider


$dataProvider=new CArrayDataProvider($dataArray);

CListWidget doesnt like the resulting dataprovider. It keeps looking for the ‘id’ property of the model i used findAllByAttributes on. I am pretty sure that i blew the constructor of CArrayDataProvider, but i cant find a throughout documentation for it.

Please advise me how to create the $dataProvider from my array, that i can feed to CListWidget!

Thanks

Code?

Did you check the resulting array? Do a print_r and post it as well.

findAllByAttributes or any other find method returns a CActiveRecord object, and therefore, you should use CActiveDataProvider

Hmm… Doesn’t it output an array of CActiveRecord objects?

CActiveDataProvider uses the findAll methods therefore it is not proper to use find methods with CActiveDataProvider.

Yes, but it accepts an array of arrays, and not an array of objects

EDIT: It does accept

@Gustavo: AFAIK CArrayDataProvider works well with an array of objects.

@Dzsonny: Take a look at the API documentation of CArrayDataProvider. You can find an usage example there.

Really? http://www.yiiframework.com/doc/api/1.1/CArrayDataProvider

Right, phtamas corrected me already

but I dont see why not use ARProvider in his case

The resulting array looks like this:


Array ( [0] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object ( [tableSchema] => CMysqlTableSchema Object ( [schemaName] => [name] => view_dependencychildren [rawName] => `view_dependencychildren` [primaryKey] => [sequenceName] => [foreignKeys] => Array ( ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_e:CComponent:private] => [_m:CComponent:private] => ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [relations] => Array ( ) [attributeDefaults] => Array ( [parentID] => 0 ) [_model:CActiveRecordMetaData:private] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object *RECURSION* [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( [parentName] => TEST1 [parentID] => 18 [parentType] => FLOW [UC] => 11 [childName] => TEST2 [childID] => 19 [childType] => FLOW ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => update [_e:CComponent:private] => [_m:CComponent:private] => ) [1] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object ( [tableSchema] => CMysqlTableSchema Object ( [schemaName] => [name] => view_dependencychildren [rawName] => `view_dependencychildren` [primaryKey] => [sequenceName] => [foreignKeys] => Array ( ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_e:CComponent:private] => [_m:CComponent:private] => ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [relations] => Array ( ) [attributeDefaults] => Array ( [parentID] => 0 ) [_model:CActiveRecordMetaData:private] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object *RECURSION* [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( [parentName] => TEST1 [parentID] => 18 [parentType] => FLOW [UC] => 11 [childName] => TEST3 [childID] => 20 [childType] => FLOW ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => update [_e:CComponent:private] => [_m:CComponent:private] => ) [2] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object ( [tableSchema] => CMysqlTableSchema Object ( [schemaName] => [name] => view_dependencychildren [rawName] => `view_dependencychildren` [primaryKey] => [sequenceName] => [foreignKeys] => Array ( ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_e:CComponent:private] => [_m:CComponent:private] => ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [relations] => Array ( ) [attributeDefaults] => Array ( [parentID] => 0 ) [_model:CActiveRecordMetaData:private] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object *RECURSION* [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( [parentName] => TEST2 [parentID] => 19 [parentType] => FLOW [UC] => 11 [childName] => TEST4 [childID] => 21 [childType] => QUEUE ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => update [_e:CComponent:private] => [_m:CComponent:private] => ) [3] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object ( [tableSchema] => CMysqlTableSchema Object ( [schemaName] => [name] => view_dependencychildren [rawName] => `view_dependencychildren` [primaryKey] => [sequenceName] => [foreignKeys] => Array ( ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_e:CComponent:private] => [_m:CComponent:private] => ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [relations] => Array ( ) [attributeDefaults] => Array ( [parentID] => 0 ) [_model:CActiveRecordMetaData:private] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object *RECURSION* [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( [parentName] => TEST3 [parentID] => 20 [parentType] => FLOW [UC] => 12 [childName] => TEST6 [childID] => 23 [childType] => FLOW ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => update [_e:CComponent:private] => [_m:CComponent:private] => ) [4] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object ( [tableSchema] => CMysqlTableSchema Object ( [schemaName] => [name] => view_dependencychildren [rawName] => `view_dependencychildren` [primaryKey] => [sequenceName] => [foreignKeys] => Array ( ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_e:CComponent:private] => [_m:CComponent:private] => ) [columns] => Array ( [parentName] => CMysqlColumnSchema Object ( [name] => parentName [rawName] => `parentName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentID] => CMysqlColumnSchema Object ( [name] => parentID [rawName] => `parentID` [allowNull] => [dbType] => int(11) [type] => integer [defaultValue] => 0 [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [parentType] => CMysqlColumnSchema Object ( [name] => parentType [rawName] => `parentType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [UC] => CMysqlColumnSchema Object ( [name] => UC [rawName] => `UC` [allowNull] => 1 [dbType] => int(20) [type] => integer [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childName] => CMysqlColumnSchema Object ( [name] => childName [rawName] => `childName` [allowNull] => 1 [dbType] => varchar(128) [type] => string [defaultValue] => [size] => 128 [precision] => 128 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childID] => CMysqlColumnSchema Object ( [name] => childID [rawName] => `childID` [allowNull] => 1 [dbType] => int(11) [type] => integer [defaultValue] => [size] => 11 [precision] => 11 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) [childType] => CMysqlColumnSchema Object ( [name] => childType [rawName] => `childType` [allowNull] => 1 [dbType] => varchar(20) [type] => string [defaultValue] => [size] => 20 [precision] => 20 [scale] => [isPrimaryKey] => [isForeignKey] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [relations] => Array ( ) [attributeDefaults] => Array ( [parentID] => 0 ) [_model:CActiveRecordMetaData:private] => ViewDepC Object ( [_md:CActiveRecord:private] => CActiveRecordMetaData Object *RECURSION* [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => [_e:CComponent:private] => [_m:CComponent:private] => ) ) [_new:CActiveRecord:private] => [_attributes:CActiveRecord:private] => Array ( [parentName] => TEST3 [parentID] => 20 [parentType] => FLOW [UC] => 12 [childName] => TEST7 [childID] => 24 [childType] => QUEUE ) [_related:CActiveRecord:private] => Array ( ) [_c:CActiveRecord:private] => [_pk:CActiveRecord:private] => [_alias:CActiveRecord:private] => t [_errors:CModel:private] => Array ( ) [_validators:CModel:private] => [_scenario:CModel:private] => update [_e:CComponent:private] => [_m:CComponent:private] => ) )

It is an array of objects ViewDepC, wich is the model i made the query from.

I dont know if this tells you anithing. What i want to print out in the widget are the parent-child connections. (parentName, childName). So my question still stands: How can i create a dataprovider from this array, that the ClistView widget will like?

Right know, if i give the array to CArrayDataProvider


$dataProvider=new CArrayDataProvider($dataArray)

if i give the dataprovider to the ClistView widget, i get the following error:




CException


Property "ViewDepC.id" is not defined.



My ViewDepC table has indeed no id property, but why is it looking for it? please help!

Ok i solved the ‘id’ problem. after reading the source of CArrayDataProvider, there is a ‘keyField’ value, wich is set to id by default, i had to change that to an existing property.

Now the widget works, only, the first (0th) item from the array, is displayed. I found, that the dataprovider only contains, the first item from the initial array.

UPDATE: The problem was only due to a type-o. Everything works now. The only point is missed, was defining a ‘keyField’ int the CArrayDataProvider’s constructor. I had to dig that up in the source! Mabe something about this should be in the ducu.

Thanks for your help!