liberty_code/module_model
最新稳定版本:v1.0.0
Composer 安装命令:
composer require liberty_code/module_model
包简介
Library
README 文档
README
Description
Library contains modular model components, to split and use model components in several modules.
Requirement
- Script language: PHP: version 7 || 8
Installation
Several ways are possible:
Composer
Requirement
It requires composer installation. For more information: https://getcomposer.org
Command: Move in project root path
cd "<project_root_path>"Command: Installation
php composer.phar require liberty_code/module_model ["<version>"]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/module_model": "<version>" } }
Include
Download
- Download following repository.
- Put it on repository root path.
Include source
require_once('<repository_root_path>/include/Include.php');
Usage
Entity module
Entity module contains part of configured attributes, can be used in configured entities.
Elements
EntityModule
Allows to design an entity module. Contains part of configured attributes, can be used in configured entities.
ValidatorEntityModule
Extends entity module features. Can be used in validator configured entities.
SaveEntityModule
Extends validator entity module features. Can be used in save configured entities.
EntityModuleCollection
Allows to design collection of entity modules. Uses list of entity modules, to build attributes configuration, for specified entity.
HandleValidatorEntityModule
Extends validator entity module features. Uses attribute provider, to build and manage its part of configured attributes.
HandleSaveEntityModule
Extends save entity module features. Uses attribute provider, to build and manage its part of configured attributes.
Builder
Allows to hydrate entity module collection, with entity modules.
FixBuilder
Extends entity module builder features. Uses fixed array of source data to hydrate entity module collection.
Example
// Get entity module collection
use liberty_code\module_model\entity_module\model\DefaultEntityModuleCollection;
$entityModuleCollection = new DefaultEntityModuleCollection();
...
// Set entity modules
use liberty_code\module_model\entity_module\model\DefaultEntityModule;
$entityModuleCollection->setTabEntityModule(DefaultEntityModule[...]);
...
// Get entity attribute configuration, from entity modules
$entityModuleCollection->getTabAttributeConfig();
...
Entity
Module configured entity uses entity module collection, to manage its attributes.
Elements
ModuleConfigEntity
Extends configured entity features. Uses entity module collection, to manage its attributes.
ModuleValidatorConfigEntity
Extends validator configured entity features. Uses entity module collection, to manage its attributes.
ModuleSaveConfigEntity
Extends save configured entity features. Uses entity module collection, to manage its attributes.
Example
...
// Get new entity
use liberty_code\module_model\entity\model\ModuleConfigEntity
$moduleConfigEntity = new ModuleConfigEntity($entityModuleCollection);
...
if($moduleConfigEntity->checkAttributeValid()) {
$tabAttributeKey = $moduleConfigEntity->getTabAttributeKey();
foreach($tabAttributeKey as $attributeKey) {
echo($moduleConfigEntity->$attributeKey . '<br />');
}
}
/**
* Show:
* Entity attribute 1 value
* ...
* Entity attribute N value
*/
...
统计信息
- 总下载量: 375
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2019-11-12