mirror of
				https://github.com/yiisoft/yii2.git
				synced 2025-11-01 03:26:36 +08:00 
			
		
		
		
	| @ -44,7 +44,6 @@ Yii Framework 2 Change Log | ||||
| - Bug #16377: Fixed `yii\base\Event:off()` undefined index error when event handler does not match (razvanphp) | ||||
| - Bug #16514: Fixed `yii\di\Container::resolveCallableDependencies` to support callable object (wi1dcard) | ||||
| - Bug #15889: Fixed override `yii\helpers\Html::setActivePlaceholder` (lesha724) | ||||
| - Bug #16552: Added check in `yii\db\ActiveQuery::prepare()` to prevent populating already populated relation when another relation is requested with `via` (drlibra) | ||||
| - Enh #16522: Allow jQuery 3.3 (Slamdunk) | ||||
| - Enh #16603: Added `yii\mutex\FileMutex::$isWindows` for Windows file shares on Unix guest machines (brandonkelly) | ||||
| - Bug #16666: Fixed `yii\helpers\ArrayHelper::merge` (rustamwin) | ||||
|  | ||||
| @ -238,9 +238,7 @@ yii.validation = (function ($) { | ||||
|  | ||||
|         trim: function ($form, attribute, options, value) { | ||||
|             var $input = $form.find(attribute.input); | ||||
|             var isCheckAble = $input.find('[type=radio]').is('[type=radio]') || $input.find('[type=checkbox]').is('[type=checkbox]'); | ||||
|  | ||||
|             if (!isCheckAble) { | ||||
|             if ($input.is(':checkbox, :radio')) { | ||||
|                 return value; | ||||
|             } | ||||
|  | ||||
|  | ||||
| @ -172,19 +172,11 @@ class ActiveQuery extends Query implements ActiveQueryInterface | ||||
|                 /* @var $viaQuery ActiveQuery */ | ||||
|                 list($viaName, $viaQuery) = $this->via; | ||||
|                 if ($viaQuery->multiple) { | ||||
|                     if ($this->primaryModel->isRelationPopulated($viaName)) { | ||||
|                         $viaModels = $this->primaryModel->$viaName; | ||||
|                     } else { | ||||
|                         $viaModels = $viaQuery->all(); | ||||
|                         $this->primaryModel->populateRelation($viaName, $viaModels); | ||||
|                     } | ||||
|                     $viaModels = $viaQuery->all(); | ||||
|                     $this->primaryModel->populateRelation($viaName, $viaModels); | ||||
|                 } else { | ||||
|                     if ($this->primaryModel->isRelationPopulated($viaName)) { | ||||
|                         $model = $this->primaryModel->$viaName; | ||||
|                     } else { | ||||
|                         $model = $viaQuery->one(); | ||||
|                         $this->primaryModel->populateRelation($viaName, $model); | ||||
|                     } | ||||
|                     $model = $viaQuery->one(); | ||||
|                     $this->primaryModel->populateRelation($viaName, $model); | ||||
|                     $viaModels = $model === null ? [] : [$model]; | ||||
|                 } | ||||
|                 $this->filterByModels($viaModels); | ||||
|  | ||||
| @ -523,7 +523,7 @@ class Container extends Component | ||||
|     { | ||||
|         if (is_array($callback)) { | ||||
|             $reflection = new \ReflectionMethod($callback[0], $callback[1]); | ||||
|         } elseif (is_object($callback)) { | ||||
|         } elseif (is_object($callback) && !$callback instanceof \Closure) { | ||||
|             $reflection = new \ReflectionMethod($callback, '__invoke'); | ||||
|         } else { | ||||
|             $reflection = new \ReflectionFunction($callback); | ||||
|  | ||||
| @ -1214,6 +1214,9 @@ describe('yii.validation', function () { | ||||
|         var $input = { | ||||
|             val: function () { | ||||
|                 return getInputVal(); | ||||
|             }, | ||||
|             is: function () { | ||||
|                 return false; | ||||
|             } | ||||
|         }; | ||||
|         var $form = { | ||||
| @ -1274,6 +1277,32 @@ describe('yii.validation', function () { | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     describe('trim filter on checkbox', function () { | ||||
|         var attribute = {input: '#input-id'}; | ||||
|         var getInputVal; | ||||
|         var $checkbox = { | ||||
|             is: function (selector) { | ||||
|                 if (selector === ':checked') { | ||||
|                     return true; | ||||
|                 } | ||||
|  | ||||
|                 if (selector === ':checkbox, :radio') { | ||||
|                     return true; | ||||
|                 } | ||||
|             } | ||||
|         }; | ||||
|         var $form = { | ||||
|             find: function () { | ||||
|                 return $checkbox; | ||||
|             } | ||||
|         }; | ||||
|  | ||||
|  | ||||
|         it('should be left as is', function () { | ||||
|             assert.strictEqual(yii.validation.trim($form, attribute, {}, true), true); | ||||
|         }); | ||||
|     }); | ||||
|  | ||||
|     describe('captcha validator', function () { | ||||
|         // Converted using yii\captcha\CaptchaAction generateValidationHash() method | ||||
|         var hashes = {'Code': 379, 'code': 411}; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Alexander Makarov
					Alexander Makarov