liberty_code/migration_model 问题修复 & 功能扩展

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

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

liberty_code/migration_model

最新稳定版本:v1.0.0

Composer 安装命令:

composer require liberty_code/migration_model

包简介

Library

README 文档

README

Description

Library contains migration model components, to manage application migrations.

Requirement

  • Script language: PHP: version 7 || 8

Framework library implementation requirement

  1. Library repository: liberty_code/validation: version 1.0

    • Standard rules implementation (or equivalent):

      Validator provided on entities, must contain all standard rules, added on its rule collection.

    • Validator rules implementation (or equivalent):

      Validator provided on entities, must contain all validator rules, added on its rule collection. Each validator rule must use validator, with same implementation as validator provided on entities.

  2. Library repository: liberty_code/sql: version 1.0

    • Validation SQL rules implementation (or equivalent):

      Validator provided on entities, must contain all SQL rules, added on its rule collection.

Installation

Several ways are possible:

Composer

  1. Requirement

    It requires composer installation. For more information: https://getcomposer.org

  2. Command: Move in project root path

     cd "<project_root_path>"
    
  3. Command: Installation

     php composer.phar require liberty_code/migration_model ["<version>"]
    
  4. Note

    • Include vendor

      If project uses composer, vendor must be included:

        require_once('<project_root_path>/vendor/autoload.php');
      
    • Configuration

      Installation command allows to add, on composer file "/composer.json", following configuration:

        {
            "require": {
                "liberty_code/migration_model": "<version>"
            }
        }
      

Include

  1. Download

    • Download following repository.
    • Put it on repository root path.
  2. Include source

     require_once('<repository_root_path>/include/Include.php');
    

Usage

Migration

Migration entity system allows to design data structure for migration, to manage, retrieve and save its data in persistence.

Elements

  • MigEntity

    Extends save configured entity features. Allows to design a migration entity, to save it.

  • MigEntityCollection

    Extends fixed entity collection features. Allows to design collection of migration entities.

  • MigEntityFactory

    Extends fixed entity factory features. Allows to design migration entity factory, to provide migration entity objects.

  • MigEntityRepository

    Extends fixed multi repository features. Allows to design migration entity repository, to save data, from migration entity, in persistence.

  • MigEntityCollectionRepository

    Extends fixed multi collection repository features. Allows to design migration entity collection repository, to save data, from migration entity collection, in persistence.

  • SqlMigEntity

    Extends migration entity features. Uses SQL rules for attributes validation.

  • SqlMigEntityFactory

    Extends migration entity factory features. Provides SQL migration entity objects.

  • SqlMigEntityRepository

    Extends migration entity repository features. Uses SQL table persistor, as persistence.

  • SqlMigEntityCollectionRepository

    Extends migration entity collection repository features. Uses SQL table persistor, as persistence.

// Get migration entity factory
use liberty_code\migration\entity\model\MigEntityFactory;
$migEntityFactory = new MigEntityFactory($provider);
...
// Get new migration entity
$migEntity = $migEntityFactory->getObjEntity();
...

Builder

Builder allows to hydrate existing migration with migration entity collections and vice versa.

// Get migration entity collection
use liberty_code\migration\entity\model\MigEntityCollection;
$migEntityCollection = new MigEntityCollection();
...
// Get migration entity builder
use liberty_code\migration\entity\build\model\DefaultBuilder;
$migEntityBuilder = new DefaultBuilder($migEntityFactory);
...
// Hydrate migration entity collection
$migEntityBuilder->hydrateMigEntityCollection(
    $migEntityCollection, 
    $migrationCollection
);
...
foreach($migEntityCollection->getTabKey() as $key) {
    echo($migEntityCollection->getItem($key)->strAttrKey .'<br />');
}
/**
 * Show: 
 * Migration key 1
 * ...
 * Migration key N
 */
...

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2020-01-03