示例#1
0
    /**
     * Unassociates all AttributeOptionsAsMultiple
     * @return void
     */
    public function UnassociateAllAttributeOptionsAsMultiple()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAllAttributeOptionAsMultipleArray on this unsaved AttributeValue.');
        }
        // Get the Database Object for this Class
        $objDatabase = AttributeValue::GetDatabase();
        // Journaling (if applicable)
        if ($objDatabase->JournalingDatabase) {
            $objResult = $objDatabase->Query('SELECT `attribute_option_id` AS associated_id FROM `attributevalue_multipleattributeoption_assn` WHERE `attribute_value_id` = ' . $objDatabase->SqlVariable($this->intId));
            while ($objRow = $objResult->GetNextRow()) {
                $this->JournalAttributeOptionAsMultipleAssociation($objRow->GetColumn('associated_id'), 'DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`attributevalue_multipleattributeoption_assn`
				WHERE
					`attribute_value_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }