> */ public static function history( $subscription_id, $limit = 50 ) { $items = ( new RunItemRepository() )->history( (int) $subscription_id, $limit ); $runs = new RunRepository(); $cache = array(); $out = array(); foreach ( $items as $item ) { if ( ! isset( $cache[ $item->run_id ] ) ) { $cache[ $item->run_id ] = $runs->get( $item->run_id ); } $run = $cache[ $item->run_id ]; if ( ! $run ) { continue; } $entry = $item->to_array(); $entry['run'] = array( 'id' => $run->id, 'uuid' => $run->uuid, 'operation' => $run->operation_id, 'relation' => $run->relation, 'status' => $run->status, 'created_by' => $run->created_by, 'spec_summary' => $run->to_array()['spec_summary'], ); $out[] = $entry; } return $out; } }