Code Duplication    Length = 6-6 lines in 2 locations

src/api/mgdobject.php 2 locations

@@ 301-306 (lines=6) @@
298
299
        if (!empty($this->cm->midgard['upfield'])) {
300
            // TODO: This needs to be changed so that value is always numeric, since this is how midgard does it
301
            if ($this->{$this->cm->midgard['upfield']} === null) {
302
                $conditions->add($qb->expr()->isNull('c.' . $this->cm->midgard['upfield']));
303
            } else {
304
                $conditions->add($qb->expr()->eq('c.' . $this->cm->midgard['upfield'], ':' . $this->cm->midgard['upfield']));
305
                $parameters[$this->cm->midgard['upfield']] = $this->{$this->cm->midgard['upfield']};
306
            }
307
        } elseif (!empty($this->cm->midgard['parentfield'])) {
308
            // TODO: This needs to be changed so that value is always numeric, since this is how midgard does it
309
            if ($this->{$this->cm->midgard['parentfield']} === null) {
@@ 309-314 (lines=6) @@
306
            }
307
        } elseif (!empty($this->cm->midgard['parentfield'])) {
308
            // TODO: This needs to be changed so that value is always numeric, since this is how midgard does it
309
            if ($this->{$this->cm->midgard['parentfield']} === null) {
310
                $conditions->add($qb->expr()->isNull('c.' . $this->cm->midgard['parentfield']));
311
            } else {
312
                $conditions->add($qb->expr()->eq('c.' . $this->cm->midgard['parentfield'], ':' . $this->cm->midgard['parentfield']));
313
                $parameters[$this->cm->midgard['parentfield']] = $this->{$this->cm->midgard['parentfield']};
314
            }
315
        }
316
        $qb->where($conditions)
317
            ->setParameters($parameters);