Validate Entities in Model |
I am trying to validate Entity by calling Model->validate( Entities\Promocodes $promo ).
But It looks like `Model->validate( Array $promo )` is the only option for this? I have an Entitiy class: PHP Code: namespace App\Entities; And I have a model with validation rules. Which works great, if I pass an Array to it. But it will always return true, if I pass Entities class Object. Model with validation rules: PHP Code: namespace App\Models; This will return false, as expected: PHP Code: model('PromocodesModel')->validate(['code'=> 'a']); // min length must be 3! The problem PHP Code: // Validating Entities object Will ALWAYS return TRUE! I understand, that passing Entities Object to Model may not be possible by design. But this is confusing in that case, because it should not return True anyway! I have workaround by always using Array for data fill, validate, but I would like to know, if there is sych Entities validation available, or this should be posted as feature request? |
Welcome Guest, Not a member yet? Register Sign In |