Пример #1
0
    /**
     * Deletes all associated AttributeValues
     * @return void
     */
    public function DeleteAllAttributeValues()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAttributeValue on this unsaved Person.');
        }
        // Get the Database Object for this Class
        $objDatabase = Person::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (AttributeValue::LoadArrayByPersonId($this->intId) as $objAttributeValue) {
                $objAttributeValue->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`attribute_value`
				WHERE
					`person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }