Code Duplication    Length = 7-7 lines in 2 locations

src/api/object.php 2 locations

@@ 450-456 (lines=7) @@
447
            $qb = $this->get_uniquefield_query($parentclass, $field, $part, $parentfield, $up);
448
            $qb->select("c.id");
449
            $up = intval($qb->getQuery()->getOneOrNullResult(Query::HYDRATE_SINGLE_SCALAR));
450
            if ($up === 0) {
451
                exception::not_exists();
452
                $this->id = 0;
453
                $this->set_guid('');
454
                return false;
455
            }
456
        }
457
458
        $qb = $this->get_uniquefield_query(get_class($this), $field, $name, $upfield, $up);
459
        $qb->select("c");
@@ 463-469 (lines=7) @@
460
461
        $entity = $qb->getQuery()->getOneOrNullResult();
462
463
        if ($entity === null) {
464
            exception::not_exists();
465
            $this->id = 0;
466
            $this->set_guid('');
467
            return false;
468
        }
469
        $this->populate_from_entity($entity);
470
471
        return true;
472
    }