Example #1
0
    /**
     * Deletes all associated AttributeValuesAsSingle
     * @return void
     */
    public function DeleteAllAttributeValuesAsSingle()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAttributeValueAsSingle on this unsaved AttributeOption.');
        }
        // Get the Database Object for this Class
        $objDatabase = AttributeOption::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (AttributeValue::LoadArrayBySingleAttributeOptionId($this->intId) as $objAttributeValue) {
                $objAttributeValue->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`attribute_value`
				WHERE
					`single_attribute_option_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }