Code Duplication    Length = 10-11 lines in 3 locations

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

@@ 547-556 (lines=10) @@
544
        ];
545
        // Get the IDs of event datetimes.
546
        $datetimeIds = $eem_datetime->get_col([['EVT_ID' => $eventId]]);
547
        foreach ($datetimeIds as $datetimeId) {
548
            $GID = self::convertToGlobalId($eem_datetime->item_name(), $datetimeId);
549
            foreach ($related_models as $key => $model) {
550
                // Get the IDs of related entities for the datetime ID.
551
                $Ids = $model->get_col([['Datetime.DTT_ID' => $datetimeId]]);
552
                if (! empty($Ids)) {
553
                    $data['datetimes'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
554
                }
555
            }
556
        }
557
558
        // PROCESS TICKETS
559
        $related_models = [
@@ 565-575 (lines=11) @@
562
        ];
563
        // Get the IDs of all datetime tickets.
564
        $ticketIds = $eem_ticket->get_col([['Datetime.DTT_ID' => ['in', $datetimeIds]]]);
565
        foreach ($ticketIds as $ticketId) {
566
            $GID = self::convertToGlobalId($eem_ticket->item_name(), $ticketId);
567
568
            foreach ($related_models as $key => $model) {
569
                // Get the IDs of related entities for the ticket ID.
570
                $Ids = $model->get_col([['Ticket.TKT_ID' => $ticketId]]);
571
                if (! empty($Ids)) {
572
                    $data['tickets'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
573
                }
574
            }
575
        }
576
577
        // PROCESS PRICES
578
        $related_models = [
@@ 584-594 (lines=11) @@
581
        ];
582
        // Get the IDs of all ticket prices.
583
        $priceIds = $eem_price->get_col([['Ticket.TKT_ID' => ['in', $ticketIds]]]);
584
        foreach ($priceIds as $priceId) {
585
            $GID = self::convertToGlobalId($eem_price->item_name(), $priceId);
586
587
            foreach ($related_models as $key => $model) {
588
                // Get the IDs of related entities for the price ID.
589
                $Ids = $model->get_col([['Price.PRC_ID' => $priceId]]);
590
                if (! empty($Ids)) {
591
                    $data['prices'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
592
                }
593
            }
594
        }
595
596
        return $data;
597
    }