I have a Yii web service which has been working fine until now.
All of a sudden I am getting an error message when trying to update an existing record, saying:
I’ve looked in the MSSQL db and the table which I am using has a primary key set for it. However, after reading some posts I noticed one solution was to include the following method in the model:
After including this piece of code, the update creates a new row with id = 1, although it is not this id that it should update. Running a second update updates the correct row with id 815.
I have also managed to remove this error by specify id in the findByAttributes query, but I should not have to specify the id as I don’t know it before it is being inserted/updated. This does not work:
But this works:
Is there something wrong in the MSSQL table settings, or in the Yii code somehow?