Laravel-excel: [BUG] [Maatwebsite \ Excel \ Transactions \ TransactionManager]에 λŒ€ν•œ NULL λ“œλΌμ΄λ²„λ₯Ό 확인할 수 μ—†μŠ΅λ‹ˆλ‹€.

에 λ§Œλ“  2019λ…„ 10μ›” 02일  Β·  5μ½”λ©˜νŠΈ  Β·  좜처: Maatwebsite/Laravel-Excel

μ „μ œ 쑰건

  • [X] Laravel Excel 버전이 μ—¬μ „νžˆ μ§€μ›λ˜λŠ”μ§€ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€. https://docs.laravel-excel.com/3.1/getting-started/support.html#supported -versions
  • [X] μ½”λ“œ μ™ΈλΆ€μ—μ„œ λ™μž‘μ„ μž¬ν˜„ ν•  μˆ˜μžˆλŠ” λ¬Έμ œλŠ” Laravel Excel둜 κ²©λ¦¬λ©λ‹ˆλ‹€.
  • [X] λ¬Έμ œκ°€ 이미 μ œμΆœλ˜μ§€ μ•Šμ•˜λŠ”μ§€ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.
  • [X]이 문제λ₯Ό ν•΄κ²°ν•˜λŠ” PR이 μ œμΆœλ˜μ§€ μ•Šμ•˜λŠ”μ§€ ν™•μΈν–ˆμŠ΅λ‹ˆλ‹€.
  • [X] 전체 문제 ν…œν”Œλ¦Ώ μž‘μ„±

버전

  • PHP 버전 : PHP 7.3.9-1 + ubuntu16.04.1 + deb.sury.org + 1 (cli) (λΉŒλ“œ : 2019 λ…„ 9 μ›” 2 일 12:54:04) (NTS)
  • 라 라벨 버전 : v6.0.4
  • νŒ¨ν‚€μ§€ 버전 : 3.1.17

기술

XLSλ₯Ό κ°€μ Έ 였렀고 ν•  λ•Œ λ‹€μŒ 였λ₯˜κ°€ λ°œμƒν•©λ‹ˆλ‹€.

Unable to resolve NULL driver for [Maatwebsite\Excel\Transactions\TransactionManager].

μž¬ν˜„ 단계

κ°€μ Έμ˜¬ μ½”λ“œλŠ” λ‹€μŒκ³Ό κ°™μŠ΅λ‹ˆλ‹€.

Excel::import(new ProdutosImport, $file)

그리고 μ‹€μ œ μˆ˜μž…μ€

<?php

namespace App\Imports;

use App\Produto;
use Maatwebsite\Excel\Concerns\OnEachRow;
use Maatwebsite\Excel\Concerns\WithHeadingRow;

class ProdutosImport implements OnEachRow, WithHeadingRow
{
    /**
     * <strong i="27">@param</strong> array $row
     *
     * <strong i="28">@return</strong> \Illuminate\Database\Eloquent\Model|null
     */
    public function onRow($row)
    {
        $row = $row->toArray();
        if ($row['nmero_do_pedido'] !== null && $row['sku'] !== null) {
            $produto = Produto::firstOrNew(['id_venda' => $row['nmero_do_pedido'], 'sku' => $row['sku'], 'sequeencia' => null]);
            $produto->id_venda = $row['nmero_do_pedido'];
            $produto->sequeencia = null;
            $produto->sku = $row['sku'];
            $produto->data_pagamento = $row['data_de_pagamento'];
            $produto->estado_pagamento = $row['status_do_pagamento'];
            $produto->titulo_produto = $row['nome_do_produto'];
            $produto->sub_total = $row['valor_do_produto'];
            $produto->descuento_compra = 0;
            $produto->total_venda = $row['valor_do_produto'];

            $produto->save();
        }
    }
}

μ˜ˆμƒλ˜λŠ” λ™μž‘ :

νŒŒμΌμ„ κ°€μ Έμ˜΅λ‹ˆλ‹€.

μ‹€μ œ 행동 :

였λ₯˜
Unable to resolve NULL driver for [Maatwebsite\Excel\Transactions\TransactionManager].

μΆ”κ°€ 정보

Mongoλ₯Ό μ‚¬μš©ν•˜μ§€ μ•Šμ§€λ§Œ # 1998μ—μ„œ μ œμ•ˆν•œλŒ€λ‘œ νŠΈλžœμž­μ…˜μ„ λΉ„ν™œμ„±ν™”ν•˜λ €κ³ ν–ˆμ§€λ§Œ 아무것도 λ³€κ²½λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

μ’‹μ•„, λͺ‡ 가지 쑰사λ₯Όν–ˆλŠ”데 버그가 μ•„λ‹™λ‹ˆλ‹€.

Laravel μΊμ‹œλŠ” μƒˆλ‘œ κ²Œμ‹œ 된 곡급 업체 ꡬ성을 μ½λŠ” μ€‘μž…λ‹ˆλ‹€.

κ°„λ‹¨ν•œ php artisan config : clear κ°€ ν•΄λƒˆμŠ΅λ‹ˆλ‹€.

λͺ¨λ“  5 λŒ“κΈ€

https://github.com/Maatwebsite/Laravel-Excel/issues/1998#issuecomment -508995478μ—μ„œ λ‚΄ λŒ€λ‹΅μ„ μ‹œλ„ν•΄ λ³΄μ…¨μŠ΅λ‹ˆκΉŒ? 잘λͺ»λœ ꡬ성 값을 μ‚¬μš©ν•˜κ³ μžˆλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

# 1998 (μ½”λ©˜νŠΈ) μ—μ„œ λ‚΄ λŒ€λ‹΅μ„ μ‹œλ„ν•΄ λ³΄μ…¨μŠ΅λ‹ˆκΉŒ? 잘λͺ»λœ ꡬ성 값을 μ‚¬μš©ν•˜κ³ μžˆλŠ” 것 κ°™μŠ΅λ‹ˆλ‹€.

λ‚˜λŠ” λ‘˜ λ‹€ μ‹œλ„ν–ˆλ‹€. λ˜ν•œ κΈ°λ³Έ ꡬ성을 μ‹œλ„ν–ˆμŠ΅λ‹ˆλ‹€.

μ–΄μ¨Œλ“  MySQL을 μ‚¬μš©ν•˜κ³  있기 λ•Œλ¬Έμ— κΈ°λ³Έ ꡬ성이 μž‘λ™ν•˜μ§€ μ•Šμ•„μ•Όν•©λ‹ˆκΉŒ?

BTW, @patrickbrouwers , 'handler'에 λŒ€ν•œ κ°’μœΌλ‘œ 'db'λ˜λŠ” 'null'이 μžˆλŠ”μ§€ 여뢀에 관계없이 'Unable to resolve NULL driver'λΌλŠ” λ™μΌν•œ λ©”μ‹œμ§€κ°€ ν‘œμ‹œλ©λ‹ˆλ‹€.

μ’‹μ•„, λͺ‡ 가지 쑰사λ₯Όν–ˆλŠ”데 버그가 μ•„λ‹™λ‹ˆλ‹€.

Laravel μΊμ‹œλŠ” μƒˆλ‘œ κ²Œμ‹œ 된 곡급 업체 ꡬ성을 μ½λŠ” μ€‘μž…λ‹ˆλ‹€.

κ°„λ‹¨ν•œ php artisan config : clear κ°€ ν•΄λƒˆμŠ΅λ‹ˆλ‹€.

이 λ¬Έμ œμ— μ§λ©΄ν–ˆμŠ΅λ‹ˆλ‹€. λ‚΄ λ¬Έμ œλŠ” ꡬ성 파일 excel.php 을 μΆ”κ°€ν•˜μ§€ μ•Šκ³  라이브러리λ₯Ό μ‚¬μš©ν•˜κ³  μžˆλ‹€λŠ” κ²ƒμž…λ‹ˆλ‹€.

κ·Έλž˜μ„œ μΊμ‹œλ₯Ό μ§€μ›Œμ„œ μΆ”μ ν•˜κ³  (μž‘λ™ν–ˆμŠ΅λ‹ˆλ‹€) ꡬ성 νŒŒμΌμ„ μΆ”κ°€ ν•œ λ‹€μŒ ꡬ성을 λ‹€μ‹œ μΊμ‹œν–ˆμŠ΅λ‹ˆλ‹€.

이게 도움이 되길 λ°”λž€λ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰