array of objects

hello I am running a function in a class (Games) like this

$object=new CActiveDataProvider(‘Games’, array(

		'criteria'=>array(


		'condition'=>'state_code=:state_code',


		'params'=>array(':state_code'=>'AZ'),


		),


	));


	return $object->getData();


}

and the view is

<?php $test=Games::model()->listAvailablegames();

var_dump(&#036;test);?&gt;

how do i get the attributes out of the objects in the array,

thx in advance!!

This should help http://www.yiiframework.com/doc/api/CModel#getAttributes-detail

i tried like this

view.php

<?php $test=Games::model()->listAvailablegames();

var_dump(&#036;test-&gt;getAttributes(&#036;names=null));?&gt;:&lt;/b&gt;

and i get the following error

Call to a member function getAttributes() on a non-object

$test is an array of objects like

$test=>0=>object…

$test=>1=>object…

$test=>2=>object…

i tried this ar_dump($test->getAttributes($test));

same error

Should be:




$attributes = Games::model()->getAttributes();



when i use that it returns an empty array of indexes, the function called listAvailablegames(); generates the correct objects in the arraY,i guess im missing something here,

the objects generated look like.

my intention is to list all available game names that match users current state_code in a dropdown.

i cant really do $test->0->name, im just confused to what getatributes call actually is, do i need to pass it the data array %test or do i loop over it and pass the objects in the array keys?

array

0 =>

object(Games)[76]


  private '_md' =&gt; 


    object(CActiveRecordMetaData)[53]


      public 'tableSchema' =&gt; 


        object(CMysqlTableSchema)[55]


          ...


      public 'columns' =&gt; 


        array


          ...


      public 'relations' =&gt; 


        array


          ...


      public 'attributeDefaults' =&gt; 


        array


          ...


      private '_model' =&gt; 


        object(Games)[52]


          ...


  private '_new' =&gt; boolean false


  private '_attributes' =&gt; 


    array


      'id' =&gt; string '1' (length=1)


      'name' =&gt; string 'Test game' (length=9)


      'numbers' =&gt; string '0' (length=1)


      'schedule_id' =&gt; string '6' (length=1)


      'state_code' =&gt; string 'AZ' (length=2)


      'time' =&gt; string '00:00:00' (length=<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />


  private '_related' =&gt; 


    array


      empty


  private '_c' =&gt; null


  private '_pk' =&gt; string '1' (length=1)


  private '_errors' =&gt; 


    array


      empty


  private '_validators' =&gt; null


  private '_scenario' =&gt; string 'update' (length=6)


  private '_e' =&gt; null


  private '_m' =&gt; null

Well according to the documentation you can’t get the attributes of an AR object from a CActiveDataProvider object.

What you can do is to build the cdbcriteria and then with the returned results construct a cactivedataprovider object.