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