From: <gem...@li...> - 2011-11-18 11:26:06
|
Revision: 234 http://gemstracker.svn.sourceforge.net/gemstracker/?rev=234&view=rev Author: matijsdejong Date: 2011-11-18 11:26:00 +0000 (Fri, 18 Nov 2011) Log Message: ----------- Bug in handling whenNew items. Made code more readable. Modified Paths: -------------- trunk/library/classes/Gems/Auth.php trunk/library/classes/MUtil/Model/ModelAbstract.php Modified: trunk/library/classes/Gems/Auth.php =================================================================== --- trunk/library/classes/Gems/Auth.php 2011-11-18 09:34:55 UTC (rev 233) +++ trunk/library/classes/Gems/Auth.php 2011-11-18 11:26:00 UTC (rev 234) @@ -93,7 +93,8 @@ private function _error($code, $value1 = null, $value2 = null) { $messages = func_get_args(); - array_splice($messages, 0, 1, $this->_messageTemplates[$code]); + // array_splice($messages, 0, 1, $this->_messageTemplates[$code]); + $messages[0] = $this->_messageTemplates[$code]; return new Zend_Auth_Result($code, null, (array) $messages); } Modified: trunk/library/classes/MUtil/Model/ModelAbstract.php =================================================================== --- trunk/library/classes/MUtil/Model/ModelAbstract.php 2011-11-18 09:34:55 UTC (rev 233) +++ trunk/library/classes/MUtil/Model/ModelAbstract.php 2011-11-18 11:26:00 UTC (rev 234) @@ -660,11 +660,11 @@ { if ($call = $this->get($name, self::SAVE_TRANSFORMER)) { - if (is_callable($call)) { - $value = call_user_func($call, $value, $new, $name, $context); - } else { - $value = $call; - } + if (is_callable($call)) { + $value = call_user_func($call, $value, $new, $name, $context); + } else { + $value = $call; + } } return $value; @@ -812,7 +812,7 @@ if ($test = $this->get($name, self::SAVE_WHEN_TEST)) { if (is_callable($test)) { - return call_user_func($test, $name, $value, $new); + return call_user_func($test, $value, $new, $name, $context); } return $test; @@ -1263,7 +1263,7 @@ public function setSaveWhenNew($name) { $this->setAutoSave($name); - return $this->setSaveWhen($name, array(__CLASS__, 'whenNotNew')); + return $this->setSaveWhen($name, array(__CLASS__, 'whenNew')); } /** @@ -1318,9 +1318,9 @@ * @param array $context Optional, the other values being saved * @return boolean */ - public static function whenNotNew($value, $isNew = false, $name = null, array $context = array()) + public static function whenNew($value, $isNew = false, $name = null, array $context = array()) { - return $new; + return $isNew; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |