Use primaryKey() for update ids columns in ActiveRecord->insertInternal() #20245
Replies: 2 comments 4 replies
-
Why do you need to use afterSave() with a view? |
Beta Was this translation helpful? Give feedback.
-
I don't think that this is related to lack of primary key. The problem is that You may try |
Beta Was this translation helpful? Give feedback.
-
Hello! I have encountered a problem with obtaining an ID in my model by method
afterSave()
. After research problem i found in ActiveRecord->insertInternal():My table schema doesnt have PK. Because i use mysql VIEW, not TABLE. I know that not good use VIEW for model, but I have to do it.
So i believe "YII2" should be no restrictions for developers.
I suggest use code:
Sorry if I distract you from you work. I just want to bring something good to the community! Have a nice day! Maybe it use in yii3?
Beta Was this translation helpful? Give feedback.
All reactions