Giter Site home page Giter Site logo

syliusimportexportplugin's People

Contributors

afasciaux avatar aleho avatar andychan94 avatar cdarken avatar dependabot[bot] avatar dnna avatar dsbe-ak avatar dunglas avatar enesaktay avatar florentingarnier avatar florian-ct avatar gogopex avatar julientroopers avatar lsmith77 avatar m3gg3r avatar mattagohni avatar mbabker avatar oallain avatar olimination avatar pamil avatar pgrimaud avatar pocky avatar revoltek-daniel avatar seizan8 avatar spras avatar stefandoorn avatar vasilvestre avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

syliusimportexportplugin's Issues

refactor AbstractImporter

From @lsmith77 on October 28, 2017 19:22

https://github.com/solutionDrive/SyliusImportExport/pull/9#discussion_r146049391

We could do it differently: instead of two specific importer classes extending the main abstract importer class, we have one `ResourcesImporter` which has injected 3 parameters:
- `CsvReaderFactory`
- `ObjectManager`
- `ResourceProcessor` (or sth like this)

This `ResourceProcessor` (with `ResourceProcessorInterface`) would have factory and repository injected, and do all *update or create* logic inside. Even more - we could pass there the whole `$csvReader` iterator (or use something like `iterator_to_array` to pass array, it doesn't matter at all to be honest πŸ˜„ ) and operate on this multiple rows inside, and then we could get rid of `ObjectManager` here. There are few benefits of such an approach.
- we make importer class much more easier - it just reads data from csv file and pass it to processor
- we get rid of this smelly `createOrUpdateObject` function
- if we want, the resource processor could not even operate on doctrine or even database - it just needs to implement specific method (`public function process(iterable $dataRows): void`) and inside it can write to database, queue, redis... anything πŸš€ 

Copied from original issue: solutionDrive/SyliusImportExportPlugin#4

Some dependency broke behat-suite

After updating the composer packages, the behat suite does not run any longer. I also restarted the last successfull build in travis and the build was broken with the same error.

The error is:

In ParameterBag.php line 102:

The service "test.behat.context.cli_countries_context" has a dependency on a non-existent parameter "symfony.kernel.project_dir".

The output of the composer update on my machine were:

Package operations: 0 installs, 8 updates, 0 removals

  • Updating twig/twig (v2.4.4 => v2.4.6): Downloading (100%)
  • Updating sylius/sylius (v1.1.0 => v1.1.1): Downloading (100%)
  • Updating symfony/symfony (v3.4.4 => v3.4.5): Downloading (100%)
  • Updating doctrine/orm (v2.6.0 => v2.6.1): Downloading (100%)
  • Updating sensiolabs/security-checker (v4.1.7 => v4.1.8): Downloading (100%)
  • Updating friendsofsymfony/rest-bundle (2.3.0 => 2.3.1): Downloading (100%)
  • Updating slevomat/coding-standard (4.4.6 => 4.5.0): Downloading (100%)
  • Updating nikic/php-parser (v3.1.4 => v3.1.5): Downloading (100%)

README config suggestion is not working

From README:

fos_sylius_import_export:
    importer:
      # set to false to not add an upload form to the entity overview pages
        web_ui:               true
        # set to an integer value to flush the object manager in regular intervals
        batch_size:           false
        # if incomplete rows (ie. missing required fields) should be considered failures
        fail_on_incomplete:   false
        # if to stop the import process in case of a failure
        stop_on_failure:      false

Using this out of the box results in:

Fatal error: Uncaught Symfony\Component\Config\Definition\Exception\InvalidTypeException: Invalid type for path "fos_sylius_import_export.importer.batch_size". Expected int, but got boolean. in /var/www/webshop/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/IntegerNode.php:29

Leaving batch_size out of there, makes it work again. I think we should either suggest an integer or maybe use ~ if that's possible to revert back to the default if users are simply copy pasting the defaults. They are often read as suggested settings I think.

setup scrutinizer

From @lsmith77 on October 28, 2017 19:30

Copied from original issue: solutionDrive/SyliusImportExportPlugin#11

Badges are invalid

The packagist badge in README.md contains invalid badge references. Can you please fix it? :)

Export requires write permissions

Running into this because my filesystem is read-only (Platform.SH) besides some pre-defined folders:

ErrorException: fopen(order-2018-03-30.csv): failed to open stream: Read-only file system
#14 vendor/friendsofsylius/sylius-import-export-plugin/src/Writer/CsvWriter.php(37): handleError
#13 vendor/sentry/sentry/lib/Raven/ErrorHandler.php(0): fopen
#12 vendor/friendsofsylius/sylius-import-export-plugin/src/Writer/CsvWriter.php(37): setFile
#11 vendor/friendsofsylius/sylius-import-export-plugin/src/Exporter/ResourceExporter.php(59): setExportFile
#10 vendor/friendsofsylius/sylius-import-export-plugin/src/Controller/ExportDataController.php(72): exportData
#9 vendor/friendsofsylius/sylius-import-export-plugin/src/Controller/ExportDataController.php(49): exportAction
#8 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(151): handleRaw
#7 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php(68): handle
#6 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(202): handle
#5 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php(462): forward
#4 vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/HttpCache/HttpCache.php(57): forward
#3 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php(416): fetch
#2 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php(313): lookup
#1 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php(188): handle
#0 web/app.php(28): null

Export keys need to be defined twice

Per example, the keys (id, code & enabled) are defined twice. What's the reason to do this? And could we maybe extract them away in another service that's managing the keys?

Further, shouldn't they be case sensitive? Field names can also have different casing.

services:
    sylius.exporter.countries.csv:
        class: FriendsOfSylius\SyliusImportExportPlugin\Exporter\ResourceExporter
        arguments:
            - "@sylius.exporter.csv_writer"
            - "@sylius.exporter.pluginpool.countries"
            - ["Id", "Code", "Enabled"]
        tags:
            - { name: sylius.exporter, type: country, format: csv }

    sylius.exporter.pluginpool.countries:
        class: FriendsOfSylius\SyliusImportExportPlugin\Exporter\Plugin\PluginPool
        arguments:
            - ["@sylius.exporter.plugin.resource.country"]
            - ["Id", "Code" ,"Enabled"]

    sylius.exporter.plugin.resource.countries:
        class: FriendsOfSylius\SyliusImportExportPlugin\Exporter\Plugin\ResourcePlugin
        arguments:
            - "@sylius.repository.country"
            - "@property_accessor"
            - "@doctrine.orm.entity_manager"

Suggests outdated?

    "suggest": {
        "portphp/excel": "To support importing excel files, use dev-master",
        "portphp/csv": "To support importing csv files, use dev-master"
    },

Is it still advised to use dev-master?

add product importer

From @lsmith77 on October 28, 2017 19:20

optionally overwrite existing product data

Copied from original issue: solutionDrive/SyliusImportExportPlugin#1

Cannot install plugin with Sylius 1.1.4

When doing composer require friendsofsylius/sylius-import-export-plugin --dev, composer throw this error:

capture d ecran 2018-04-11 a 10 27 58

It seems that this plugin conflicts with Symfony 3.4.5+, which is required by Sylius 1.1.4 (symfony/symfony locked at 3.4.8), but I don't know why.

Export memory usage

My custom order export currently simply exports all orders to either CSV or Excel. On the first run in production (without grid filters) trying to export to CSV, I'm running into memory issues already with a memory limit of around 130mb:

Symfony\Component\Debug\Exception\OutOfMemoryException: Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)
  File "vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php", line 2780
    $this->originalEntityData[$oid][$field] = $pColl;

Probably the grid filters are going to help, but memory consumption is an issue anyway probably.

collect metadata during import

From @lsmith77 on October 28, 2017 19:24

like number of items imported, failures, time consumed

Copied from original issue: solutionDrive/SyliusImportExportPlugin#6

add exporter infrastructure

From @lsmith77 on October 28, 2017 19:21

or should export be moved to a different plugin? I think there is likely some overlap in code needed but not a lot either. of course any overlapping code could also be moved to a separate lib.

of course if we drop export from this plugin, we would need to rename the namespace

Copied from original issue: solutionDrive/SyliusImportExportPlugin#3

Import form is shown while no importer is defined

This is my config, but I haven't defined a 'country' importer. The form is still shown in my admin, which is not really something I would like in this case. Related to #69. Should we make it configurable?

services:
    sylius.exporter.countries.csv:
        class: FriendsOfSylius\SyliusImportExportPlugin\Exporter\ResourceExporter
        arguments:
            - "@sylius.exporter.csv_writer"
            - "@sylius.exporter.pluginpool.countries"
            - ["Id", "Code", "Enabled"]
        tags:
            - { name: sylius.exporter, type: country, format: csv }

    sylius.exporter.pluginpool.countries:
        class: FriendsOfSylius\SyliusImportExportPlugin\Exporter\Plugin\PluginPool
        arguments:
            - ["@sylius.exporter.plugin.resource.country"]
            - ["Id", "Code" ,"Enabled"]

    sylius.exporter.plugin.resource.country:
        class: FriendsOfSylius\SyliusImportExportPlugin\Exporter\Plugin\ResourcePlugin
        arguments:
            - "@sylius.repository.country"
            - "@property_accessor"
            - "@doctrine.orm.entity_manager"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.