public function podiumDelete()
    {
        $transaction = static::getDb()->beginTransaction();
        try {
            if (!$this->delete()) {
                throw new Exception('Post deleting error!');
            }
            $wholeThread = false;
            if ($this->thread->postsCount) {
                if (!$this->thread->updateCounters(['posts' => -1])) {
                    throw new Exception('Thread Post counter subtracting error!');
                }
                if (!$this->forum->updateCounters(['posts' => -1])) {
                    throw new Exception('Forum Post counter subtracting error!');
                }
            } else {
                $wholeThread = true;
                if (!$this->thread->delete()) {
                    throw new Exception('Thread deleting error!');
                }
                if (!$this->forum->updateCounters(['posts' => -1, 'threads' => -1])) {
                    throw new Exception('Forum Post and Thread counter subtracting error!');
                }
            }
            $transaction->commit();
            PodiumCache::clearAfter('postDelete');
            Log::info('Post deleted', !empty($this->id) ? $this->id : '', __METHOD__);
            return true;
        } catch (Exception $e) {
            $transaction->rollBack();
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
public function podiumDelete()
    {
        $transaction = static::getDb()->beginTransaction();
        try {
            if (!$this->delete()) {
                throw new Exception('Post deleting error!');
            }
            $wholeThread = false;
            if ($this->thread->postsCount) {
                if (!$this->thread->updateCounters(['posts' => -1])) {
                    throw new Exception('Thread Post counter subtracting error!');
                }
                if (!$this->forum->updateCounters(['posts' => -1])) {
                    throw new Exception('Forum Post counter subtracting error!');
                }
            } else {
                $wholeThread = true;
                if (!$this->thread->delete()) {
                    throw new Exception('Thread deleting error!');
                }
                if (!$this->forum->updateCounters(['posts' => -1, 'threads' => -1])) {
                    throw new Exception('Forum Post and Thread counter subtracting error!');
                }
            }
            $transaction->commit();
            PodiumCache::clearAfter('postDelete');
            Log::info('Post deleted', !empty($this->id) ? $this->id : '', __METHOD__);
            return true;
        } catch (Exception $e) {
            $transaction->rollBack();
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
public function podiumDelete ( ) { $ transaction = static :: getDb ( ) -> beginTransaction ( ) ; try { if ( ! $ this -> delete ( ) ) { throw new Exception ( 'Post deleting error!' ) ; } $ wholeThread = false ; if ( $ this -> thread -> postsCount ) { if ( ! $ this -> thread -> updateCounters ( [ 'posts' => - 1 ] ) ) { throw new Exception ( 'Thread Post counter subtracting error!' ) ; } if ( ! $ this -> forum -> updateCounters ( [ 'posts' => - 1 ] ) ) { throw new Exception ( 'Forum Post counter subtracting error!' ) ; } } else { $ wholeThread = true ; if ( ! $ this -> thread -> delete ( ) ) { throw new Exception ( 'Thread deleting error!' ) ; } if ( ! $ this -> forum -> updateCounters ( [ 'posts' => - 1 , 'threads' => - 1 ] ) ) { throw new Exception ( 'Forum Post and Thread counter subtracting error!' ) ; } } $ transaction -> commit ( ) ; PodiumCache :: clearAfter ( 'postDelete' ) ; Log :: info ( 'Post deleted' , ! empty ( $ this -> id ) ? $ this -> id : '' , __METHOD__ ) ; return true ; } catch ( Exception $ e ) { $ transaction -> rollBack ( ) ; Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } return false ; }
Performs post delete with parent forum and thread counters update.
@return bool
@since 0.2
Performs post delete with parent forum and thread counters update .