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