Ejemplo n.º 1
0
    /**
     * Deletes an associated AuditAsCreatedBy
     * @param Audit $objAudit
     * @return void
     */
    public function DeleteAssociatedAuditAsCreatedBy(Audit $objAudit)
    {
        if (is_null($this->intUserAccountId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAuditAsCreatedBy on this unsaved UserAccount.');
        }
        if (is_null($objAudit->AuditId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAuditAsCreatedBy on this UserAccount with an unsaved Audit.');
        }
        // Get the Database Object for this Class
        $objDatabase = UserAccount::GetDatabase();
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`audit`
				WHERE
					`audit_id` = ' . $objDatabase->SqlVariable($objAudit->AuditId) . ' AND
					`created_by` = ' . $objDatabase->SqlVariable($this->intUserAccountId) . '
			');
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            $objAudit->Journal('DELETE');
        }
    }