I have this scenario where I have a form as follows:
public $selling_price;
public $numbers;
public $inventory_factor;
public function rules() {
return [
['selling_price'], 'integer'],
[['inventory_factor'], 'safe'],
['numbers', 'each', 'rule' => ['integer']],
}
I have this last validation rule to make sure that I get an array of integers. This works fine when the input is a string for example. IT does not work though if an array [null] is sent. This for example does not throw errors
{
"selling_price": 2200,
"numbers": [null]
}
Using vardumper, gives the numbers array to be
[
0 => null
]
Is there way in Yii2 through which I can either remove(filter) the null values from the array before starting, or validating those as well?