Author: weaverryan
Date: 2010-02-09 04:55:33 +0100 (Tue, 09 Feb 2010)
New Revision: 27773

Modified:
   
plugins/sfSympalTagsPlugin/branches/1.4/lib/model/doctrine/PluginsfSympalTagTable.class.php
Log:
[1.4][sfSympalTagsPlugin][1.0] Reworking this method which is used by 
sfSympalBlogPlugin (but could be used by anything) to use a better query and 
also to return only a query (which is more versatile).


Modified: 
plugins/sfSympalTagsPlugin/branches/1.4/lib/model/doctrine/PluginsfSympalTagTable.class.php
===================================================================
--- 
plugins/sfSympalTagsPlugin/branches/1.4/lib/model/doctrine/PluginsfSympalTagTable.class.php
 2010-02-09 03:52:26 UTC (rev 27772)
+++ 
plugins/sfSympalTagsPlugin/branches/1.4/lib/model/doctrine/PluginsfSympalTagTable.class.php
 2010-02-09 03:55:33 UTC (rev 27773)
@@ -131,22 +131,17 @@
    * @param string $contentType The name of the content type (e.g. 
sfSympalBlogPost)
    * @param string $tag         A string tag to match on the content objects
    */
-  public function retrieveContentByTag($contentType, $tag)
+  public function getContentQueryByTag($contentType, $tag)
   {
-    $q = Doctrine_Core::getTable('sfSympalContent')->createQuery('a')
-      ->from('sfSympalContent a')
-      ->innerJoin('a.ContentTags ct')
+    $q = Doctrine::getTable('sfSympalContent')
+      ->getTypeQuery($contentType)
+      ->innerJoin('c.ContentTags ct')
       ->innerJoin('ct.Tag t')
-      ->innerJoin('a.Type t2')
-      ->where('t2.name = ?', $contentType)
-      ->andWhere('t.name = ?', $tag);
+      ->where('t.name = ?', $tag);
     
-    $q = Doctrine_Core::getTable('sfSympalContent')->addPublishedQuery('a', 
$q);
     
-    $pager = new sfDoctrinePager('sfSympalContent', 
sfSympalConfig::get('rows_per_page'));
-    $pager->setQuery($q);
-    $pager->init();
+    $q = Doctrine_Core::getTable('sfSympalContent')->addPublishedQuery('c', 
$q);
     
-    return $pager;
+    return $q;
   }
 }
\ No newline at end of file

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