When I use unsetAddFields() , I cannot set a default value as per the documentation.
If I try the below, the value remains empty (unlike the tutorial)
$crud->setTable('orders');
$crud->setSubject('Order', 'Orders');
$crud->unsetAddFields(['status']);
$crud->setRelation('customerNumber','customers','contactLastName');
$crud->callbackBeforeInsert(function ($stateParameters) {
$stateParameters->data['status'] = 'In Process';
return $stateParameters;
});
$output = $crud->render();
If I remove the unsetAddFields method, the code works well…
But the field status is not hidden anymore.
In this case, the function unsetAddFields does not only hide the field, but removes it from the insert routine.
Please help.