Code Duplication    Length = 5-8 lines in 2 locations

src/api/user.php 1 location

@@ 198-202 (lines=5) @@
195
            'authtype' => $this->authtype
196
        );
197
198
        if ($this->id) {
199
            $parameters['id'] = $this->id;
200
            $conditions->add($qb->expr()->neq('c.id', ':id'));
201
        }
202
        $conditions->add($qb->expr()->eq('c.login', ':login'));
203
        $conditions->add($qb->expr()->eq('c.authtype', ':authtype'));
204
205
        $qb->where($conditions)

src/api/object.php 1 location

@@ 270-277 (lines=8) @@
267
        $qb = connection::get_em()->createQueryBuilder();
268
        $qb->from(get_class($this), 'c');
269
        $conditions = $qb->expr()->andX();
270
        if ($this->id) {
271
            $parameters = array(
272
                'id' => $this->id
273
            );
274
            $conditions->add($qb->expr()->neq('c.id', ':id'));
275
        }
276
        $found = false;
277
        foreach ($this->cm->midgard['unique_fields'] as $field) {
278
            if (empty($this->$field)) {
279
                //empty names automatically pass according to Midgard logic
280
                continue;