Code Duplication    Length = 6-6 lines in 2 locations

src/api/object.php 2 locations

@@ 284-289 (lines=6) @@
281
282
        if (!empty($this->cm->midgard['upfield'])) {
283
            // TODO: This needs to be changed so that value is always numeric, since this is how midgard does it
284
            if ($this->{$this->cm->midgard['upfield']} === null) {
285
                $conditions->add($qb->expr()->isNull('c.' . $this->cm->midgard['upfield']));
286
            } else {
287
                $conditions->add($qb->expr()->eq('c.' . $this->cm->midgard['upfield'], ':' . $this->cm->midgard['upfield']));
288
                $parameters[$this->cm->midgard['upfield']] = $this->{$this->cm->midgard['upfield']};
289
            }
290
        } elseif (!empty($this->cm->midgard['parentfield'])) {
291
            // TODO: This needs to be changed so that value is always numeric, since this is how midgard does it
292
            if ($this->{$this->cm->midgard['parentfield']} === null) {
@@ 292-297 (lines=6) @@
289
            }
290
        } elseif (!empty($this->cm->midgard['parentfield'])) {
291
            // TODO: This needs to be changed so that value is always numeric, since this is how midgard does it
292
            if ($this->{$this->cm->midgard['parentfield']} === null) {
293
                $conditions->add($qb->expr()->isNull('c.' . $this->cm->midgard['parentfield']));
294
            } else {
295
                $conditions->add($qb->expr()->eq('c.' . $this->cm->midgard['parentfield'], ':' . $this->cm->midgard['parentfield']));
296
                $parameters[$this->cm->midgard['parentfield']] = $this->{$this->cm->midgard['parentfield']};
297
            }
298
        }
299
        $qb->where($conditions)
300
            ->setParameters($parameters);