Skip to content

Commit

Permalink
Merge pull request #68 from wagnert/master
Browse files Browse the repository at this point in the history
Add documentation for additional installation options
  • Loading branch information
wagnert authored Mar 27, 2017
2 parents b3c47cc + 94e6852 commit 3c233b8
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 53 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Version 1.0.0-alpha57

## Bugfixes

* None

## Features

* Refactor Import + RegistryProcessor initialization

# Version 1.0.0-alpha56

## Bugfixes
Expand Down
56 changes: 52 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,54 @@ that provide import functionality for Magento 2. This repository, based on Symfo
[M2IF](https://github.com/techdivision/import) and provides a command line tool with import functionality for
Magento 2 standard CSV files.

To install the package, assuming composer is available, open a console and enter
### Install as Composer Project

To install the package as a new project, assuming composer is available, open a console and enter

```sh
$ composer create-project techdivision/import-cli-simple --no-dev --stability=alpha
```

This will clone the repository from the internal Gitlab and install the M2IF, that's all.

### Install as Composer Library

The second option will be the installation as a Composer library. For example, if you want to deliver it with
your Magento 2 project, simply add

```json
{
"require": {
"techdivision/import-cli-simple" : "1.0.0-alpha56"
}
}
```

to your Magento 2 composer.json file. Then run

```sh
$ composer update
```

from your Magento 2 root directory and your're all setup.

### Use as PHAR

The last, but for sure not the worst installation option, is to download the latest PHAR from our
[Github](https://github.com/techdivision/import-cli-simple/releases) release page, e. g. with `wget`

```sh
$ wget https://github.com/techdivision/import-cli-simple/releases/download/1.0.0-alpha56/import-cli-simple.phar
```

To install globally put `import-cli-simple.phar` in `/usr/bin`, e. g.

```sh
sudo chmod +x import-cli-simple.phar && mv import-cli-simple.phar /usr/bin/import-cli-simple
```

Now you can use it just like `import-cli-simple`.

## Configuration

The necessary configuration has to be defined in a simple JSON file. An example that imports the Magento 2
Expand Down Expand Up @@ -75,6 +115,7 @@ for the available operations.
"installation-dir" : "/var/www/magento",
"utility-class-name" : "TechDivision\\Import\\Utils\\SqlStatements",
"databases" : [ ... ],
"loggers" : [ ... ],
"operations" : { ... }
}
```
Expand Down Expand Up @@ -117,7 +158,8 @@ least one logger instance is necessary. By default, if no logger has been config
instanciated, that writes log messages to the error log that has been configured in the `php.ini` file of the used
PHP installation.

To add additional loggers, or override the default one, the configuration file can be extended like
To add additional loggers, or override the default one with name `system, the configuration file can be extended
like

```json
"loggers": [
Expand Down Expand Up @@ -473,8 +515,14 @@ The debug mode provides a more detailed logging output, by automatically setting
* product links (related, upsell, crosssell, etc.) for SKUs which are **NOT** available
* configurable products for SKUs which are **NOT** available or available more than one time

but logs these issues as warnings to the console. This will help developers to test imports with partially
invalid CSV files which do **NOT** break data consistency.
but logs these issues as warnings to the console.

When the debug mode has been enabled, missing attribute option values will **NOT** throw an exception, instead
they will logged and put on an internal stack. If the [MissingOptionValuesPlugin](https://github.com/techdivision/import#missing-option-values)
has been enabled, a CSV file with the missing option values will be created in the temporary import folder. If
a Swift Mailer has been enabled by the plugin configuration, the CSV file will be sent to the given mail addresses.

This will help developers to test imports with partially invalid CSV files which do **NOT** break data consistency.

## Running Parallel Imports

Expand Down
1 change: 0 additions & 1 deletion src/Configuration/Logger/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace TechDivision\Import\Cli\Configuration\Logger;

use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\SerializedName;
use TechDivision\Import\Cli\Configuration\ParamsTrait;
use TechDivision\Import\Configuration\Logger\FormatterConfigurationInterface;

Expand Down
1 change: 0 additions & 1 deletion src/Configuration/Logger/Processor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
namespace TechDivision\Import\Cli\Configuration\Logger;

use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\SerializedName;
use TechDivision\Import\Cli\Configuration\ParamsTrait;
use TechDivision\Import\Configuration\Logger\ProcessorConfigurationInterface;

Expand Down
73 changes: 26 additions & 47 deletions src/Services/ImportProcessorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,89 +63,68 @@ public static function factory(\PDO $connection, ConfigurationInterface $configu
$utilityClassName = $configuration->getUtilityClassName();

// initialize the repository that provides category query functionality
$categoryRepository = new CategoryRepository();
$categoryRepository->setUtilityClassName($utilityClassName);
$categoryRepository->setConnection($connection);
$categoryRepository = new CategoryRepository($connection, $utilityClassName);
$categoryRepository->init();

// initialize the repository that provides category varchar value query functionality
$categoryVarcharRepository = new CategoryVarcharRepository();
$categoryVarcharRepository->setUtilityClassName($utilityClassName);
$categoryVarcharRepository->setConnection($connection);
$categoryVarcharRepository = new CategoryVarcharRepository($connection, $utilityClassName);
$categoryVarcharRepository->init();

// initialize the repository that provides EAV attribute query functionality
$eavAttributeRepository = new EavAttributeRepository();
$eavAttributeRepository->setUtilityClassName($utilityClassName);
$eavAttributeRepository->setConnection($connection);
$eavAttributeRepository = new EavAttributeRepository($connection, $utilityClassName);
$eavAttributeRepository->init();

// initialize the repository that provides EAV attribute set query functionality
$eavAttributeSetRepository = new EavAttributeSetRepository();
$eavAttributeSetRepository->setUtilityClassName($utilityClassName);
$eavAttributeSetRepository->setConnection($connection);
$eavAttributeSetRepository = new EavAttributeSetRepository($connection, $utilityClassName);
$eavAttributeSetRepository->init();

// initialize the repository that provides EAV entity type query functionality
$eavEntityTypeRepository = new EavEntityTypeRepository();
$eavEntityTypeRepository->setUtilityClassName($utilityClassName);
$eavEntityTypeRepository->setConnection($connection);
$eavEntityTypeRepository = new EavEntityTypeRepository($connection, $utilityClassName);
$eavEntityTypeRepository->init();

// initialize the repository that provides store query functionality
$storeRepository = new StoreRepository();
$storeRepository->setUtilityClassName($utilityClassName);
$storeRepository->setConnection($connection);
$storeRepository = new StoreRepository($connection, $utilityClassName);
$storeRepository->init();

// initialize the repository that provides store website query functionality
$storeWebsiteRepository = new StoreWebsiteRepository();
$storeWebsiteRepository->setUtilityClassName($utilityClassName);
$storeWebsiteRepository->setConnection($connection);
$storeWebsiteRepository = new StoreWebsiteRepository($connection, $utilityClassName);
$storeWebsiteRepository->init();

// initialize the repository that provides tax class query functionality
$taxClassRepository = new TaxClassRepository();
$taxClassRepository->setUtilityClassName($utilityClassName);
$taxClassRepository->setConnection($connection);
$taxClassRepository = new TaxClassRepository($connection, $utilityClassName);
$taxClassRepository->init();

// initialize the repository that provides link type query functionality
$linkTypeRepository = new LinkTypeRepository();
$linkTypeRepository->setUtilityClassName($utilityClassName);
$linkTypeRepository->setConnection($connection);
$linkTypeRepository = new LinkTypeRepository($connection, $utilityClassName);
$linkTypeRepository->init();

// initialize the repository that provides link attribute query functionality
$linkAttributeRepository = new LinkAttributeRepository();
$linkAttributeRepository->setUtilityClassName($utilityClassName);
$linkAttributeRepository->setConnection($connection);
$linkAttributeRepository = new LinkAttributeRepository($connection, $utilityClassName);
$linkAttributeRepository->init();

// initialize the repository that provides core config data functionality
$coreConfigDataRepository = new CoreConfigDataRepository(new CoreConfigDataUidGenerator());
$coreConfigDataRepository->setUtilityClassName($utilityClassName);
$coreConfigDataRepository->setConnection($connection);
$coreConfigDataRepository = new CoreConfigDataRepository(new CoreConfigDataUidGenerator(), $connection, $utilityClassName);
$coreConfigDataRepository->init();

// initialize the category assembler
$categoryAssembler = new CategoryAssembler($categoryRepository, $categoryVarcharRepository);

// initialize the import processor
$importProcessor = new ImportProcessor();
$importProcessor->setConnection($connection);
$importProcessor->setCategoryRepository($categoryRepository);
$importProcessor->setCategoryVarcharRepository($categoryVarcharRepository);
$importProcessor->setEavAttributeRepository($eavAttributeRepository);
$importProcessor->setEavAttributeSetRepository($eavAttributeSetRepository);
$importProcessor->setEavEntityTypeRepository($eavEntityTypeRepository);
$importProcessor->setStoreRepository($storeRepository);
$importProcessor->setStoreWebsiteRepository($storeWebsiteRepository);
$importProcessor->setTaxClassRepository($taxClassRepository);
$importProcessor->setLinkTypeRepository($linkTypeRepository);
$importProcessor->setLinkAttributeRepository($linkAttributeRepository);
$importProcessor->setCoreConfigDataRepository($coreConfigDataRepository);
$importProcessor->setCategoryAssembler($categoryAssembler);
$importProcessor = new ImportProcessor(
$connection,
$categoryAssembler,
$categoryRepository,
$categoryVarcharRepository,
$eavAttributeRepository,
$eavAttributeSetRepository,
$eavEntityTypeRepository,
$storeRepository,
$storeWebsiteRepository,
$taxClassRepository,
$linkTypeRepository,
$linkAttributeRepository,
$coreConfigDataRepository
);

// return the initialize import processor instance
return $importProcessor;
Expand Down

0 comments on commit 3c233b8

Please sign in to comment.