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