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