Hello i would like to know why this isnot working and what i can do differently to make it work
i want to display a list of websites thats only made by the loggedin user…
my relation :
‘websiteUsers’ => array(self::HAS_MANY, ‘WebsiteUser’, ‘websiteId’),
my search function
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('id',$this->id);
$criteria->compare('url',$this->url,true);
$criteria->compare('code',$this->code,true);
if (Yii::app()->user->getState("level") !="admin"){
$criteria->with = 'websiteUsers';
$criteria->compare('userId', Yii::app()->user->getId());
}
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
it says userId doesnot exist…
I am new to yii and would really like to know this txs in advance.
CDbCommand faalde tijdens het uitvoeren van volgend SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘userId’ in ‘where clause’. The SQL statement executed was: SELECT t
.id
AS t0_c0
, t
.url
AS t0_c1
, t
.code
AS t0_c2
FROM website
t
WHERE (userId=:ycp0) LIMIT 10