Author: david
Date: Wed Nov  9 15:12:01 2011
New Revision: 10299

Log:
Test for valid slug when matching parameters. Fixes issue 2161

Modified:
   trunk/lib/QubitResourceRoute.class.php

Modified: trunk/lib/QubitResourceRoute.class.php
==============================================================================
--- trunk/lib/QubitResourceRoute.class.php      Wed Nov  9 14:24:46 2011        
(r10298)
+++ trunk/lib/QubitResourceRoute.class.php      Wed Nov  9 15:12:01 2011        
(r10299)
@@ -26,11 +26,23 @@
     $criteria->addJoin(QubitSlug::OBJECT_ID, QubitObject::ID);
 
     $this->resource = QubitObject::get($criteria)->__get(0);
-    if (@$params['throw404'] == false && !isset($this->resource))
+
+    return parent::bind($context, $params);
+  }
+
+  public function matchesParameters($params, $context = array())
+  {
+    if (isset($params['slug']))
     {
-      throw new sfError404Exception;
+      $criteria = new Criteria;
+      $criteria->add(QubitSlug::SLUG, $params['slug']);
+
+      if (null === QubitSlug::getOne($criteria))
+      {
+        return false;
+      }
     }
 
-    return parent::bind($context, $params);
+    return parent::matchesParameters($this->filterParams($params), $context);
   }
 }

-- 
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