Code Duplication    Length = 6-6 lines in 2 locations

class/object.php 1 location

@@ 259-264 (lines=6) @@
256
            }
257
        }
258
        $sql = 'SELECT ' . $field . 'COUNT(*) FROM ' . $this->table;
259
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
260
            $sql .= ' ' . $criteria->renderWhere();
261
            if ($criteria->groupby != '') {
262
                $sql .= $criteria->getGroupby();
263
            }
264
        }
265
        $result = $this->db->query($sql);
266
        if (!$result) {
267
            return 0;

class/partner.php 1 location

@@ 1031-1036 (lines=6) @@
1028
    public function getCount(CriteriaElement $criteria = null)
1029
    {
1030
        $sql = 'SELECT COUNT(*) FROM ' . $this->table;
1031
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1032
            $whereClause = $criteria->renderWhere();
1033
            if ($whereClause !== 'WHERE ()') {
1034
                $sql .= ' ' . $criteria->renderWhere();
1035
            }
1036
        }
1037
1038
        //echo "<br>" . $sql . "<br>";
1039
        $result = $this->db->query($sql);