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

@@ 513-520 (lines=8) @@
510
     */
511
    public function getEntitiesFromRelation($id, $relation, $request)
512
    {
513
        if (! $relation->get_this_model()->has_primary_key_field()) {
514
            throw new EE_Error(
515
                sprintf(
516
                    __(
517
                        // @codingStandardsIgnoreStart
518
                        'Read::get_entities_from_relation should only be called from a model with a primary key, it was called from %1$s',
519
                        // @codingStandardsIgnoreEnd
520
                        'event_espresso'
521
                    ),
522
                    $relation->get_this_model()->get_this_model_name()
523
                )