Code Duplication    Length = 7-7 lines in 2 locations

src/api/mgdobject.php 2 locations

@@ 494-500 (lines=7) @@
491
            $qb = $this->get_uniquefield_query($parentclass, $field, $part, $parentfield, $up);
492
            $qb->select("c.id");
493
            $up = intval($qb->getQuery()->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR));
494
            if ($up === 0) {
495
                exception::not_exists();
496
                $this->id = 0;
497
                $this->set_guid('');
498
                return false;
499
            }
500
        }
501
502
        $qb = $this->get_uniquefield_query(get_class($this), $field, $name, $upfield, $up);
503
        $qb->select("c");
@@ 507-513 (lines=7) @@
504
505
        $entity = $qb->getQuery()->getOneOrNullResult();
506
507
        if ($entity === null) {
508
            exception::not_exists();
509
            $this->id = 0;
510
            $this->set_guid('');
511
            return false;
512
        }
513
        $this->populate_from_entity($entity);
514
515
        return true;
516
    }