Craft\NeoService::deleteStructure PHP Method

deleteStructure() public method

Deletes the structure for a field from the database.
public deleteStructure ( NeoFieldType $fieldType ) : boolean
$fieldType NeoFieldType
return boolean
    public function deleteStructure(NeoFieldType $fieldType)
    {
        $owner = $fieldType->element;
        $field = $fieldType->model;
        $locale = $this->_getFieldLocale($fieldType);
        $transaction = $this->beginTransaction();
        try {
            $blockStructure = $this->getStructure($fieldType);
            if ($blockStructure) {
                craft()->structures->deleteStructureById($blockStructure->id);
            }
            craft()->db->createCommand()->delete('neoblockstructures', ['ownerLocale' => $locale ? $locale : null, 'ownerId' => $owner->id, 'fieldId' => $field->id]);
            $this->commitTransaction($transaction);
        } catch (\Exception $e) {
            $this->rollbackTransaction($transaction);
            throw $e;
        }
        return true;
    }