delete() public method

This method performs the following steps in order: 1. call BaseActiveRecord::beforeDelete. If the method returns false, it will skip the rest of the steps; 2. delete the record from the database; 3. call BaseActiveRecord::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 delete ( ) : integer | false
return integer | false the number of rows deleted, or `false` if the deletion is unsuccessful for some reason. Note that it is possible the number of rows deleted is 0, even though the deletion execution is successful.
コード例 #1
0
 public function afterDelete($event)
 {
     $this->_relation->delete();
 }
コード例 #2
0
 /**
  * Deletes the table row corresponding to this active record.
  */
 public function delete()
 {
     return parent::delete();
 }