yii\mongodb\ActiveRecord::delete PHP Метод

delete() публичный Метод

This method performs the following steps in order: 1. call [[beforeDelete()]]. If the method returns false, it will skip the rest of the steps; 2. delete the document from the collection; 3. 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 delete ( ) : integer | boolean
Результат integer | boolean the number of documents deleted, or false if the deletion is unsuccessful for some reason. Note that it is possible the number of documents deleted is 0, even though the deletion execution is successful.
    public function delete()
    {
        $result = false;
        if ($this->beforeDelete()) {
            $result = $this->deleteInternal();
            $this->afterDelete();
        }
        return $result;
    }