Code Duplication    Length = 6-6 lines in 2 locations

src/api/object.php 2 locations

@@ 293-298 (lines=6) @@
290
291
        if (!empty($this->cm->midgard['upfield'])) {
292
            // TODO: This needs to be changed so that value is always numeric, since this is how midgard does it
293
            if ($this->{$this->cm->midgard['upfield']} === null) {
294
                $conditions->add($qb->expr()->isNull('c.' . $this->cm->midgard['upfield']));
295
            } else {
296
                $conditions->add($qb->expr()->eq('c.' . $this->cm->midgard['upfield'], ':' . $this->cm->midgard['upfield']));
297
                $parameters[$this->cm->midgard['upfield']] = $this->{$this->cm->midgard['upfield']};
298
            }
299
        } elseif (!empty($this->cm->midgard['parentfield'])) {
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['parentfield']} === null) {
@@ 301-306 (lines=6) @@
298
            }
299
        } elseif (!empty($this->cm->midgard['parentfield'])) {
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['parentfield']} === null) {
302
                $conditions->add($qb->expr()->isNull('c.' . $this->cm->midgard['parentfield']));
303
            } else {
304
                $conditions->add($qb->expr()->eq('c.' . $this->cm->midgard['parentfield'], ':' . $this->cm->midgard['parentfield']));
305
                $parameters[$this->cm->midgard['parentfield']] = $this->{$this->cm->midgard['parentfield']};
306
            }
307
        }
308
        $qb->where($conditions)
309
            ->setParameters($parameters);