delete() public method
Deletes the table row corresponding to this active record.
This method performs the following steps in order:
- call beforeDelete(). If the method returns
false
, it will skip the rest of the steps; - delete the record from the database;
- call afterDelete().
In the above step 1 and 3, events named EVENT_BEFORE_DELETE and EVENT_AFTER_DELETE will be raised by the corresponding methods.
public integer|false delete ( ) | ||
---|---|---|
return | integer|false |
The number of rows deleted, or |
throws | yii\db\StaleObjectException |
if optimistic locking is enabled and the data being deleted is outdated. |
throws | yii\db\Exception |
in case delete failed. |
Please login to continue.