jord-jd/uxdm-spatie-data-transfer-object 问题修复 & 功能扩展

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

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

jord-jd/uxdm-spatie-data-transfer-object

最新稳定版本:v3.0.0

Composer 安装命令:

composer require jord-jd/uxdm-spatie-data-transfer-object

包简介

Spatie Data Transfer Object package for the UXDM data migrator

README 文档

README

Build Status Coverage Status

The UXDM Spatie Data Transfer Object package provides a UXDM source and destination for Data Transfer Objects that are created using the Spatie Data Transfer Object package.

If you have not used UXDM before to migrate your data, visit the UXDM GitHub repository to learn more.

Installation

To install the UXDM Spatie Data Transfer Object package, just run the following composer command.

composer require jord-jd/uxdm-spatie-data-transfer-object

UXDM Spatie Data Transfer Object Source

The UXDM Spatie Data Transfer Object source allows you to source data from a Spatie Data Transfer Object Collection.

Creating

To create a new Spatie Data Transfer Object source, you must provide it with a populated Spatie Data Transfer Object Collection.

The following example creates a Spatie Data Transfer Object source object, using a collection of users data transfer objects.

$users = new UserDTOCollection([
    new UserDTO([
        'id' => 1,
        'name' => 'Picard`',
        'email' => 'picard@enterprise-d.com',
    ]),
    new UserDTO([
        'id' => 2,
        'name' => 'Janeway',
        'email' => 'janeway@voyager.com',
    ])
]);

$spatieDataTransferObjectSource = new SpatieDataTransferObjectSource($users);

Assigning to migrator

To use the Spatie Data Transfer Object source as part of a UXDM migration, you must assign it to the migrator. This process is the same for most sources.

$migrator = new Migrator;
$migrator->setSource($spatieDataTransferObjectSource);

UXDM Spatie Data Transfer Object Destination

The UXDM Spatie Data Transfer Object destination allows you to migrate data into a Spatie Data Transfer Object Collection.

Creating

To create a new Spatie Data Transfer Object destination, you must provide it with a Spatie Data Transfer Object Collection, and the class name of a Spatie Data Transfer Object.

The following example creates a Spatie Data Transfer Object destination object, using an empty collection, and the name of a user data transfer object class.

$users = new UserDTOCollection();
$spatieDataTransferObjectDestination = new SpatieDataTransferObjectDestination($users, UserDTO::class);

Assigning to migrator

To use the Spatie Data Transfer Object destination as part of a UXDM migration, you must assign it to the migrator. This process is the same for most destinations.

$migrator = new Migrator;
$migrator->setDestination($spatieDataTransferObjectDestination);

Alternatively, you can add multiple destinations, as shown below. You can also specify the fields you wish to send to each destination by passing an array of field names as the second parameter.

$migrator = new Migrator;
$migrator->addDestination($spatieDataTransferObjectDestination, ['field1', 'field2']);
$migrator->addDestination($otherDestination, ['field3', 'field2']);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 2026-02-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固