multibytesystems/mb-components 问题修复 & 功能扩展

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

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

multibytesystems/mb-components

Composer 安装命令:

composer require multibytesystems/mb-components

包简介

Helper library to provide base functionality to common tasks when dealing with data driven applications

README 文档

README

This Zend module provides base classes to simplify handling of doctrine entities. Currently it consists of

  • two abstract entity classes
  • one general repository class
  • one service class

Latest Version Total Downloads Software License

Install

composer require multibytesystems/mb-components

Entity classes

  • MBBaseEntity simplifies handling of creation and modification date by providing a created and a modified property along with its accessor methods as well as appropriate lifecycleevent methods to set creation and modification date on persist and modification date on update. So this has not to be implemented in every entity class on it's own. In addition this class defines an abstract class getTextIdentifier() that is very similar to an getString() method and that should return a suitable string representation of the entity.

  • MBInterleavedChecksumEntity creates a simple checksum from provided record data as well as an interleaved checksum from provided record data alongside with data of the forerunning record (the predecessor). It defines an abstract method getInterityData() that needs to be implemented in the concrete entity class and returns an array of data that should be included within the checksum. This class also saves the id of it's predecessor into the current record.

Repository class

  • MBInterleavedChecksumEntityRepository provides the findLatest() method that returns the latest record within the corresponding table. Currently it does this by id (what means that this only works as intended if id is incremental).

Service class

  • IntegrityService provides the getValidatedEntities() method that returns a list of all entities with their validity checked. This result is similar to the repository's method findAll() but with validation and is needed as validation is a tiime consuming process and should not happen on every findAll()` operation.

Usage

To use MBBaseEntity add the following fields to the table that is related to the entity.

  • created (DateTime)
  • modified (DateTime)

Extend the MBBaseEntity within the concrete entity class. Add a getTextIdentifier() method to the concrete class that returns a suitable string representation of the entity.

To use MBInterleavedChecksumEntityRepository do everything that has to be done for using MBBaseEntity (this is because MBInterleavedChecksumEntityRepository extends MBBaseEntity) and add the following fields to the table that is related to the entity.

  • simple_checksum (varchar(1000))
  • interleaved_checksum (varchar(1000))
  • predecessor_id (int)

Extend the MBInterleavedChecksumEntityRepository within the concrete entity class. Add a getInterityData() method to the concrete class that returns an array of data that should be part of the simple and interleaved checksum.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-04-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固