OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Import CsvFileReader

This topic contains 6 replies, has 2 voices, and was last updated by  stalxed 9 years, 5 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #33527

    Yevhen Shyshkin
    Participant

    Hello, stalxed.

    There are two ways to do that:

    1) preferable solution: you can pass these variables to execution context – see this code;

    2) another solution: you can extend this reader, override variables and use it in batch job configuration.

    #33528

    stalxed
    Participant

    Thank you for answer!

    I use importexport configuration like in this bundle:
    https://github.com/orocrm/crm/blob/master/src/OroCRM/Bundle/ContactBundle/Resources/config/importexport.yml

    For example, how from OroCRMContactBundle pass this variables to execution context?
    I spent a few hours, but did not understand how to do it.

    #33529

    stalxed
    Participant

    I think I cant do it from here
    https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/ImportExportBundle/Processor/ImportProcessor.php
    In documentation he called after the read operation.
    Or am I wrong?
    If I’m not mistaken, where else can I set the context variables?(before call the function initializeFromContext in CsvFileReader).

    #33530

    stalxed
    Participant

    I found solution:
    1) Need create listener:

    2) Need register listener:

    #33531

    Yevhen Shyshkin
    Participant

    Good job, stalxed!

    Just a several tips:
    – alongside with “import_validation” type you should alter configuration for “import” type
    – instead of hardcoded types you can use constants ProcessorRegistry::TYPE_IMPORT_VALIDATION and ProcessorRegistry::TYPE_IMPORT

    #33532

    stalxed
    Participant

    Thanks Yevhen Shyshkin!

    I improved the code:

    Now can registe few services:

    I hope someone can help.
    I would be glad if you publish in a cookbook documentation.

Viewing 6 replies - 1 through 6 (of 6 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top