Author: Leon.van.der.Ree
Date: 2010-03-24 09:57:54 +0100 (Wed, 24 Mar 2010)
New Revision: 28753

Modified:
   plugins/sfDataSourcePlugin/trunk/lib/sfDataSourcePropel.class.php
Log:
bugfix sfDataSourcePropelPlugin reducing count-query count

Modified: plugins/sfDataSourcePlugin/trunk/lib/sfDataSourcePropel.class.php
===================================================================
--- plugins/sfDataSourcePlugin/trunk/lib/sfDataSourcePropel.class.php   
2010-03-24 08:03:16 UTC (rev 28752)
+++ plugins/sfDataSourcePlugin/trunk/lib/sfDataSourcePropel.class.php   
2010-03-24 08:57:54 UTC (rev 28753)
@@ -240,15 +240,15 @@
    */
   public function count()
   {
-    if ($this->query)
+    // count (to be) loaded data
+    // else number of count-queries would be enormous, while the result would 
be the same
+    if (!$this->isDataLoaded())
     {
-      $count = $this->query->count();
+      $this->loadData();
     }
-    else
-    {
-      $count = count($this->data);
-    }
 
+    $count = count($this->data);
+    
     // if this object has been initialized with a PropelCollection, we need
     // to subtract the offset from the object count manually
     if (!$this->query)

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" 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/symfony-svn?hl=en.

Reply via email to