Code Duplication    Length = 23-24 lines in 2 locations

src/voku/db/ActiveRecord.php 2 locations

@@ 274-297 (lines=24) @@
271
   *                     otherwise return "false".
272
   *                     </p>
273
   */
274
  public function fetch($id = null)
275
  {
276
    if ($id) {
277
      $this->reset()->eq($this->primaryKeyName, $id);
278
    }
279
280
    return self::query(
281
        $this->limit(1)->_buildSql(
282
            array(
283
                'select',
284
                'from',
285
                'join',
286
                'where',
287
                'group',
288
                'having',
289
                'order',
290
                'limit',
291
            )
292
        ),
293
        $this->params,
294
        $this->reset(),
295
        true
296
    );
297
  }
298
299
  /**
300
   * @param string $query
@@ 442-464 (lines=23) @@
439
   *
440
   * @return $this[]
441
   */
442
  public function fetchAll(array $ids = null)
443
  {
444
    if ($ids) {
445
      $this->reset()->in($this->primaryKeyName, $ids);
446
    }
447
448
    return self::query(
449
        $this->_buildSql(
450
            array(
451
                'select',
452
                'from',
453
                'join',
454
                'where',
455
                'group',
456
                'having',
457
                'order',
458
                'limit',
459
            )
460
        ),
461
        $this->params,
462
        $this->reset()
463
    );
464
  }
465
466
  /**
467
   * Function to delete current record in database.