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/mgdobject.php 1 location

@@ 278-285 (lines=8) @@
275
        $qb = connection::get_em()->createQueryBuilder();
276
        $qb->from(get_class($this), 'c');
277
        $conditions = $qb->expr()->andX();
278
        if ($this->id) {
279
            $parameters = [
280
                'id' => $this->id
281
            ];
282
            $conditions->add($qb->expr()->neq('c.id', ':id'));
283
        }
284
        $found = false;
285
        foreach ($this->cm->midgard['unique_fields'] as $field) {
286
            if (empty($this->$field)) {
287
                //empty names automatically pass according to Midgard logic
288
                continue;