BlackbitDigitalCommerce / pimcore-data-director

Import Bundle for Pimcore
16 stars 3 forks source link

PATH only under $params['context']['resource']['file'] #38

Open betterapp opened 2 years ago

betterapp commented 2 years ago

In 2.8.5 under $params['context']['resource']['file']

has full path to asset with file name.

In 3.0.6 there is only full path WITHOUT file name.

Why ?

BlackbitDevs commented 2 years ago

$params['context']['resource']['file'] contains the used import source. This can be a folder, a glob expression, a single file or a URL etc. If you want to know from which file a certain raw data item came from, please add a raw data field __source

Here is a quote from the documentation:

You can specify a folder path as import source instead of a single file. In this case files in this folder (and subfolders) are imported subsequently (sorted by modification time - oldest first). Already imported files are stored in an archive folder within the import folder.

In addition to the source file fields you can use the field __source to obtain the source file name. This can be useful if you want to process the source file name in the object import (e.g. to call a dependent import with the same import file).

betterapp commented 2 years ago

there was a change in 3.0 about this ? In 2.8.5 under 'file' was full path with file name.

BlackbitDevs commented 2 years ago

Yes, I think so. Previously the resolved source file was listed there. But this is not correct because when you import data from several files in a folder $params['context']['resource']['file'] cannot always contain the same file.

betterapp commented 2 years ago

obraz

How can I access to __source from Result Callback Function ??

betterapp commented 2 years ago

there is no __source under $params['context'] and below

BlackbitDevs commented 2 years ago

This is a normal raw data field then. You can access it via $params['rawItemData']['__source']['value'].

betterapp commented 2 years ago

I checked it allready - it is NULL

We use wildcard here: obraz

And I check the value like this:

if ($params['lastCall']) {
    var_dump($params['rawItemData']['__source']['value']); die;
}
BlackbitDevs commented 2 years ago

Oh, __source did not work for Excel-based dataports. Is fixed in 3.0.10.

betterapp commented 2 years ago

is it released with tag or still in development ?

BlackbitDevs commented 2 years ago

Is already released.