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?

  • Are you created Admin Grid in Layout structure or ui component? – Arunprabakaran M Mar 6 '19 at 11:14

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, privacy policy and cookie policy

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