Joining Three Tables then using CGridView on select columns

Hi everyone,

This is my first post here so I hope I do this right.

I am setting up a new website for my work but I am having a small problem. We are making a cart page and I want to show data from our OracleDB. I can get one table just fine, I can even get more than that joined together. My problem is is on the page there are way too many columns. I only want specific columns from each table, but when I tell CGridView any other column names that are not in the original table, it returns and error saying,

"Property "Order.JOBID" is not defined.

The three tables are Order, Job, and Product.

The JOBID field is in the Job table.

I am using an ActiveDataProvider to give to the CGridView widget. The ActiveDataProvider uses the ‘with’ criteria to include two other tables.




$dataProvider = new CActiveDataProvider('Order',array(

  'criteria'=>array(

    'condition'=>"\"t\".link=$orderLink", //OrderLink is provided in the url for the cart

    'with'=>array(

      'iJOBs' => array(

        'with' => array(

          'pRODUCT' => array(

            'condition' => '"iJOBs".productid = "pRODUCT".productid',

          ),

        ),

      ),

    ),

  ),

));



Then here is my call of the CGridView widget:




$this->widget('zii.widgets.grid.CGridView', array(

  'dataProvider' => $dataProvider, //ActiveDataProvider from above

  'columns' => array('LINK','JOBID'), //LINK is in Order, JOBID is in Job

));



Please let me know how I am supposed to be doing this so I can select columns from any table to show.

Now that I look at the HTML generated, those tables aren’t even getting put into the GridView.

Please let me know why

Hi.

If iJOBs is the relation for Job in your Order model, try


'columns' => array('LINK', 'iJOBs.JOBID')