Author: sevein
Date: Thu Jun  7 11:08:53 2012
New Revision: 11746

Log:
Use ->limit to limit number of results

Modified:
   trunk/apps/qubit/modules/term/actions/autocompleteAction.class.php

Modified: trunk/apps/qubit/modules/term/actions/autocompleteAction.class.php
==============================================================================
--- trunk/apps/qubit/modules/term/actions/autocompleteAction.class.php  Thu Jun 
 7 00:02:55 2012        (r11745)
+++ trunk/apps/qubit/modules/term/actions/autocompleteAction.class.php  Thu Jun 
 7 11:08:53 2012        (r11746)
@@ -60,7 +60,7 @@
       // Sort by name
       $criteria->addAscendingOrderByColumn(QubitTermI18n::NAME);
 
-      $criteria->setLimit(10);
+      $criteria->setLimit($request->limit);
 
       $this->terms = QubitTerm::get($criteria);
     }
@@ -92,10 +92,10 @@
       }
 
       $connection = Propel::getConnection();
-      $statement = $connection->prepare("($s1) UNION ALL ($s2) ORDER BY name 
LIMIT 10");
+      $statement = $connection->prepare("($s1) UNION ALL ($s2) ORDER BY name 
LIMIT :p4");
       $params = 
$this->context->routing->parse(Qubit::pathInfo($request->taxonomy));
-      $statement->bindValue(':p1', $params['_sf_route']->resource->id);
 
+      $statement->bindValue(':p1', $params['_sf_route']->resource->id);
       $statement->bindValue(':p2', $this->context->user->getCulture());
 
       if (isset($request->query))
@@ -103,6 +103,8 @@
         $statement->bindValue(':p3', "$request->query%");
       }
 
+      $statement->bindValue(':p4', (int) $request->limit, PDO::PARAM_INT);
+
       $statement->execute();
 
       $this->terms = array();

-- 
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/qubit-commits?hl=en.

Reply via email to