friendsofsylius / syliusimportexportplugin Goto Github PK
View Code? Open in Web Editor NEWSylius plugin to import / export data
License: MIT License
Sylius plugin to import / export data
License: MIT License
And not extend base controller, inject services instead of fetching them inside the methods.
On Packagist the master branch reports being last updated on March 30 with commit d8b0926 but there have been several commits since then.
From @lsmith77 on October 28, 2017 19:25
skip on error, transaction batch size etc
Copied from original issue: solutionDrive/SyliusImportExportPlugin#7
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
Probably through configuration or maybe through tagging. E.g. I want an Order exporter in UI, but I do not want an Order Importer. I do want a Countries importer on CLI & UI. Etc :-)
jquery is installed for the test-application in an outdated version.
It is recommended to update to the version 3.0.0.
current:
"jquery": "^2.2.0",
recommended:
jquery ~> 3.0.0
Referenced vulnerabilities:
https://nvd.nist.gov/vuln/detail/CVE-2015-9251
https://nvd.nist.gov/vuln/detail/CVE-2016-10707
From @lsmith77 on October 29, 2017 9:46
Copied from original issue: solutionDrive/SyliusImportExportPlugin#17
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%)
From @lsmith77 on October 29, 2017 9:49
Copied from original issue: solutionDrive/SyliusImportExportPlugin#18
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.
From @lsmith77 on October 29, 2017 9:50
Copied from original issue: solutionDrive/SyliusImportExportPlugin#19
From @lsmith77 on October 29, 2017 9:45
Copied from original issue: solutionDrive/SyliusImportExportPlugin#13
It's now: Country import
, while Import countries
would be nicer. Currently the 'country' term is injected, not the plural version of it - countries.
From @lsmith77 on November 2, 2017 16:1
Copied from original issue: solutionDrive/SyliusImportExportPlugin#25
From @lsmith77 on October 28, 2017 19:27
this will make it possible to add new properties to an entity and automatically supporting it via an importer without adjustments
portphp could be used here
relates to portphp/doctrine#9
Copied from original issue: solutionDrive/SyliusImportExportPlugin#8
From @lsmith77 on October 28, 2017 19:30
Copied from original issue: solutionDrive/SyliusImportExportPlugin#11
From @lsmith77 on October 29, 2017 9:46
optionally overwrite existing images
Copied from original issue: solutionDrive/SyliusImportExportPlugin#16
From @lsmith77 on October 29, 2017 9:46
Copied from original issue: solutionDrive/SyliusImportExportPlugin#17
The packagist badge in README.md contains invalid badge references. Can you please fix it? :)
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
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"
From @lsmith77 on October 29, 2017 9:50
Copied from original issue: solutionDrive/SyliusImportExportPlugin#20
From @lsmith77 on October 28, 2017 19:24
see also https://github.com/php-enqueue
see for some inspiration https://github.com/Sylake/SyliusConsumerPlugin/tree/master/src
Copied from original issue: solutionDrive/SyliusImportExportPlugin#5
From @lsmith77 on October 29, 2017 9:46
Copied from original issue: solutionDrive/SyliusImportExportPlugin#15
"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
?
WDYT?
From @lsmith77 on October 28, 2017 19:20
optionally overwrite existing product data
Copied from original issue: solutionDrive/SyliusImportExportPlugin#1
From @lsmith77 on October 28, 2017 19:20
Copied from original issue: solutionDrive/SyliusImportExportPlugin#2
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.
From @lsmith77 on October 28, 2017 19:24
like number of items imported, failures, time consumed
Copied from original issue: solutionDrive/SyliusImportExportPlugin#6
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
From @lsmith77 on October 29, 2017 9:45
Copied from original issue: solutionDrive/SyliusImportExportPlugin#14
From @lsmith77 on October 29, 2017 10:19
Copied from original issue: solutionDrive/SyliusImportExportPlugin#21
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"
From @lsmith77 on October 28, 2017 19:29
Copied from original issue: solutionDrive/SyliusImportExportPlugin#9
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.