ElisDN / yii2-demo-shop

Source code for Yii2 workshop
https://elisdn.ru/yii2-shop
Other
154 stars 113 forks source link

If new tag was not provided, it will create a Tag with empty name #22

Closed Andrewkha closed 6 years ago

Andrewkha commented 6 years ago

https://github.com/ElisDN/yii2-demo-shop/blob/9104d8cd254672769bc5d7e4711faaad3d760411/shop/useCases/manage/Shop/ProductManageService.php#L86

ElisDN commented 6 years ago

Fixed.

Andrewkha commented 6 years ago

Sorry, can you please explain how it was fixed? I do not see any change in the ProductManageService code... Looks like it was done in some other place

ElisDN commented 6 years ago

I have added ['existing', 'default', 'value' => []] validation rule instead of beforeValidate() method.

Andrewkha commented 6 years ago

If I understand correctly what you mean, it resolves another issue (if no existing tag is selected , the foreach loop fails). But what I'm talking about is if the New Tag is empty when you create/edit product, it will create a tag with empty name and slug and assign it to the product

image