Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix filesystem import demo #1834

Merged
merged 4 commits into from
Aug 27, 2022
Merged

Fix filesystem import demo #1834

merged 4 commits into from
Aug 27, 2022

Conversation

mvorisek
Copy link
Member

fixes #1827

when custom path was input:

image

it was skipped for import, as it did not match the filtered items

@mvorisek mvorisek marked this pull request as ready for review August 27, 2022 21:23
@mvorisek mvorisek force-pushed the fix_1827_no_null_parent branch from 6ca2b48 to 7bf745d Compare August 27, 2022 21:35
['id' => 364, 'name' => 'TagTest.php', 'type' => 'php', 'is_folder' => false, 'parent_folder_id' => 341],
['id' => 365, 'name' => 'ViewTest.php', 'type' => 'php', 'is_folder' => false, 'parent_folder_id' => 341],
$model->import([
['id' => 1, 'name' => '.gitattributes', 'type' => 'gitattributes', 'is_folder' => false, 'parent_folder_id' => null],
Copy link
Member Author

@mvorisek mvorisek Aug 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created by:

$m = new Model($db, ['table' => new File($db)]);
$m->getField('id')->actual = $m->table->fieldName()->id;
$m->addField('name', ['type' => 'string', 'actual' => $m->table->fieldName()->name]);
$m->addField('type', ['type' => 'string', 'actual' => $m->table->fieldName()->type]);
$m->addField('is_folder', ['type' => 'boolean', 'actual' => $m->table->fieldName()->is_folder]);
$m->addField('parent_folder_id', ['type' => 'integer', 'actual' => $m->table->fieldName()->parent_folder_id]);
$m->setOrder('id');

$res = $m->export();
$aiOffset = reset($res)['id'] - 1;
foreach ($res as $k => $v) {
    $res[$k]['id'] = $v['id'] - $aiOffset;
    if ($v['parent_folder_id']) {
        $res[$k]['parent_folder_id'] = $v['parent_folder_id'] - $aiOffset;
    }
}

var_export($res);

@mvorisek mvorisek changed the title File filesystem import demo Fix filesystem import demo Aug 27, 2022
@mvorisek mvorisek merged commit a120f0f into develop Aug 27, 2022
@mvorisek mvorisek deleted the fix_1827_no_null_parent branch August 27, 2022 22:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

File import demo is broken
1 participant