public static function delete($section_id)
    {
        $details = Symphony::Database()->fetchRow(0, sprintf("
            SELECT `sortorder` FROM tbl_sections WHERE `id` = %d",
            $section_id
        ));

        // Delete all the entries
        $entries = Symphony::Database()->fetchCol('id', "SELECT `id` FROM `tbl_entries` WHERE `section_id` = '$section_id'");
        EntryManager::delete($entries);

        // Delete all the fields
        $fields = FieldManager::fetch(null, $section_id);

        if (is_array($fields) && !empty($fields)) {
            foreach ($fields as $field) {
                FieldManager::delete($field->get('id'));
            }
        }

        // Delete the section
        Symphony::Database()->delete('tbl_sections', sprintf("
            `id` = %d", $section_id
        ));

        // Update the sort orders
        Symphony::Database()->query(sprintf("
            UPDATE tbl_sections
            SET `sortorder` = (`sortorder` - 1)
            WHERE `sortorder` > %d",
            $details['sortorder']
        ));

        // Delete the section associations
        Symphony::Database()->delete('tbl_sections_association', sprintf("
            `parent_section_id` = %d", $section_id
        ));

        return true;
    }
public static function delete($section_id)
    {
        $details = Symphony::Database()->fetchRow(0, sprintf("
            SELECT `sortorder` FROM tbl_sections WHERE `id` = %d",
            $section_id
        ));

        // Delete all the entries
        $entries = Symphony::Database()->fetchCol('id', "SELECT `id` FROM `tbl_entries` WHERE `section_id` = '$section_id'");
        EntryManager::delete($entries);

        // Delete all the fields
        $fields = FieldManager::fetch(null, $section_id);

        if (is_array($fields) && !empty($fields)) {
            foreach ($fields as $field) {
                FieldManager::delete($field->get('id'));
            }
        }

        // Delete the section
        Symphony::Database()->delete('tbl_sections', sprintf("
            `id` = %d", $section_id
        ));

        // Update the sort orders
        Symphony::Database()->query(sprintf("
            UPDATE tbl_sections
            SET `sortorder` = (`sortorder` - 1)
            WHERE `sortorder` > %d",
            $details['sortorder']
        ));

        // Delete the section associations
        Symphony::Database()->delete('tbl_sections_association', sprintf("
            `parent_section_id` = %d", $section_id
        ));

        return true;
    }
public static function delete ( $ section_id ) { $ details = Symphony :: Database ( ) -> fetchRow ( 0 , sprintf ( "
            SELECT `sortorder` FROM tbl_sections WHERE `id` = %d" , $ section_id ) ) ; // Delete all the entries $ entries = Symphony :: Database ( ) -> fetchCol ( 'id' , "SELECT `id` FROM `tbl_entries` WHERE `section_id` = '$section_id'" ) ; EntryManager :: delete ( $ entries ) ; // Delete all the fields $ fields = FieldManager :: fetch ( null , $ section_id ) ; if ( is_array ( $ fields ) && ! empty ( $ fields ) ) { foreach ( $ fields as $ field ) { FieldManager :: delete ( $ field -> get ( 'id' ) ) ; } } // Delete the section Symphony :: Database ( ) -> delete ( 'tbl_sections' , sprintf ( "
            `id` = %d" , $ section_id ) ) ; // Update the sort orders Symphony :: Database ( ) -> query ( sprintf ( "
            UPDATE tbl_sections
            SET `sortorder` = (`sortorder` - 1)
            WHERE `sortorder` > %d" , $ details [ 'sortorder' ] ) ) ; // Delete the section associations Symphony :: Database ( ) -> delete ( 'tbl_sections_association' , sprintf ( "
            `parent_section_id` = %d" , $ section_id ) ) ; return true ; }
Deletes a Section by Section ID, removing all entries, fields, the
Section and any Section Associations in that order

@param integer $section_id
The ID of the Section to delete
@throws DatabaseException
@throws Exception
@return boolean
Returns true when completed
Deletes a Section by Section ID removing all entries fields the Section and any Section Associations in that order