ldc-bogt/app/Jobs/Arcadia/XmlFluxEggJob.php
2022-08-31 16:31:26 +02:00

66 lines
1.4 KiB
PHP

<?php
namespace App\Jobs\Arcadia;
use App\Models\TraceaEgg;
class XmlFluxEggJob extends XmlJobs
{
/**
* The xsd file path used to validate files
*
* @var string|null
*/
protected $xsdSchemaPath = 'resources/documents/traca/oeuf.xsd';
/**
* Disk name from config/filesystems.php
*
* @var string
*/
protected $disk = 'flux_egg';
/**
* The columns to take from the XML subcolumns can be added with a dot
*
* @var array
*/
protected $takeColumns = [
'code_boite' => 'box_code',
'code_ede' => 'ede_code',
'date_de_ponte' => 'laying_date',
'date_emballage' => 'packing_date',
'code_produit' => 'product_code',
'lib_produit' => 'product_label',
'lot_externe' => 'external_lot',
'dcr' => 'dcr',
'ean_13' => 'ean_13'
];
/**
* The columns allowed to be null
*
* @var array
*/
protected $nullableFields = [];
/**
* Fields that are unique
*
* @var array
*/
protected $uniqueKeyField = [];
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
$this->parseData('ML', TraceaEgg::class, null, function ($uniqueColumnsKey, $line) {
TraceaEgg::insert($line);
});
}
}