umc/module-crud 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

umc/module-crud

Composer 安装命令:

composer require umc/module-crud

包简介

Magento 2 module for reducing the CRUD boilerplate

README 文档

README

Purpose:

This module is intended for Magento 2 developers, in order to reduce the boilerplate code when creating a CRUD extension.

Compatibility

  • 2.4.6
  • 2.4.5
  • 2.4.4
  • 2.4.3
  • 2.4.2
  • 2.4.1
  • 2.4.0
  • 2.3.5
  • 2.3.4
  • probably works for versions before 2.3.4, but it's not guaranteed.

What it does:

It provides a set of classes and interfaces that can be configured, composed or prerenced in order to avoid writing the same code over and over again.

Example:

(Almost) every Save controller for an entity does the following:

  • retrieves the data from POST.
  • may or may not transform the data received via POST
  • creates a new entity or retrieves a requested entity from the database
  • assigns the data to the entity from the point above
  • persists the entity
  • redirects "somewhere" with a success or an error message.

And the only variables here are

  • the entity being added / modified
  • the way the data is processed before attaching it to the entity

This module provides a general admin Save controller that has as dependencies a set of other classes / interfaces that have only one of the responsibilities above

  • an Entity manager responsible for retrieving the data from db or instantiating a new entity
  • a data processor (interface) that processes the data
  • an entity config class will contain the details about the entity being processed.
  • side objects: a data persistor (which is basically the session) to save the data submitted in case there is an error and you need to redirect back to the form with the previously submitted data prefilled.

All of these can be configured via di.xml for each entity you want to manage.

This module also adds a few more code generators (similar to the core ones for factory or proxy for example) that will autogenerate repository classes and a few others.

Target audience

  • this module is intended for experienced Magento 2 developers that are tired of writing the same thing over and over again.
  • this is not intended for junior developers.
  • In order to use this you have to have good knowledge of ...
    • how a magento CRUD module works
    • what is a virtual type
    • how DI works in Magento

Advantages in using this module

  • less code to write, which means less code to test and less code that can malfunction
  • your copy/paste analyzer will stop complaining you have classes that look the same.
  • decrease development time. (hopefully)
  • you will have a standard way of writing all your CRUD modules (no matter if it's good or bad, at least it is consistent)
  • This covers most of the cases you will encounter in your development process. If one of your cases is not covered by this module you can choose not to extend or compose the classes in this module and use your own.

Disadvantages of using this module

  • there is a lot more configuration you need to write (YEAH....xmls).
  • makes debugging a little harder.
  • adds a new abstractization layer ... or 7. Just kidding. it's 1.
  • you add a new dependency to your project and all your CRUD module will depend on this module.

Installation:

  • Via composer (recommended)
    - composer require "umc/module-crud=*"
  • Manual install
    - download a copy from https://github.com/UltimateModuleCreator/umc-crud and all the files in app/code/Umc/Crud.

After installation

  • run php bin/magento setup:upgrade [--keep-generated]
  • check if this file exists app/etc/crud/di.xml. If it does not exist, run the command bin/magento umc:crud:deploy. If you get an error you can copy it from vendor/umc/module-crud/etc/crud/di.xml to app/etc/crud/di.xml.

Documentation

For more details about how this extension should work, visit https://github.com/UltimateModuleCreator/umc-crud/wiki

Donations

If you really like this and get the hang of it and it saves you a lot of development time, consider a small (or large - I won't mind) donation via PayPal

umc/module-crud 适用场景与选型建议

umc/module-crud 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9.63k 次下载、GitHub Stars 达 26, 最近一次更新时间为 2020 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 umc/module-crud 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 umc/module-crud 我们能提供哪些服务?
定制开发 / 二次开发

基于 umc/module-crud 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9.63k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 26
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 26
  • Watchers: 3
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-25