/**
     * Deletes all associated AuditsAsCreatedBy
     * @return void
     */
    public function DeleteAllAuditsAsCreatedBy()
    {
        if (is_null($this->intUserAccountId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateAuditAsCreatedBy on this unsaved UserAccount.');
        }
        // Get the Database Object for this Class
        $objDatabase = UserAccount::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (Audit::LoadArrayByCreatedBy($this->intUserAccountId) as $objAudit) {
                $objAudit->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`audit`
				WHERE
					`created_by` = ' . $objDatabase->SqlVariable($this->intUserAccountId) . '
			');
    }
Example #2
0
 /**
  * Gets all associated AuditsAsCreatedBy as an array of Audit objects
  * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  * @return Audit[]
  */
 public function GetAuditAsCreatedByArray($objOptionalClauses = null)
 {
     if (is_null($this->intUserAccountId)) {
         return array();
     }
     try {
         return Audit::LoadArrayByCreatedBy($this->intUserAccountId, $objOptionalClauses);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
 }