Code Duplication    Length = 13-14 lines in 3 locations

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

@@ 564-576 (lines=13) @@
561
            ],
562
            'default_where_conditions' => 'minimum',
563
        ]);
564
        foreach ($datetimeIds as $datetimeId) {
565
            $GID = self::convertToGlobalId($eem_datetime->item_name(), $datetimeId);
566
            foreach ($related_models as $key => $model) {
567
                // Get the IDs of related entities for the datetime ID.
568
                $Ids = $model->get_col([
569
                    [
570
                        'Datetime.DTT_ID' => $datetimeId,
571
                    ],
572
                    'default_where_conditions' => 'minimum',
573
                ]);
574
                $data['datetimes'][ $GID ][ $key ] = empty($Ids) ? [] : self::convertToGlobalId($model->item_name(), $Ids);
575
            }
576
        }
577
578
        // PROCESS TICKETS
579
        $related_models = [
@@ 590-603 (lines=14) @@
587
            ],
588
            'default_where_conditions' => 'minimum',
589
            ]);
590
        foreach ($ticketIds as $ticketId) {
591
            $GID = self::convertToGlobalId($eem_ticket->item_name(), $ticketId);
592
593
            foreach ($related_models as $key => $model) {
594
                // Get the IDs of related entities for the ticket ID.
595
                $Ids = $model->get_col([
596
                    [
597
                        'Ticket.TKT_ID' => $ticketId,
598
                    ],
599
                    'default_where_conditions' => 'minimum',
600
                ]);
601
                $data['tickets'][ $GID ][ $key ] = empty($Ids) ? [] : self::convertToGlobalId($model->item_name(), $Ids);
602
            }
603
        }
604
605
        // PROCESS PRICES
606
        $related_models = [
@@ 612-625 (lines=14) @@
609
        ];
610
        // Get the IDs of all ticket prices.
611
        $priceIds = $eem_price->get_col([['Ticket.TKT_ID' => ['IN', $ticketIds]]]);
612
        foreach ($priceIds as $priceId) {
613
            $GID = self::convertToGlobalId($eem_price->item_name(), $priceId);
614
615
            foreach ($related_models as $key => $model) {
616
                // Get the IDs of related entities for the price ID.
617
                $Ids = $model->get_col([
618
                    [
619
                        'Price.PRC_ID' => $priceId,
620
                    ],
621
                    'default_where_conditions' => 'minimum',
622
                ]);
623
                $data['prices'][ $GID ][ $key ] = empty($Ids) ? [] : self::convertToGlobalId($model->item_name(), $Ids);
624
            }
625
        }
626
627
        return $data;
628
    }