yii2 icon indicating copy to clipboard operation
yii2 copied to clipboard

Update UniqueValidator.php

Open WinterSilence opened this issue 3 years ago • 4 comments

Q A
Is bugfix? ✔️
New feature?
Breaks BC? ✔️/❌
Fixed issues #19407

WinterSilence avatar May 28 '22 11:05 WinterSilence

I don't see how your solution is addressing the problem in any way.

bizley avatar May 29 '22 13:05 bizley

@bizley your tests not correct: 1.when passed more than one attribute, then need check they together BEFORE call validateAttribute() because they using together to generate SQL i.e. error in ANY attribute can fail execution 2. you call validateAttribute() instead validateAttributes() i.e. skip check skipOnError and skipOnEmpty and it's fake test: https://github.com/yiisoft/yii2/pull/19409/files#diff-558153fc1165cfc96b7b9bef56fcf62d67f049ae2fec7165e77561040b9ce360R523 3. you not set required attributes property using in validateAttributes() https://github.com/yiisoft/yii2/blob/14369f0a517efed333d69d44fc84eb8f4a5b1907/framework/validators/Validator.php#L248 4. you ignore property $targetClass i.e. you fix generate invalid query in case like this: [['foo', 'bar'], 'unique', 'targetClass' => Model::class, 'targetAttribute' => ['foo_id' => 'foo', 'bar_id' => 'bar']],

WinterSilence avatar Jun 01 '22 07:06 WinterSilence

As I explained in details already in my fix attempt for this issue I stand behind my version.

bizley avatar Jun 01 '22 09:06 bizley

Thank you for putting effort in the improvement of the Yii framework. We have reviewed your pull request.

In order for the framework and your solution to remain stable in the future, we have a unit test requirement in place. Therefore we can only accept your pull request if it is covered by unit tests.

Could you add these please?

Thanks!

P.S. If you have any questions about the creation of unit tests? Don't hesitate to ask for support. More information about unit tests

This is an automated comment, triggered by adding the label pr:request for unit tests.

yii-bot avatar Jun 01 '22 09:06 yii-bot