[pLog-svn] r6288 - plog/trunk/class/dao

mark at devel.lifetype.net mark at devel.lifetype.net
Tue Apr 1 05:22:32 EDT 2008


Author: mark
Date: 2008-04-01 05:22:32 -0400 (Tue, 01 Apr 2008)
New Revision: 6288

Modified:
   plog/trunk/class/dao/article.class.php
Log:
Fixed the _categoryIds is unchanged when we set the _categories array.

Modified: plog/trunk/class/dao/article.class.php
===================================================================
--- plog/trunk/class/dao/article.class.php	2008-04-01 02:05:43 UTC (rev 6287)
+++ plog/trunk/class/dao/article.class.php	2008-04-01 09:22:32 UTC (rev 6288)
@@ -233,11 +233,11 @@
         function getCategories()
         {
         	if( $this->_categories == null ) {
-        		        			
-				$categories = new ArticleCategories();
+				$this->_categories = array();
+                $categories = new ArticleCategories();
         		foreach( $this->getCategoryIds() as $categoryId ) {
         			if(( $category = $categories->getCategory( $categoryId )))
-	        			$this->_categories[] = $category;
+	        			array_push( $this->_categories, $category);
         		}
         	}
         	
@@ -531,6 +531,7 @@
 		function setCategoryIds( $newCategories )
 		{
 			$this->_categoryIds = $newCategories;
+			$this->_categories = null;
 		}
 
         /**
@@ -539,6 +540,11 @@
         function setCategories( $categories )
         {
         	$this->_categories = $categories;
+        	$this->_categoryIds = array();
+        	foreach( $categories as $category )
+        	{
+        	   array_push( $this->_categoryIds, $category->getId() );
+            }
         }
 
         /**
@@ -1155,4 +1161,4 @@
 			$this->_inSummary = $inSummary;
 		}
 	}
-?>
\ No newline at end of file
+?>



More information about the pLog-svn mailing list