Author: jablko
Date: Wed Sep  9 13:09:05 2009
New Revision: 3204

Log:
Keep reference to language and script properties in information object, makes 
failing test pass

Modified:
   trunk/lib/model/QubitInformationObject.php

Modified: trunk/lib/model/QubitInformationObject.php
==============================================================================
--- trunk/lib/model/QubitInformationObject.php  Wed Sep  9 12:01:50 2009        
(r3203)
+++ trunk/lib/model/QubitInformationObject.php  Wed Sep  9 13:09:05 2009        
(r3204)
@@ -64,13 +64,22 @@
       case 'languageOfDescription':
       case 'script':
       case 'scriptOfDescription':
-        $criteria = new Criteria;
-        $this->addPropertysCriteria($criteria);
-        $criteria->add(QubitProperty::NAME, $name);
 
-        if (1 == count($query = QubitProperty::get($criteria)))
+        if (!isset($this->values[$name]))
         {
-          return unserialize($query[0]->__get('value', $options + 
array('sourceCulture' => true)));
+          $criteria = new Criteria;
+          $this->addPropertysCriteria($criteria);
+          $criteria->add(QubitProperty::NAME, $name);
+
+          if (1 == count($query = QubitProperty::get($criteria)))
+          {
+            $this->values[$name] = $query[0];
+          }
+        }
+
+        if (isset($this->values[$name]))
+        {
+          return unserialize($this->values[$name]->__get('value', $options + 
array('sourceCulture' => true)));
         }
 
         return;
@@ -95,22 +104,26 @@
       case 'languageOfDescription':
       case 'script':
       case 'scriptOfDescription':
-        $criteria = new Criteria;
-        $this->addPropertysCriteria($criteria);
-        $criteria->add(QubitProperty::NAME, $name);
 
-        if (1 == count($query = QubitProperty::get($criteria)))
+        if (!isset($this->values[$name]))
         {
-          $property = $query[0];
-        }
-        else
-        {
-          $property = new QubitProperty;
-          $property->name = $name;
-          $this->propertys[] = $property;
+          $criteria = new Criteria;
+          $this->addPropertysCriteria($criteria);
+          $criteria->add(QubitProperty::NAME, $name);
+
+          if (1 == count($query = QubitProperty::get($criteria)))
+          {
+            $this->values[$name] = $query[0];
+          }
+          else
+          {
+            $this->values[$name] = new QubitProperty;
+            $this->values[$name]->name = $name;
+            $this->propertys[] = $property;
+          }
         }
 
-        $property->__set('value', serialize($value), $options + 
array('sourceCulture' => true));
+        $this->values[$name]->__set('value', serialize($value), $options + 
array('sourceCulture' => true));
 
         return $this;
     }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" 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.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to