Author: david
Date: Wed Nov 18 15:03:43 2009
New Revision: 3914
Log:
Special conditions for function language and script getters/setters (copied
from QubitInformationObject).
Modified:
trunk/lib/model/QubitFunction.php
Modified: trunk/lib/model/QubitFunction.php
==============================================================================
--- trunk/lib/model/QubitFunction.php Wed Nov 18 13:45:04 2009 (r3913)
+++ trunk/lib/model/QubitFunction.php Wed Nov 18 15:03:43 2009 (r3914)
@@ -23,4 +23,83 @@
{
return $this->getAuthorizedFormOfName(array('cultureFallback' => true));
}
+
+ public function __get($name)
+ {
+ $args = func_get_args();
+
+ $options = array();
+ if (1 < count($args))
+ {
+ $options = $args[1];
+ }
+
+ switch ($name)
+ {
+ case 'language':
+ case 'script':
+
+ if (!isset($this->values[$name]))
+ {
+ $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;
+ }
+
+ return call_user_func_array(array($this, 'BaseFunction::__get'), $args);
+ }
+
+ public function __set($name, $value)
+ {
+ $args = func_get_args();
+
+ $options = array();
+ if (2 < count($args))
+ {
+ $options = $args[2];
+ }
+
+ switch ($name)
+ {
+ case 'language':
+ case 'script':
+
+ if (!isset($this->values[$name]))
+ {
+ $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[] = $this->values[$name];
+ }
+ }
+
+ $this->values[$name]->__set('value', serialize($value), $options +
array('sourceCulture' => true));
+
+ return $this;
+ }
+
+ return call_user_func_array(array($this, 'BaseFunction::__set'), $args);
+ }
}
--
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.com/group/qubit-commits?hl=.