Author: weaverryan
Date: 2010-02-08 02:17:52 +0100 (Mon, 08 Feb 2010)
New Revision: 27689
Modified:
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentTable.class.php
Log:
[1.4][sfSympalPlugin][1.0] Breaking the published portion of the query into a
separate function so that it can be used independently in other places.
Modified:
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentTable.class.php
===================================================================
---
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentTable.class.php
2010-02-08 00:47:53 UTC (rev 27688)
+++
plugins/sfSympalPlugin/trunk/lib/model/doctrine/PluginsfSympalContentTable.class.php
2010-02-08 01:17:52 UTC (rev 27689)
@@ -168,8 +168,7 @@
if (!$user->hasCredential('ManageContent'))
{
- $expr = new Doctrine_Expression('NOW()');
- $q->andWhere($alias.'.date_published <= '.$expr);
+ $q = $this->addPublishedQuery($alias, $q);
}
if (sfSympalConfig::isI18nEnabled('sfSympalContentSlot'))
@@ -192,4 +191,23 @@
return $q;
}
+
+ /**
+ * Adds the necessary where clause to only return published content
+ *
+ * @param string $alias The alias to use to refer to
sfSympalContent
+ * @param Doctrine_Query $q An optional query to add to
+ */
+ public function addPublishedQuery($alias = 'c', Doctrine_Query $q = null)
+ {
+ if ($q === null)
+ {
+ $q = $this->createQuery($alias);
+ }
+
+ $expr = new Doctrine_Expression('NOW()');
+ $q->andWhere($alias.'.date_published <= '.$expr);
+
+ 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.