[pLog-svn] r6465 - plog/trunk/class/dao
mark at devel.lifetype.net
mark at devel.lifetype.net
Wed May 14 03:38:00 EDT 2008
Author: mark
Date: 2008-05-14 03:38:00 -0400 (Wed, 14 May 2008)
New Revision: 6465
Modified:
plog/trunk/class/dao/articles.class.php
Log:
Implement _getBlogArticlesFromQuery($query ), it is easier for developer of get articles from their own query
Modified: plog/trunk/class/dao/articles.class.php
===================================================================
--- plog/trunk/class/dao/articles.class.php 2008-05-14 07:34:40 UTC (rev 6464)
+++ plog/trunk/class/dao/articles.class.php 2008-05-14 07:38:00 UTC (rev 6465)
@@ -198,6 +198,37 @@
}
/**
+ * @private
+ */
+ function _getBlogArticlesFromQuery($query )
+ {
+ // we send the query and then fetch the first array with the result
+ $result = $this->Execute( $query );
+
+ if( $result == false )
+ return false;
+
+ if ( $result->RecordCount() == 0){
+ $result->Close();
+ return false;
+ }
+
+ $articles = Array();
+ while( $row = $result->FetchRow()) {
+ // map the row to an object
+ $article = $this->mapRow( $row );
+ $articles[] = $article;
+ // and cache it for later use, we might need it
+ $this->_cache->setData( $article->getId(), DaoCacheConstants::CACHE_ARTICLES, $article );
+ $this->_cache->setMultipleData( $article->getPostSlug(), DaoCacheConstants::CACHE_ARTICLES_BYNAME, $article );
+ }
+
+ $result->Close();
+
+ return $articles;
+ }
+
+ /**
* Returns the article that goes after the one we give as the parameter.
*
* @param article An article object
More information about the pLog-svn
mailing list