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?


1 Answer 1


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="...">
        <submitUrl path="customer/index/save"/>

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.

https://devdocs.magento.com/guides/v2.3/ui_comp_guide/components/ui-form.html https://devdocs.magento.com/guides/v2.3/extension-dev-guide/service-contracts/design-patterns.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.