Indirect modification of overloaded property Roles::$id has no effect

:mellow: I am getting this error when trying to do:




$sql = "DELETE FROM

            'user_has_roles'

            WHERE '".Yii::app()->controller->module->tbl_user_has_roles."'.'user_id' = :user_id

            AND `". Yii::app()->controller->module->tbl_user_has_roles."'.'role_id' = :role_id

            LIMIT 1";

            

        $command = Yii::app()->db->createCommand($sql);

        $command->bindParam(':user_id', $user_id);

        $command->bindParam(':role_id', $this->id);

        $command->execute();



When I echo out $this->id it displays 1… what does this error mean i not see it before

When I assign $this->id to a new variable then it works normal though.

I don’t know this error too, but maybe you should try bindValue() instead of bindParam() ?

As andy_s stated, bindValue() is the function you’re looking for, bindParam() binds a reference that interacts badly with Yii’s __get() and __set() magic, see http://uk3.php.net/manual/en/pdostatement.bindparam.php