public function delete()
    {
        static::checkReadOnly();

        $column = static::SOFT_DELETE;
        if ($column) {
            switch (static::SOFT_DELETE_MODE) {
                case 'deleted':
                    $value = 1;
                    break;

                case 'active':
                    $value = 0;
                    break;

                case 'stamp':
                    $value = static::getCurrentTimestamp();
                    break;

                default:
                    throw new \LogicException(sprintf(
                        "%s has invalid SOFT_DELETE_MODE mode: '%s'",
                        static::class,
                        static::SOFT_DELETE_MODE
                    ));
                    break;
            }
            $this->__set($column, $value);
            if ($this->isFresh()) {
                return true;
            }
            return $this->update($column);
        }

        $database = self::getDatabase();
        $stmt = $database->delete(static::TABLE, $this->getPrimaryKey());
        if ($stmt->rowCount() > 0) {
            ModelManager::remove($this);
            $this->reset();
            return true;
        }

        return false;
    }
public function delete()
    {
        static::checkReadOnly();

        $column = static::SOFT_DELETE;
        if ($column) {
            switch (static::SOFT_DELETE_MODE) {
                case 'deleted':
                    $value = 1;
                    break;

                case 'active':
                    $value = 0;
                    break;

                case 'stamp':
                    $value = static::getCurrentTimestamp();
                    break;

                default:
                    throw new \LogicException(sprintf(
                        "%s has invalid SOFT_DELETE_MODE mode: '%s'",
                        static::class,
                        static::SOFT_DELETE_MODE
                    ));
                    break;
            }
            $this->__set($column, $value);
            if ($this->isFresh()) {
                return true;
            }
            return $this->update($column);
        }

        $database = self::getDatabase();
        $stmt = $database->delete(static::TABLE, $this->getPrimaryKey());
        if ($stmt->rowCount() > 0) {
            ModelManager::remove($this);
            $this->reset();
            return true;
        }

        return false;
    }
public function delete ( ) { static :: checkReadOnly ( ) ; $ column = static :: SOFT_DELETE ; if ( $ column ) { switch ( static :: SOFT_DELETE_MODE ) { case 'deleted' : $ value = 1 ; break ; case 'active' : $ value = 0 ; break ; case 'stamp' : $ value = static :: getCurrentTimestamp ( ) ; break ; default : throw new \ LogicException ( sprintf ( "%s has invalid SOFT_DELETE_MODE mode: '%s'" , static :: class , static :: SOFT_DELETE_MODE ) ) ; break ; } $ this -> __set ( $ column , $ value ) ; if ( $ this -> isFresh ( ) ) { return true ; } return $ this -> update ( $ column ) ; } $ database = self :: getDatabase ( ) ; $ stmt = $ database -> delete ( static :: TABLE , $ this -> getPrimaryKey ( ) ) ; if ( $ stmt -> rowCount ( ) > 0 ) { ModelManager :: remove ( $ this ) ; $ this -> reset ( ) ; return true ; } return false ; }
Removes model's row from the Table or sets the SOFT_DELETE column

@return boolean For success or failure

@throws ReadOnlyModelException @see checkReadOnly()
@throws \LogicException        If SOFT_DELETE_MODE is unknown
Removes model s row from the Table or sets the SOFT_DELETE column