Code Duplication    Length = 10-11 lines in 3 locations

core/domain/services/admin/events/editor/AdvancedEditorData.php 3 locations

@@ 488-497 (lines=10) @@
485
        ];
486
        // Get the IDs of event datetimes.
487
        $datetimeIds = $eem_datetime->get_col([['EVT_ID' => $eventId]]);
488
        foreach ($datetimeIds as $datetimeId) {
489
            $GID = self::convertToGlobalId($eem_datetime->item_name(), $datetimeId);
490
            foreach ($related_models as $key => $model) {
491
                // Get the IDs of related entities for the datetime ID.
492
                $Ids = $model->get_col([['Datetime.DTT_ID' => $datetimeId]]);
493
                if (! empty($Ids)) {
494
                    $data['datetimes'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
495
                }
496
            }
497
        }
498
499
        // PROCESS TICKETS
500
        $related_models = [
@@ 506-516 (lines=11) @@
503
        ];
504
        // Get the IDs of all datetime tickets.
505
        $ticketIds = $eem_ticket->get_col([['Datetime.DTT_ID' => ['in', $datetimeIds]]]);
506
        foreach ($ticketIds as $ticketId) {
507
            $GID = self::convertToGlobalId($eem_ticket->item_name(), $ticketId);
508
509
            foreach ($related_models as $key => $model) {
510
                // Get the IDs of related entities for the ticket ID.
511
                $Ids = $model->get_col([['Ticket.TKT_ID' => $ticketId]]);
512
                if (! empty($Ids)) {
513
                    $data['tickets'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
514
                }
515
            }
516
        }
517
518
        // PROCESS PRICES
519
        $related_models = [
@@ 525-535 (lines=11) @@
522
        ];
523
        // Get the IDs of all ticket prices.
524
        $priceIds = $eem_price->get_col([['Ticket.TKT_ID' => ['in', $ticketIds]]]);
525
        foreach ($priceIds as $priceId) {
526
            $GID = self::convertToGlobalId($eem_price->item_name(), $priceId);
527
528
            foreach ($related_models as $key => $model) {
529
                // Get the IDs of related entities for the price ID.
530
                $Ids = $model->get_col([['Price.PRC_ID' => $priceId]]);
531
                if (! empty($Ids)) {
532
                    $data['prices'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
533
                }
534
            }
535
        }
536
537
        return $data;
538
    }