Code Duplication    Length = 13-13 lines in 2 locations

src/query/Record.php 1 location

@@ 297-309 (lines=13) @@
294
     *
295
     * @return array Collection of entity identifiers ordered by additional field value
296
     */
297
    protected function applySorting(array $entityIDs, $fieldName, $order = 'ASC')
298
    {
299
        if (array_key_exists($fieldName, static::$fieldIDs)) {
300
            // Order by parent fields
301
            return $this->query
302
                ->entity(static::$identifier)
303
                ->where(static::$primaryFieldName, $entityIDs)
304
                ->orderBy($fieldName, $order)
305
                ->fields(static::$primaryFieldName);
306
        } else { // Nothing is changed
307
            return $entityIDs;
308
        }
309
    }
310
}
311

src/query/Generic.php 1 location

@@ 244-256 (lines=13) @@
241
     *
242
     * @return array Collection of entity identifiers ordered by additional field value
243
     */
244
    protected function applySorting(array $entityIDs, $fieldName, $order = 'ASC')
245
    {
246
        if (array_key_exists($fieldName, self::$fieldIDs)) {
247
            // Order by parent fields
248
            return $this->query
249
                ->entity(static::$identifier)
250
                ->where(static::$primaryFieldName, $entityIDs)
251
                ->orderBy($fieldName, $order)
252
                ->fields(static::$primaryFieldName);
253
        } else { // Nothing is changed
254
            return $entityIDs;
255
        }
256
    }
257
}
258