I am joining two tables (photos and photos_adminvotes) but the problem is when i am using a var_dump on the model i am not getting the photos_adminvotes attributes like for example $model->vote?
My table structure.
photos
------
id
user_id
catid
title
equipment
description
original
size
created
status
photos_adminvotes
-----------------
id
photo_id
user_id
vote
Code in PhotosAdminController
$criteria = new CDbCriteria;
$criteria->join = 'LEFT JOIN photos_adminvotes ON photos_adminvotes.photo_id = '.$id;
$criteria->condition = 't.id = photos_adminvotes.photo_id';
$model=PhotosAdmin::model()->find($criteria);
var_dump($model);
var_dump result
object(PhotosAdmin)[107]
private '_md' (CActiveRecord) =>
object(CActiveRecordMetaData)[93]
public 'tableSchema' =>
object(CMysqlTableSchema)[92]
public 'schemaName' => null
public 'name' => string 'photos' (length=6)
public 'rawName' => string '`photos`' (length=<img src='http://www.yiiframework.com/forum/public/style_emoticons/default/cool.gif' class='bbc_emoticon' alt='8)' />
public 'primaryKey' => string 'id' (length=2)
public 'sequenceName' => string '' (length=0)
public 'foreignKeys' =>
array
...
public 'columns' =>
array
...
private '_e' (CComponent) => null
private '_m' (CComponent) => null
public 'columns' =>
array
'id' =>
object(CMysqlColumnSchema)[94]
...
'user_id' =>
object(CMysqlColumnSchema)[95]
...
'catid' =>
object(CMysqlColumnSchema)[96]
...
'title' =>
object(CMysqlColumnSchema)[97]
...
'equipment' =>
object(CMysqlColumnSchema)[98]
...
'description' =>
object(CMysqlColumnSchema)[99]
...
'original' =>
object(CMysqlColumnSchema)[100]
...
'size' =>
object(CMysqlColumnSchema)[101]
...
'created' =>
object(CMysqlColumnSchema)[102]
...
'status' =>
object(CMysqlColumnSchema)[103]
...
public 'relations' =>
array
empty
public 'attributeDefaults' =>
array
empty
private '_model' =>
object(PhotosAdmin)[91]
private '_md' (CActiveRecord) =>
&object(CActiveRecordMetaData)[93]
private '_new' (CActiveRecord) => boolean false
private '_attributes' (CActiveRecord) =>
array
...
private '_related' (CActiveRecord) =>
array
...
private '_c' (CActiveRecord) => null
private '_pk' (CActiveRecord) => null
private '_alias' (CActiveRecord) => string 't' (length=1)
private '_errors' (CModel) =>
array
...
private '_validators' (CModel) => null
private '_scenario' (CModel) => string '' (length=0)
private '_e' (CComponent) => null
private '_m' (CComponent) => null
private '_new' (CActiveRecord) => boolean false
private '_attributes' (CActiveRecord) =>
array
'id' => string '1' (length=1)
'user_id' => string '1' (length=1)
'catid' => string '1' (length=1)
'title' => string 'Croatia' (length=7)
'equipment' => string '' (length=0)
'description' => string '' (length=0)
'original' => string '1.jpg' (length=5)
'size' => string '251754' (length=6)
'created' => string '2011-06-01 07:52:50' (length=19)
'status' => string '1' (length=1)
private '_related' (CActiveRecord) =>
array
empty
private '_c' (CActiveRecord) => null
private '_pk' (CActiveRecord) => string '1' (length=1)
private '_alias' (CActiveRecord) => string 't' (length=1)
private '_errors' (CModel) =>
array
empty
private '_validators' (CModel) => null
private '_scenario' (CModel) => string 'update' (length=6)
private '_e' (CComponent) => null
private '_m' (CComponent) => null