Esempio n. 1
0
    /**
     * Deletes all associated ClassifiedPosts
     * @return void
     */
    public function DeleteAllClassifiedPosts()
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateClassifiedPost on this unsaved ClassifiedCategory.');
        }
        // Get the Database Object for this Class
        $objDatabase = ClassifiedCategory::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (ClassifiedPost::LoadArrayByClassifiedCategoryId($this->intId) as $objClassifiedPost) {
                $objClassifiedPost->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`classified_post`
				WHERE
					`classified_category_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
    }