/** * Deletes an associated CategoryAsCreatedBy * @param Category $objCategory * @return void */ public function DeleteAssociatedCategoryAsCreatedBy(Category $objCategory) { if (is_null($this->intUserAccountId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateCategoryAsCreatedBy on this unsaved UserAccount.'); } if (is_null($objCategory->CategoryId)) { throw new QUndefinedPrimaryKeyException('Unable to call UnassociateCategoryAsCreatedBy on this UserAccount with an unsaved Category.'); } // Get the Database Object for this Class $objDatabase = UserAccount::GetDatabase(); // Perform the SQL Query $objDatabase->NonQuery(' DELETE FROM `category` WHERE `category_id` = ' . $objDatabase->SqlVariable($objCategory->CategoryId) . ' AND `created_by` = ' . $objDatabase->SqlVariable($this->intUserAccountId) . ' '); // Journaling if ($objDatabase->JournalingDatabase) { $objCategory->Journal('DELETE'); } }