i-lateral/silverstripe-slightly-better-bulkloader 问题修复 & 功能扩展

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

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

i-lateral/silverstripe-slightly-better-bulkloader

Composer 安装命令:

composer require i-lateral/silverstripe-slightly-better-bulkloader

包简介

It's the SilverStripe bulk loader, but ever so slightly better

README 文档

README

Scrutinizer Code Quality Build Status

It's the SilverStripe bulk loader, but ever so slightly better!

This module expands the default SS version and adds error logging per import row and attempts to solve issues where Excel sometimes adds blank columns to the end of a CSV (which then fails to import)

Install

Instalation via composer:

# composer require i-lateral/silverstripe-slightly-better-bulkloader

Usage

By default this module should automatically replace BulkLoader_Result with a custom version that track errors.

However to make the most of this, you need to also implement your own version of CSVBulkLoader for example:

ModelAdmin

Adding the Custom CSV uploader via ModelAdmin

namespace App\Admin;

use SilverStripe\Admin\ModelAdmin;
use ilateral\SilverStripe\SlightlyBetterBulkLoader\CsvBulkLoader;

class MyModelAdmin extends ModelAdmin
{
    private static $managed_models = [
        MyDataObject::class
    ];

    private static $model_importers = [
        MyDataObject::class => CsvBulkLoader::class
    ];
}

Manualy Called

An example of adding a custom CSV import after a form has been submitted.

use SilverStripe\Forms\Form;
use ilateral\SilverStripe\SlightlyBetterBulkLoader\CsvBulkLoader;

class MyImportForm extends Form
{
    public function import($data, $form)
    {
        $loader = CsvBulkLoader::create();
        $results = $loader->load($_FILES['_CsvFile']['tmp_name']);

        $form->sessionMessage(
            $results->getMessagesString("</br>"),
            $results->getMessageType(),
            ValidationResult::CAST_HTML
        );

        return $this->redirectBack();
    }
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2019-02-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固