According to, Http://www.digpage.com/active_record.html,
I set up a transaction that relates to the add and delete operations of the table. afterSave
beforeDelete
Under normal circumstances, there is no problem with the association operation. A, B 2 table data is expected.
I called the B table name modification in the database. At this point the SQL statement is definitely not executable. Yii Direct error (This is also true, because the related table cannot be found.)
After the error, and then view the database, a table record has been deleted, but the B table records the existence of any.
My question is that the records of Table B are right. Because SQL did not execute successfully. But why is the record of a table also deleted? The transaction has been enabled. Why not roll it back?
I have a very good level of food, is not my understanding of the business error.
Does it mean that a transaction is only valid if the basic operation of the database is normal?
For example, just when the logic error, only need to 人为(当然这里是框架帮我们搞了)
trigger rollback, has reached the operational requirements of the transaction?
Reply content:
According to, Http://www.digpage.com/active_record.html,
I set up a transaction that relates to the add and delete operations of the table. afterSave
beforeDelete
Under normal circumstances, there is no problem with the association operation. A, B 2 table data is expected.
I called the B table name modification in the database. At this point the SQL statement is definitely not executable. Yii Direct error (This is also true, because the related table cannot be found.)
After the error, and then view the database, a table record has been deleted, but the B table records the existence of any.
My question is that the records of Table B are right. Because SQL did not execute successfully. But why is the record of a table also deleted? The transaction has been enabled. Why not roll it back?
I have a very good level of food, is not my understanding of the business error.
Does it mean that a transaction is only valid if the basic operation of the database is normal?
For example, just when the logic error, only need to 人为(当然这里是框架帮我们搞了)
trigger rollback, has reached the operational requirements of the transaction?
Not set to open transaction?
public function transactions(){ return [ self::SCENARIO_DEFAULT => self::OP_INSERT | self::OP_DELETE ];}