Example #1
0
    /**
     * Deletes an associated WikiItemAsCurrentPostedBy
     * @param WikiItem $objWikiItem
     * @return void
     */
    public function DeleteAssociatedWikiItemAsCurrentPostedBy(WikiItem $objWikiItem)
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateWikiItemAsCurrentPostedBy on this unsaved Person.');
        }
        if (is_null($objWikiItem->Id)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateWikiItemAsCurrentPostedBy on this Person with an unsaved WikiItem.');
        }
        // Get the Database Object for this Class
        $objDatabase = Person::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`wiki_item`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objWikiItem->Id) . ' AND
					`current_posted_by_person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objWikiItem->Journal('DELETE');
        }
    }