Exemplo n.º 1
0
    /**
     * Deletes an associated ShowcaseItem
     * @param ShowcaseItem $objShowcaseItem
     * @return void
     */
    public function DeleteAssociatedShowcaseItem(ShowcaseItem $objShowcaseItem)
    {
        if (is_null($this->intId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateShowcaseItem on this unsaved Person.');
        }
        if (is_null($objShowcaseItem->Id)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateShowcaseItem on this Person with an unsaved ShowcaseItem.');
        }
        // Get the Database Object for this Class
        $objDatabase = Person::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`showcase_item`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($objShowcaseItem->Id) . ' AND
					`person_id` = ' . $objDatabase->SqlVariable($this->intId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objShowcaseItem->Journal('DELETE');
        }
    }