Code Duplication    Length = 3-8 lines in 2 locations

core/db_models/relations/EE_Model_Relation_Base.php 1 location

@@ 294-296 (lines=3) @@
291
        if ($model_object_or_id instanceof EE_Base_Class) {
292
            $model_object_id = $model_object_or_id->ID();
293
        }
294
        if (! $model_object_id) {
295
            throw new EE_Error(sprintf(__("Sorry, we cant get the related %s model objects to %s model object before it has an ID. You can solve that by just saving it before trying to get its related model objects",
296
                "event_espresso"), $this->get_other_model()->get_this_model_name(),
297
                $this->get_this_model()->get_this_model_name()));
298
        }
299
        return $model_object_id;

core/libraries/rest_api/controllers/model/Read.php 1 location

@@ 425-432 (lines=8) @@
422
     */
423
    public function get_entities_from_relation($id, $relation, $request)
424
    {
425
        if (! $relation->get_this_model()->has_primary_key_field()) {
426
            throw new \EE_Error(
427
                sprintf(
428
                    __('Read::get_entities_from_relation should only be called from a model with a primary key, it was called from %1$s',
429
                        'event_espresso'),
430
                    $relation->get_this_model()->get_this_model_name()
431
                )
432
            );
433
        }
434
        return $this->_get_entities_from_relation(
435
            array(