yii2tech\ar\softdelete\SoftDeleteBehavior::safeDelete PHP Méthode

safeDelete() public méthode

If owner database supports transactions, regular deleting attempt will be enclosed in transaction with rollback in case of failure.
public safeDelete ( ) : false | integer
Résultat 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;
    }