yii2-activerecord-inheritance icon indicating copy to clipboard operation
yii2-activerecord-inheritance copied to clipboard

Parent defined rules not working in child forms

Open gdiazderadaa opened this issue 9 years ago • 4 comments

Hi there, Are the parent rules supposed to be inherited by the child class? I'm assuming so since the properties theirselves are. However that's not working for me. Thanks

gdiazderadaa avatar Feb 12 '16 14:02 gdiazderadaa

Hello! I saw no need to inherit the parent rules, because the save and validation methods of the child class call the methods of the parent class, so the parent rules affect the parent properties already and the getErrors method return all the errors in the two classes when it is called.

jlorente avatar Feb 13 '16 08:02 jlorente

Hello! Then I may be missing something, because the client-side validation of the child class doesn't work for inherited properties if the rules are setup in the parent class...

gdiazderadaa avatar Feb 15 '16 08:02 gdiazderadaa

You are right in that. The client side validation doesn't work, because the parent rules are not inherited by default. I will think about it and fix the issue.

jlorente avatar Feb 15 '16 09:02 jlorente

Hi!

Has any solution been defined for this problem?

Force the merge with the parent is the best solution?

Thanks!

mandachuvamg avatar Nov 21 '18 02:11 mandachuvamg