Less code more configuration - UltimateModuleCreator/umc-crud GitHub Wiki

Using this module does not mean you will not have to write anymore code. You still have to.

Here is a list of what you usually write and what is covered by this module

File Without Umc_Crud With Umc_Crud
Intrafaces
Entity interface (`[Vendor]\[Module]\Api\Data\[Entity]Interface`) Yes Yes
Entity interface (`[Vendor]\[Module]\Api\Data\[Entity]Interface`) Yes Yes
Entity search results interface (`[Vendor]\[Module]\Api\Data\[Entity]SearchResultsInterface`) Maybe Yes
Entity repository interface (`[Vendor]\[Module]\Api\[Entity]RespoitoryInterface`) Yes Yes - split into 2 interfaces (Repository and ListRepository)1
Admin blocks
Admin form "Back" button (`[Vendor]\[Module]\Block\Adminhtml\[Entity]\BackButton`) Yes No. Just di.xml configuration
Admin form "Reset" button (`[Vendor]\[Module]\Block\Adminhtml\[Entity]\ResetButton`) Yes No. Just di.xml configuration
Admin form "Delete" button (`[Vendor]\[Module]\Block\Adminhtml\[Entity]\DeleteButton`) Yes No. Just di.xml configuration
Admin form "Save" button (`[Vendor]\[Module]\Block\Adminhtml\[Entity]\SaveButton`) Yes No. Just di.xml configuration
Admin controllers
Delete (`[Vendor]\[Module]\Controller\Adminhtml\[Entity]\Delete`) Yes yes but almost empty2
Edit (`[Vendor]\[Module]\Controller\Adminhtml\[Entity]\Edit`) Yes yes but almost empty2
Index (`[Vendor]\[Module]\Controller\Adminhtml\[Entity]\Index`) Yes yes but almost empty2
InlineEdit (`[Vendor]\[Module]\Controller\Adminhtml\[Entity]\InlineEdit`) Yes yes but almost empty2
MassDelete (`[Vendor]\[Module]\Controller\Adminhtml\[Entity]\MassDelete`) Yes yes but almost empty2
Save (`[Vendor]\[Module]\Controller\Adminhtml\[Entity]\Save`) Yes yes but almost empty2
Image / File uploads (`[Vendor]\[Module]\Controller\Adminhtml\[Entity]\Image\Upload`) - or any other name Yes yes but almost empty2
Models
Data model (`[Vendor]\[Module]\Model\[Entity]`) Yes Yes
Repository model (`[Vendor]\[Module]\Model\[Entity]Repository`) Yes No 3
Resource Models
Entity resource model (`[Vendor]\[Module]\Model\ResourceModel\[Entity]`) Yes Yes, but very small. di.xml configuration is required
Entity collection resource model (`[Vendor]\[Module]\Model\ResourceModel\[Entity]\Collection`) Yes Yes, but very small. di.xml configuration is required
Entity grid collection resource model (`[Vendor]\[Module]\Model\ResourceModel\[Entity]\Grid\Collection`) Yes No. di.xml configuration is required
Ui Classes
Form data provider ('[Vendor]\[Module]\Model\[Entity]\DataProvider') Yes No. di.xml configuration is required
Actions column ('[Vendor]\[Module]\Ui\Component\Listing\[Entity]\ActionsColumn') Yes No. di.xml configuration is required
Image column Yes if you have an image upload field No. di.xml configuration is required
Layout files
Admin index layout file `view/adminhtml/layout/[module]_[entity]_index` Yes Yes
Admin edit layout file `view/adminhtml/layout/[module]_[entity]_edit` Yes Yes
Ui Components
Admin list `view/adminhtml/ui_compoennt/[module]_[entity]_listing` Yes Yes
Admin edit `view/adminhtml/ui_compoennt/[module]_[entity]_form` Yes Yes
Configuration files
etc/di.xml Yes Yes
etc/adminhtml/di.xml Yes Yes
etc/adminhtml/routes.xml Yes Yes
etc/adminhtml/menu.xml Yes Yes
etc/db_schema.xml Yes Yes
etc/acl.xml Yes Yes
etc/module.xml Yes Yes
Helpers
Any helper you can thing of No. You should never create / use helpers No. You should never create / use helpers
Unit tests
Yes. You should always write unit tests
1 - In my experience I don't think I ever had to retrieve / delete a single instance of an entity and a list of instances the same entity at the same time. That's why I split the repository into 2 parts. - one that takes care of handling one single instance (get, delete, save) - one that takes care of retrieving a list of entities (getList)

2 - You need to extend the corresponding controller from the Umc_Crud module and just add this inside it public const ADMIN_RESOURCE = '[id of the acl resource here]';. Some di.xml configuration is required. 3 - Two repository classes that implement the interfaces from 1 will be autogenerated. The only difference is that they are called [Entity]Repo and [Entity]ListRepo instead of EntityRepository.

⚠️ **GitHub.com Fallback** ⚠️