custom validation rule fails |
Hi all,
I have this strange behaviour in my custom validation rule. In my model I have this validation: PHP Code: protected $validationRules = [ You can see I use 2 variables: parent_id and id. In my controller I run: PHP Code: $category = $this->categoriesModel->find($categoryId); Code: [attributes:protected] => Array But my validation rule doesn't recognize the parent_id... PHP Code: SELECT * As you can see it recognizes the {id}, but not the {parent_id}. When I add $category->parent_id = 123; it works, but parent_id is already present in the $category entity, I don't want to explicitly set this value...
I think I already know why this is failing....
Can this be the case because the validator only has access to the primary key and CHANGED values? In this case the PARENT_ID is not changed, so it might not be available in my custom rule? Is there a way to force an update on ALL fields, even when they're not changed?
I have placed it in \Custom\CustomValidationRules.php
And added that class in The validation config as well
|
Welcome Guest, Not a member yet? Register Sign In |