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