yii2tech\ar\softdelete\SoftDeleteBehavior::safeDelete PHP Method

safeDelete() public method

If owner database supports transactions, regular deleting attempt will be enclosed in transaction with rollback in case of failure.
public safeDelete ( ) : false | integer
return false | integer number of affected rows.
    public function safeDelete()
    {
        try {
            $transaction = $this->beginTransaction();
            $result = $this->owner->delete();
            if (isset($transaction)) {
                $transaction->commit();
            }
        } catch (\Exception $exception) {
            if (isset($transaction)) {
                $transaction->rollback();
            }
            $fallbackExceptionClass = $this->deleteFallbackException;
            if ($exception instanceof $fallbackExceptionClass) {
                $result = $this->softDeleteInternal();
            } else {
                throw $exception;
            }
        }
        return $result;
    }