Fixed duplicate row entries and other paginate issues. The fix might be a hack, but it works for now.

git-svn-id: file:///svn-source/pmgr/branches/initial_20090526/site@23 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-05-28 09:07:53 +00:00
parent 3288969b0d
commit e772ff8755
2 changed files with 27 additions and 7 deletions

View File

@@ -72,5 +72,18 @@ class Contact extends AppModel {
),
);
// Overriding pagination, since the controller using HABTM joins that
// result in duplicate rows. This may not be the best way to handle
// things (especially if the query return a really large number of rows,
// but it does seem to work.
function paginate($conditions, $fields, $order, $limit, $page = 1, $recursive = null) {
$conditions[] ="1=1 GROUP BY Contact.id";
return $this->findAll($conditions, $fields, $order, $limit, $page, $recursive);
}
function paginateCount($conditions = null, $recursive = 0) {
$rows = $this->paginate($conditions, null, null, null, null, $recursive);
return count($rows);
}
}
?>