В Relations Использование Join, Не Приходят Данные Из Связной Таблицы

В relations пишу:


                  

'prof'=>array(self::HAS_ONE, 'UsersAngry', 'id_user', 

   'join'=>'LEFT JOIN `user_status` ON `users_angry`.`status` = `user_status`.`id_user_status`',

),



В итоге в получившемся запросе в select не указаны поля таблицы user_status и соответственно данные из этой таблицы не приходят. Подскажите как исправить, 3 час голову ломаю

Побывал дописывать параметры

‘select’=>’…’

в различных комбинация, но получал лишь ошибки, типа такого поля нет в таблице "prof"

вот сам запрос который сейчас получается

SELECT prof.id_users AS t1_c0, prof.id_user AS t1_c1, prof.status AS t1_c3, prof.status_new AS t1_c4, prof.update_users AS t1_c5 FROM users_pf prof LEFT JOIN user_status ON prof.status = user_status.id_user_status WHERE (prof.id_user=‘1’)

Все модель




<?php


/**

 * This is the model class for table "users".

 *

 * The followings are the available columns in table 'users':

 * @property integer $id_users

 * @property integer $is_active_user

 * @property integer $is_staff

 * @property string $role

 * @property string $created_user

 * @property string $update_user

 * @property string $last_login

 * @property string $email

 * @property string $uid

 * @property string $first_name

 * @property string $photo

 * @property string $photo_rec

 * @property string $session

 * @property string $hash

 */

class Users extends CActiveRecord

{


	/**

	 * @return string the associated database table name

	 */

	public function tableName()

	{

		return 'users';

	}


	/**

	 * @return array validation rules for model attributes.

	 */

	public function rules()

	{

		// NOTE: you should only define rules for those attributes that

		// will receive user inputs.

		return array(

			array('created_user, uid, first_name, hash', 'required', 'message'=>'Введите значение {attribute}.'),

			array('is_active_user, is_staff', 'numerical', 'integerOnly'=>true),

			array('role', 'length', 'max'=>20),

                        array('email', 'length', 'max'=>50),

			array('uid, first_name, photo, photo_rec, session, hash', 'length', 'max'=>255),

                        array('update_user, last_login', 'safe'),

			// The following rule is used by search().

			// @todo Please remove those attributes that should not be searched.

			array('id_users, is_active_user, is_staff, role, created_user, update_user, last_login, email, uid, first_name, photo, photo_rec, session, hash', 'safe', 'on'=>'search'),

		);

	}


	/**

	 * @return array relational rules.

	 */

	public function relations()

	{

		// NOTE: you may need to adjust the relation name and the related

		// class name for the relations automatically generated below.

		return array(

                    'profile'=>array(self::HAS_ONE, 'UserProfile', 'id_user'),

                    'info'=>array(self::HAS_ONE, 'UsersRating', 'id_user', 

                        'select'=>'*',

                        'joinType'=>'LEFT JOIN',

                        'join'=>'LEFT JOIN `user_status` ON `info`.`rating` > `user_status`.`rating_min` AND `info`.`rating` < `user_status`.`rating_max`',

                        

                        ),

                        

	);

	}


	/**

	 * @return array customized attribute labels (name=>label)

	 */

	public function attributeLabels()

	{

		return array(

			'id_users' => 'Id Users',

			'is_active_user' => 'Is Active User',

			'is_staff' => 'Is Staff',

			'role' => 'Role',

			'created_user' => 'Created User',

			'update_user' => 'Update User',

			'last_login' => 'Last Login',

                        'email' => 'Email',

			'uid' => 'Uid',

			'first_name' => 'First Name',

			'photo' => 'Photo',

			'photo_rec' => 'Photo Rec',

			'session' => 'Session',

			'hash' => 'Hash',

		);

	}


	/**

	 * Retrieves a list of models based on the current search/filter conditions.

	 *

	 * Typical usecase:

	 * - Initialize the model fields with values from filter form.

	 * - Execute this method to get CActiveDataProvider instance which will filter

	 * models according to data in model fields.

	 * - Pass data provider to CGridView, CListView or any similar widget.

	 *

	 * @return CActiveDataProvider the data provider that can return the models

	 * based on the search/filter conditions.

	 */

	public function search()

	{

		// @todo Please modify the following code to remove attributes that should not be searched.


		$criteria=new CDbCriteria;


		$criteria->compare('id_users',$this->id_users);

		$criteria->compare('is_active_user',$this->is_active_user);

		$criteria->compare('is_staff',$this->is_staff);

		$criteria->compare('role',$this->role,true);

		$criteria->compare('created_user',$this->created_user,true);

		$criteria->compare('update_user',$this->update_user,true);

		$criteria->compare('last_login',$this->last_login,true);

                $criteria->compare('email',$this->email,true);

		$criteria->compare('uid',$this->uid,true);

		$criteria->compare('first_name',$this->first_name,true);

		$criteria->compare('photo',$this->photo,true);

		$criteria->compare('photo_rec',$this->photo_rec,true);

		$criteria->compare('session',$this->session,true);

		$criteria->compare('hash',$this->hash,true);


		return new CActiveDataProvider($this, array(

			'criteria'=>$criteria,

		));

	}


	/**

	 * Returns the static model of the specified AR class.

	 * Please note that you should have this exact method in all your CActiveRecord descendants!

	 * @param string $className active record class name.

	 * @return Users the static model class

	 */

	public static function model($className=__CLASS__)

	{

		return parent::model($className);

	}

        

        


}






Проблема решена, использовал with и on

devkp.ru/post/otnosheniya-svyaz-ne-po-pervichnomu-klyuchu