Code Duplication    Length = 23-28 lines in 2 locations

core/domain/services/admin/events/editor/EventEntityRelations.php 2 locations

@@ 85-112 (lines=28) @@
82
     * @throws EE_Error
83
     * @since $VID:$
84
     */
85
    private function processTickets(array $datetimeIds)
86
    {
87
88
        $related_models = [
89
            'datetimes' => $this->datetime_model,
90
            'prices'    => $this->price_model,
91
        ];
92
        // Get the IDs of all datetime tickets.
93
        $ticketIds = $this->ticket_model->get_col([
94
            [ 'Datetime.DTT_ID' => ['IN', $datetimeIds] ],
95
            'default_where_conditions' => 'minimum',
96
        ]);
97
        foreach ($ticketIds as $ticketId) {
98
            $GID = $this->convertToGlobalId($this->ticket_model->item_name(), $ticketId);
99
100
            foreach ($related_models as $key => $model) {
101
                // Get the IDs of related entities for the ticket ID.
102
                $Ids = $model->get_col([
103
                    [ 'Ticket.TKT_ID' => $ticketId ],
104
                    'default_where_conditions' => 'minimum',
105
                ]);
106
                $this->data['tickets'][ $GID ][ $key ] = ! empty($Ids)
107
                    ? $this->convertToGlobalId($model->item_name(), $Ids)
108
                    : [];
109
            }
110
        }
111
        return $ticketIds;
112
    }
113
114
115
    /**
@@ 120-142 (lines=23) @@
117
     * @throws EE_Error
118
     * @since $VID:$
119
     */
120
    private function processPrices(array $ticketIds)
121
    {
122
        $related_models = [
123
            'tickets'    => $this->ticket_model,
124
            'priceTypes' => $this->price_type_model,
125
        ];
126
        // Get the IDs of all ticket prices.
127
        $priceIds = $this->price_model->get_col([['Ticket.TKT_ID' => ['IN', $ticketIds]]]);
128
        foreach ($priceIds as $priceId) {
129
            $GID = $this->convertToGlobalId($this->price_model->item_name(), $priceId);
130
131
            foreach ($related_models as $key => $model) {
132
                // Get the IDs of related entities for the price ID.
133
                $Ids = $model->get_col([
134
                    [ 'Price.PRC_ID' => $priceId ],
135
                    'default_where_conditions' => 'minimum',
136
                ]);
137
                $this->data['prices'][ $GID ][ $key ] = ! empty($Ids)
138
                    ? $this->convertToGlobalId($model->item_name(), $Ids)
139
                    : [];
140
            }
141
        }
142
    }
143
144
145
    /**