I have UI admin form xml file.
I've got SaveButton.php block file, but I need to save form in db. As far as I know I need controller.
How this controller would look like and in which directory it should be stored?
The location of the Save Controller class largely depends on UI Component configuration.
For example, the dataSource settings for the Customer UI form looks like this:
<dataSource name="..."> <settings> ... <submitUrl path="customer/index/save"/> </settings>
This path leads us to a Controller file here:
Following a similar pattern makes sense.
I suggest creating a data object from a data factory and then saving the object via it's repository.