diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php index 40e3000bc..774946b19 100644 --- a/workflow/engine/classes/model/AppDelegation.php +++ b/workflow/engine/classes/model/AppDelegation.php @@ -334,6 +334,47 @@ class AppDelegation extends BaseAppDelegation } } + /** + * Retrieves all rows from the APP_DELEGATION table filtered by app_uid. + * + * @param string $appUid The unique ID of the application. + * + * @return array An array of arrays, where each inner array represents a row + * from the APP_DELEGATION table. Returns an empty array if no + * rows are found, or throws an exception on error. + * + * @throws Exception If there is an error during the database query. + */ + function loadDelegationRowsByAppUid(string $appUid): array + { + try { + $con = Propel::getConnection(AppDelegationPeer::DATABASE_NAME); + + // Create a new Criteria object. + $criteria = new Criteria(); + + // Add the condition to filter by app_uid. + $criteria->add(AppDelegationPeer::APP_UID, $appUid); + + // Retrieve all AppDelegation objects that match the criteria. + $appDelegations = AppDelegationPeer::doSelect($criteria, $con); + + // If no rows are found, return an empty array. + if (empty($appDelegations)) { + return []; + } + + // Convert the Propel objects to arrays. + $rows = []; + foreach ($appDelegations as $appDelegation) { + $rows[] = $appDelegation->toArray(BasePeer::TYPE_FIELDNAME); + } + + return $rows; + } catch (Exception $oError) { + throw ($oError); // Re-throw the exception to be handled by the caller. + } + } /** * Load the Application Delegation row specified in [app_id] column value. *