The best way I can see is applying a form transformer to your form.
If the checkbox is checked you set null to your property, if it isn't you assign the value of your integer widget.
You can have a look here and apply this to your particular case.
Side note: I wouldn't do this in the controller, it's not his job.