定制 senet-eindhoven/cartograph 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

senet-eindhoven/cartograph

最新稳定版本:4.0.1

Composer 安装命令:

composer require senet-eindhoven/cartograph

包简介

Map objects to objects

README 文档

README

This library is used to Map PHP object to other objects

Installation

Install this library using composer

composer require senet-eindhoven/cartograph:^4.0

Getting Started

To use this library create an instance of the MapperService, using your preffered MappingRepositoryInterface

<?php
use Senet\Cartograph\MapperService;
use Senet\Cartograph\Mapping\DirectMapping;
use Senet\Cartograph\MappingRepository;

$foo = new Foo();
$bar = new Bar();

// Initiate the MapperService
$mappingRepository = new MappingRepository();
$mapperService = new MapperService($mappingRepository);

// Register a mapping from Foo, to Bar using the DirectMapping
$mappingRepository->addMapping(Foo::class, Bar::class, DirectMapping::class);

// Map Foo -> Bar. Will fetch the previously registered Mapping
$mapperService->map($foo, $bar);

Creating custom Mappings

The DirectMapping uses reflection to map attributes 1:1. Should this not meet your requirements, you can create a custom mapping by implementing the MappingInterface and registering it to the MappingRepository as shown above.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-06-14