Code Duplication    Length = 10-11 lines in 3 locations

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

@@ 602-611 (lines=10) @@
599
        ];
600
        // Get the IDs of event datetimes.
601
        $datetimeIds = $eem_datetime->get_col([['EVT_ID' => $eventId]]);
602
        foreach ($datetimeIds as $datetimeId) {
603
            $GID = self::convertToGlobalId($eem_datetime->item_name(), $datetimeId);
604
            foreach ($related_models as $key => $model) {
605
                // Get the IDs of related entities for the datetime ID.
606
                $Ids = $model->get_col([['Datetime.DTT_ID' => $datetimeId]]);
607
                if (! empty($Ids)) {
608
                    $data['datetimes'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
609
                }
610
            }
611
        }
612
613
        // PROCESS TICKETS
614
        $related_models = [
@@ 620-630 (lines=11) @@
617
        ];
618
        // Get the IDs of all datetime tickets.
619
        $ticketIds = $eem_ticket->get_col([['Datetime.DTT_ID' => ['in', $datetimeIds]]]);
620
        foreach ($ticketIds as $ticketId) {
621
            $GID = self::convertToGlobalId($eem_ticket->item_name(), $ticketId);
622
623
            foreach ($related_models as $key => $model) {
624
                // Get the IDs of related entities for the ticket ID.
625
                $Ids = $model->get_col([['Ticket.TKT_ID' => $ticketId]]);
626
                if (! empty($Ids)) {
627
                    $data['tickets'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
628
                }
629
            }
630
        }
631
632
        // PROCESS PRICES
633
        $related_models = [
@@ 639-649 (lines=11) @@
636
        ];
637
        // Get the IDs of all ticket prices.
638
        $priceIds = $eem_price->get_col([['Ticket.TKT_ID' => ['in', $ticketIds]]]);
639
        foreach ($priceIds as $priceId) {
640
            $GID = self::convertToGlobalId($eem_price->item_name(), $priceId);
641
642
            foreach ($related_models as $key => $model) {
643
                // Get the IDs of related entities for the price ID.
644
                $Ids = $model->get_col([['Price.PRC_ID' => $priceId]]);
645
                if (! empty($Ids)) {
646
                    $data['prices'][ $GID ][ $key ] = self::convertToGlobalId($model->item_name(), $Ids);
647
                }
648
            }
649
        }
650
651
        return $data;
652
    }