Ejemplo n.º 1
0
    /**
     * Deletes an associated CustomFieldValue
     * @param CustomFieldValue $objCustomFieldValue
     * @return void
     */
    public function DeleteAssociatedCustomFieldValue(CustomFieldValue $objCustomFieldValue)
    {
        if (is_null($this->intCustomFieldId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateCustomFieldValue on this unsaved CustomField.');
        }
        if (is_null($objCustomFieldValue->CustomFieldValueId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateCustomFieldValue on this CustomField with an unsaved CustomFieldValue.');
        }
        // Get the Database Object for this Class
        $objDatabase = CustomField::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`custom_field_value`
				WHERE
					`custom_field_value_id` = ' . $objDatabase->SqlVariable($objCustomFieldValue->CustomFieldValueId) . ' AND
					`custom_field_id` = ' . $objDatabase->SqlVariable($this->intCustomFieldId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objCustomFieldValue->Journal('DELETE');
        }
    }