├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ └── feature_request.md
└── workflows
│ └── php.yml
├── .gitignore
├── CHANGELOG.md
├── LICENSE.txt
├── README.md
├── RoboFile.php
├── composer.json
├── etc
├── configuration.json
└── configuration
│ ├── finder-mappings.json
│ ├── listeners.json
│ ├── loggers.json
│ ├── operations.json
│ └── shortcuts.json
├── phpcs.xml
├── phpmd.xml
├── phpunit.xml
├── src
├── Adapter
│ ├── Csv
│ │ ├── ExportConfigFactory.php
│ │ ├── ExportConfigFactoryInterface.php
│ │ ├── LexerConfigFactory.php
│ │ └── LexerConfigFactoryInterface.php
│ ├── CsvExportAdapter.php
│ ├── CsvExportAdapterFactory.php
│ ├── CsvImportAdapter.php
│ ├── CsvImportAdapterFactory.php
│ ├── ExportAdapterFactoryInterface.php
│ ├── ExportAdapterInterface.php
│ ├── FilesystemAdapterFactoryInterface.php
│ ├── FilesystemAdapterInterface.php
│ ├── Goodby
│ │ ├── Exporter.php
│ │ ├── Interpreter.php
│ │ └── Lexer.php
│ ├── ImportAdapterFactoryInterface.php
│ ├── ImportAdapterInterface.php
│ ├── PhpFilesystemAdapter.php
│ ├── PhpFilesystemAdapterFactory.php
│ ├── SerializerAwareAdapterInterface.php
│ └── SerializerTrait.php
├── ApplicationInterface.php
├── Assembler
│ ├── CategoryAssembler.php
│ └── CategoryAssemblerInterface.php
├── Callbacks
│ ├── AbstractBooleanCallback.php
│ ├── AbstractCallback.php
│ ├── AbstractEavAwareCallback.php
│ ├── AbstractMultiselectCallback.php
│ ├── AbstractSelectCallback.php
│ ├── AbstractValidatorCallback.php
│ ├── ArrayValidatorCallback.php
│ ├── BooleanValidatorCallback.php
│ ├── CallbackFactoryInterface.php
│ ├── CallbackInterface.php
│ ├── CallbackVisitor.php
│ ├── CallbackVisitorInterface.php
│ ├── CommaDelimiterSkuRelationsValidatorCallback.php
│ ├── DatetimeValidatorCallback.php
│ ├── EmptyValueValidatorCallback.php
│ ├── IndexedArrayValidatorCallback.php
│ ├── MultipleValuesValidatorCallback.php
│ ├── MultiselectValidatorCallback.php
│ ├── NumberValidatorCallback.php
│ ├── PipeDelimiterSkuRelationsValidatorCallback.php
│ ├── RegexValidatorCallback.php
│ ├── SelectValidatorCallback.php
│ └── StoreWebsiteValidatorCallback.php
├── ConfigurationManagerInterface.php
├── ConsoleOptionLoaderInterface.php
├── Events
│ ├── EmitterFactory.php
│ └── EmitterFactoryInterface.php
├── Exceptions
│ ├── ApplicationFinishedException.php
│ ├── ApplicationStoppedException.php
│ ├── FileNotFoundException.php
│ ├── ImportAlreadyRunningException.php
│ ├── InvalidDataException.php
│ ├── LineNotFoundException.php
│ ├── MissingFileException.php
│ ├── MissingOkFileException.php
│ ├── OkFileNotEmptyException.php
│ └── WrappedColumnException.php
├── Execution
│ ├── ConfigurationManager.php
│ └── ExecutionContext.php
├── Handlers
│ ├── GenericFileHandler.php
│ ├── GenericFileHandlerInterface.php
│ ├── HandlerFactoryInterface.php
│ ├── HandlerInterface.php
│ ├── OkFileHandler.php
│ ├── OkFileHandlerFactory.php
│ ├── OkFileHandlerInterface.php
│ ├── PidFileHandler.php
│ └── PidFileHandlerInterface.php
├── HeaderTrait.php
├── Interfaces
│ ├── HookAwareInterface.php
│ └── PregMatchAwareInterface.php
├── Listeners
│ ├── ArchiveListener.php
│ ├── CacheUrlRewriteListener.php
│ ├── ClearArtefactsListener.php
│ ├── ClearDirectoriesListener.php
│ ├── ClearRegistryListener.php
│ ├── FinalizeRegistryListener.php
│ ├── ImportHistoryListener.php
│ ├── InitializeDirectoriesListener.php
│ ├── InitializeRegistryListener.php
│ ├── InvalidDataListener.php
│ ├── MissingFilesListener.php
│ ├── PrepareDebugDumpListener.php
│ ├── ReduceAttributeOptionValueListener.php
│ ├── RenderAnsiArtListener.php
│ ├── RenderDebugInfoListener.php
│ ├── RenderMysqlInfoListener.php
│ ├── RenderOperationInfoListener.php
│ ├── RenderOperationReportListener.php
│ ├── RenderValidationsListener.php
│ ├── Renderer
│ │ ├── Debug
│ │ │ ├── AbstractDebugRenderer.php
│ │ │ ├── ConfigurationFileRenderer.php
│ │ │ ├── GenericDebugCompositeRenderer.php
│ │ │ ├── InfoFileRenderer.php
│ │ │ └── ReportFileRenderer.php
│ │ ├── GenericCompositeRenderer.php
│ │ ├── RendererInterface.php
│ │ └── Validations
│ │ │ ├── GenericConsoleTableRenderer.php
│ │ │ ├── JsonFileRenderer.php
│ │ │ ├── SystemLoggerRenderer.php
│ │ │ └── ValidationRendererInterface.php
│ ├── ResetLoaderListener.php
│ ├── ResetLoggerListener.php
│ ├── StopValidationListener.php
│ └── ValidateHeaderRowListener.php
├── Loaders
│ ├── ArtefactsLoader.php
│ ├── AttributeGroupNameLoader.php
│ ├── AttributeSetNameLoader.php
│ ├── BooleanOptionValueLoader.php
│ ├── ColumnMetadataLoader.php
│ ├── ColumnNameLoader.php
│ ├── ConfigurationValueLoader.php
│ ├── CoreConfigDataLoader.php
│ ├── EavAttributeOptionValueLoader.php
│ ├── EntityTypeCodeLoader.php
│ ├── EntityTypeHeaderMappingLoader.php
│ ├── ExcludePrimaryKeyColumnNameLoader.php
│ ├── FilesystemLoader.php
│ ├── FilteredByEntityTypeCodeLoader.php
│ ├── FilteredByExecutionContextEntityTypeCodeLoader.php
│ ├── FilteredLoader.php
│ ├── FilteredLoaderInterface.php
│ ├── Filters
│ │ ├── ArrayFilterImpl.php
│ │ ├── DefaultOkFileFilter.php
│ │ ├── FilterImplInterface.php
│ │ ├── FilterInterface.php
│ │ ├── OkFileFilter.php
│ │ ├── PregMatchFilter.php
│ │ └── PregMatchFilterInterface.php
│ ├── GenericMemberNameLoader.php
│ ├── HeaderMappingLoader.php
│ ├── LoaderFactoryInterface.php
│ ├── LoaderInterface.php
│ ├── MysqlVariablesLoader.php
│ ├── PregMatchFilteredLoader.php
│ ├── PregMatchFilteredLoaderInterface.php
│ ├── ProposedFilenameLoader.php
│ ├── ProposedOkFilenameLoader.php
│ ├── ProposedOkFilenameLoaderFactory.php
│ ├── RawEntityLoader.php
│ ├── RegistryLoader.php
│ ├── ResetAwareLoaderInterface.php
│ ├── SortedLoader.php
│ ├── SortedLoaderInterface.php
│ ├── Sorters
│ │ ├── DefaultOkFileSorter.php
│ │ ├── SortStringsAscSorter.php
│ │ ├── SorterImplInterface.php
│ │ └── UasortImpl.php
│ ├── SourceAndTargetDirLoader.php
│ ├── StoreLoader.php
│ ├── StoreWebsiteLoader.php
│ └── ValidationLoader.php
├── Loggers
│ ├── ErrorLogHandlerFactory.php
│ ├── FormatterFactoryInterface.php
│ ├── GenericLogHandlerFactory.php
│ ├── HandlerFactoryInterface.php
│ ├── Handlers
│ │ ├── HandlerWrapper.php
│ │ └── ResetAwareHandlerInterface.php
│ ├── LineFormatterFactory.php
│ ├── LoggerFactory.php
│ ├── LoggerFactoryInterface.php
│ ├── MonologLoggerFactory.php
│ ├── MonologLoggerFormatterFactory.php
│ ├── MonologLoggerFormatterFactoryInterface.php
│ ├── MonologLoggerHandlerFactory.php
│ ├── MonologLoggerHandlerFactoryInterface.php
│ ├── ProcessorFactoryInterface.php
│ ├── SerialProcessor.php
│ ├── StreamHandlerFactory.php
│ ├── SwiftMailer
│ │ ├── SendmailTransportMailerFactory.php
│ │ ├── SmtpTransportMailerFactory.php
│ │ └── TransportMailerFactoryInterface.php
│ ├── SwiftMailerHandlerFactory.php
│ └── WrapperHandlerFactory.php
├── Modules
│ ├── ModuleInterface.php
│ └── PluginModule.php
├── Observers
│ ├── AbstractAttributeObserver.php
│ ├── AbstractColumnCollectorObserver.php
│ ├── AbstractObserver.php
│ ├── AdditionalAttributeObserver.php
│ ├── AttributeCodeAndValueAwareObserverInterface.php
│ ├── AttributeLoaderInterface.php
│ ├── AttributeObserverTrait.php
│ ├── AttributeSetObserver.php
│ ├── CleanUpEmptyColumnsTrait.php
│ ├── DynamicAttributeLoader.php
│ ├── DynamicAttributeObserverInterface.php
│ ├── EntityMergers
│ │ ├── CleanUpColumnsEntityMerger.php
│ │ ├── EntityMergerInterface.php
│ │ └── GenericCompositeEntityMerger.php
│ ├── GenericColumnCollectorObserver.php
│ ├── GenericCompositeObserver.php
│ ├── GenericIndexedColumnCollectorObserver.php
│ ├── GenericValidationObserver.php
│ ├── ObserverFactoryInterface.php
│ ├── ObserverInterface.php
│ ├── ObserverVisitor.php
│ ├── ObserverVisitorInterface.php
│ ├── StateDetectorAwareObserverInterface.php
│ ├── StateDetectorInterface.php
│ └── StateDetectors
│ │ └── SimpleStateDetector.php
├── Plugins
│ ├── AbstractPlugin.php
│ ├── CreateOkFilesPlugin.php
│ ├── ExportablePluginInterface.php
│ ├── ExportableTrait.php
│ ├── GlobalDataPlugin.php
│ ├── MissingOptionValuesPlugin.php
│ ├── PluginExecutor.php
│ ├── PluginExecutorInterface.php
│ ├── PluginFactory.php
│ ├── PluginFactoryInterface.php
│ ├── PluginInterface.php
│ ├── SubjectAwarePluginInterface.php
│ ├── SubjectPlugin.php
│ └── VoidPlugin.php
├── Repositories
│ ├── AdminUserRepository.php
│ ├── AdminUserRepositoryInterface.php
│ ├── CategoryRepository.php
│ ├── CategoryRepositoryInterface.php
│ ├── CategoryVarcharRepository.php
│ ├── CategoryVarcharRepositoryInterface.php
│ ├── CoreConfigDataRepository.php
│ ├── CoreConfigDataRepositoryInterface.php
│ ├── CustomerGroupRepository.php
│ ├── CustomerGroupRepositoryInterface.php
│ ├── EavAttributeGroupRepository.php
│ ├── EavAttributeGroupRepositoryInterface.php
│ ├── EavAttributeOptionValueRepository.php
│ ├── EavAttributeOptionValueRepositoryInterface.php
│ ├── EavAttributeRepository.php
│ ├── EavAttributeRepositoryInterface.php
│ ├── EavAttributeSetRepository.php
│ ├── EavAttributeSetRepositoryInterface.php
│ ├── EavEntityTypeRepository.php
│ ├── EavEntityTypeRepositoryInterface.php
│ ├── ImageTypeRepository.php
│ ├── ImageTypeRepositoryInterface.php
│ ├── LinkAttributeRepository.php
│ ├── LinkAttributeRepositoryInterface.php
│ ├── LinkTypeRepository.php
│ ├── LinkTypeRepositoryInterface.php
│ ├── RepositoryInterface.php
│ ├── SqlStatementRepository.php
│ ├── StoreRepository.php
│ ├── StoreRepositoryInterface.php
│ ├── StoreWebsiteRepository.php
│ ├── StoreWebsiteRepositoryInterface.php
│ ├── TaxClassRepository.php
│ ├── TaxClassRepositoryInterface.php
│ ├── UrlRewriteRepository.php
│ └── UrlRewriteRepositoryInterface.php
├── RowTrait.php
├── Serializers
│ ├── AdditionalAttributeCsvSerializerFactory.php
│ ├── CategoryCsvSerializerFactory.php
│ ├── ProductCategoryCsvSerializerFactory.php
│ └── ValueCsvSerializerFactory.php
├── Services
│ ├── ConfigurationProcessor.php
│ ├── ConfigurationProcessorInterface.php
│ ├── EavAwareProcessorInterface.php
│ ├── ImportProcessor.php
│ ├── ImportProcessorInterface.php
│ ├── RegistryProcessor.php
│ ├── RegistryProcessorInterface.php
│ └── UrlKeyAwareProcessorInterface.php
├── Subjects
│ ├── AbstractEavSubject.php
│ ├── AbstractSubject.php
│ ├── CastValueSubjectInterface.php
│ ├── CleanUpColumnsSubjectInterface.php
│ ├── DateConverterSubjectInterface.php
│ ├── DateConverterTrait.php
│ ├── EavSubjectInterface.php
│ ├── EntitySubjectInterface.php
│ ├── ExportableSubjectInterface.php
│ ├── ExportableTrait.php
│ ├── FileResolver
│ │ ├── AbstractFileResolver.php
│ │ ├── FileResolverFactory.php
│ │ ├── FileResolverFactoryInterface.php
│ │ ├── FileResolverInterface.php
│ │ ├── MoveFilesFileResolver.php
│ │ └── OkFileAwareFileResolver.php
│ ├── FileUploadSubjectInterface.php
│ ├── FileUploadTrait.php
│ ├── FileWriter
│ │ ├── FileWriterFactory.php
│ │ ├── FileWriterFactoryInterface.php
│ │ ├── FileWriterInterface.php
│ │ ├── OkFileAwareFileWriter.php
│ │ └── OkFileAwareFileWriterInterface.php
│ ├── FilesystemSubjectInterface.php
│ ├── FilesystemTrait.php
│ ├── I18n
│ │ ├── DateConverterFactory.php
│ │ ├── DateConverterFactoryInterface.php
│ │ ├── DateConverterInterface.php
│ │ ├── NumberConverterFactory.php
│ │ ├── NumberConverterFactoryInterface.php
│ │ ├── NumberConverterInterface.php
│ │ ├── SimpleDateConverter.php
│ │ └── SimpleNumberConverter.php
│ ├── MoveFilesSubject.php
│ ├── NumberConverterSubjectInterface.php
│ ├── NumberConverterTrait.php
│ ├── SubjectExecutor.php
│ ├── SubjectExecutorInterface.php
│ ├── SubjectFactory.php
│ ├── SubjectFactoryInterface.php
│ ├── SubjectInterface.php
│ ├── UrlKeyAwareSubjectInterface.php
│ └── ValidatorSubject.php
├── SystemLoggerTrait.php
└── Utils
│ ├── BackendTypeKeys.php
│ ├── BunchKeys.php
│ ├── CacheKeys.php
│ ├── ColumnKeys.php
│ ├── ColumnNamesUtiInterface.php
│ ├── ColumnNamesUtil.php
│ ├── ColumnPlaceholdersUtiInterface.php
│ ├── ColumnPlaceholdersUtil.php
│ ├── ColumnValuesUtil.php
│ ├── ColumnValuesUtilInterface.php
│ ├── CommandNames.php
│ ├── ConfigurationKeys.php
│ ├── ConfigurationUtil.php
│ ├── CoreConfigDataKeys.php
│ ├── DebugUtil.php
│ ├── DebugUtilInterface.php
│ ├── EditionNames.php
│ ├── EditionNamesInterface.php
│ ├── EntityStatus.php
│ ├── EntityTypeCodes.php
│ ├── EnumInterface.php
│ ├── EventNames.php
│ ├── FileUploadConfigurationKeys.php
│ ├── Filter
│ ├── ConvertLiteral.php
│ ├── ConvertLiteralUrl.php
│ └── UrlKeyFilterTrait.php
│ ├── FrontendInputTypes.php
│ ├── Generators
│ ├── CoreConfigDataUidGenerator.php
│ ├── GeneratorInterface.php
│ └── ReverseSequenceGenerator.php
│ ├── InputArgumentKeysInterface.php
│ ├── InputOptionKeysInterface.php
│ ├── LoggerFactory.php
│ ├── LoggerKeys.php
│ ├── Mappings
│ ├── CommandNameToEntityTypeCode.php
│ ├── EntityTypeCodeMapper.php
│ └── MapperInterface.php
│ ├── MemberNames.php
│ ├── OperationKeys.php
│ ├── OperationNames.php
│ ├── PrimaryKeyUtil.php
│ ├── PrimaryKeyUtilInterface.php
│ ├── ProductTypes.php
│ ├── RegistryKeys.php
│ ├── ScopeKeys.php
│ ├── SqlStatementKeys.php
│ ├── StoreViewCodes.php
│ ├── SwiftMailerKeys.php
│ ├── TablePrefixUtil.php
│ ├── TablePrefixUtilInterface.php
│ ├── UrlKeyUtil.php
│ ├── UrlKeyUtilInterface.php
│ └── UrlRewriteEntityType.php
├── symfony
├── DependencyInjection
│ └── ImportExtension.php
├── ImportBundle.php
├── Resources
│ └── config
│ │ └── services.xml
└── Utils
│ └── DependencyInjectionKeys.php
└── tests
└── unit
├── AbstractRowTraitImpl.php
├── Handlers
└── OkFileHandlerTest.php
├── Loaders
└── Filters
│ └── OkFileFilterTest.php
├── Observers
├── AbstractAttributeObserverTest.php
├── AbstractObserverImpl.php
├── AbstractObserverTest.php
├── AdditionalAttributeObserverTest.php
├── AttributeSetObserverTest.php
├── EntitySubjectImpl.php
├── FileUploadSubjectImpl.php
└── ObserverVisitorTest.php
├── Plugins
├── ExportableSubjectImpl.php
├── SubjectPluginTest.php
└── _files
│ └── product-import_20170720-125052_01.csv
├── Repositories
└── SqlStatementRepositoryTest.php
├── RowTraitImpl.php
├── RowTraitTest.php
├── Subjects
├── AbstractEavSubjectTest.php
├── AbstractSubjectTest.php
├── AbstractTest.php
├── ExportableTraitImpl.php
├── ExportableTraitTest.php
├── FileUploadTraitImpl.php
├── FileUploadTraitTest.php
├── FilesystemTraitImpl.php
├── FilesystemTraitTest.php
├── MoveFilesSubjectTest.php
├── PrepareStoreViewCodeObserverImpl.php
├── SkipObserverImpl.php
└── SubjectFactoryTest.php
└── Utils
├── ColumnNamesUtilTest.php
├── ColumnPlaceholdersUtilTest.php
├── ColumnValuesUtilTest.php
└── UrlKeyUtilTest.php
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Desktop (please complete the following information):**
27 | - OS: [e.g. iOS]
28 | - Browser [e.g. chrome, safari]
29 | - Version [e.g. 22]
30 |
31 | **Smartphone (please complete the following information):**
32 | - Device: [e.g. iPhone6]
33 | - OS: [e.g. iOS8.1]
34 | - Browser [e.g. stock browser, safari]
35 | - Version [e.g. 22]
36 |
37 | **Additional context**
38 | Add any other context about the problem here.
39 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/workflows/php.yml:
--------------------------------------------------------------------------------
1 | name: techdivision/import
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | jobs:
10 |
11 | run:
12 | name: Build ${{ matrix.operating-system }} > ${{ matrix.php-versions }}
13 | runs-on: ${{ matrix.operating-system }}
14 | strategy:
15 | matrix:
16 | operating-system: [ ubuntu-latest, macos-latest ]
17 | php-versions: [ '7.3', '7.4' ]
18 |
19 | steps:
20 | - name: Checkout
21 | uses: actions/checkout@v2
22 |
23 | - name: Setup PHP
24 | uses: shivammathur/setup-php@v2
25 | with:
26 | php-version: ${{ matrix.php-versions }}
27 | extensions: zip, xdebug-2.9.8
28 |
29 | - name: Validate Composer Files
30 | run: composer validate
31 |
32 | - name: Install Dependencies
33 | run: composer install --prefer-dist --no-progress --no-suggest
34 |
35 | - name: Run Robo Build
36 | run: vendor/bin/robo build
37 |
38 | - name: Download Scrutinizer-CI Binary
39 | run: wget https://scrutinizer-ci.com/ocular.phar
40 |
41 | - name: Post Coverage Data to Scrutinizer-CI
42 | run: php ocular.phar code-coverage:upload --format=php-clover target/reports/unit/clover.xml
43 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /vendor
2 | /target
3 | .idea
4 | .buildpath
5 | .project
6 | .settings
7 | composer.lock
8 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2021 TechDivision GmbH
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of
6 | this software and associated documentation files (the "Software"), to deal in
7 | the Software without restriction, including without limitation the rights to
8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9 | the Software, and to permit persons to whom the Software is furnished to do so,
10 | subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Pacemaker - Import Framework
2 |
3 | [](https://packagist.org/packages/techdivision/import)
4 | [](https://packagist.org/packages/techdivision/import)
5 | [](https://packagist.org/packages/techdivision/import)
6 | [](http://travis-ci.org/techdivision/import)
7 | [](https://scrutinizer-ci.com/g/techdivision/import/?branch=master) [](https://scrutinizer-ci.com/g/techdivision/import/?branch=master)
8 |
9 | Please visit the Pacemaker [website](https://pacemaker.techdivision.com) or our [documentation](https://docs.met.tdintern.de/pacemaker/1.3/) for additional information
10 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "techdivision/import",
3 | "description": "A library supporting generic Magento 2 import functionality",
4 | "license": "MIT",
5 | "require": {
6 | "php": "^8.1",
7 | "psr/log": "^1.0.0|^2.0.0|^3.0.0",
8 | "psr/cache" : "^2.0.0|^3.0.0",
9 | "psr/container": "^1.1.2",
10 | "handcraftedinthealps/goodby-csv": "^1.4.2",
11 | "monolog/monolog": "^2.9|^3.7",
12 | "league/event": "^2.2.0",
13 | "ramsey/uuid": "^4.2|^4.7",
14 | "swiftmailer/swiftmailer": "v6.3.0",
15 | "laminas/laminas-filter": "^2.31.0",
16 | "techdivision/import-dbal": "^2.0.0",
17 | "techdivision/import-dbal-collection": "^2.0.0",
18 | "techdivision/import-cache": "^2.0.0",
19 | "techdivision/import-cache-collection": "^2.0.0",
20 | "techdivision/import-serializer": "^2.0.0",
21 | "techdivision/import-serializer-csv": "^2.0.0",
22 | "techdivision/import-configuration": "^6.0.0.",
23 | "ext-json": "*",
24 | "ext-zip": "*"
25 | },
26 | "require-dev": {
27 | "doctrine/dbal": "^4.0.4",
28 | "pdepend/pdepend": "^2.16.2",
29 | "phpmd/phpmd": "^2.15.0",
30 | "phpunit/phpunit": "^11.2.5",
31 | "sebastian/phpcpd": "^2.0.1",
32 | "squizlabs/php_codesniffer": "^3.10.1",
33 | "consolidation/robo": "^4.0.2",
34 | "mikey179/vfsstream": "~1.6.11",
35 | "symfony/http-kernel": "~4.4.51"
36 | },
37 | "authors": [
38 | {
39 | "name": "Tim Wagner",
40 | "email": "t.wagner@techdivision.com"
41 | }
42 | ],
43 | "autoload": {
44 | "psr-4": {
45 | "TechDivision\\Import\\": [
46 | "src/",
47 | "symfony/",
48 | "tests/unit/"
49 | ]
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/etc/configuration.json:
--------------------------------------------------------------------------------
1 | {
2 | "magento-edition": "CE",
3 | "magento-version": "2.4.0",
4 | "archive-artefacts": true,
5 | "debug-mode": false,
6 | "strict-mode": true,
7 | "cache-enabled": false,
8 | "username": "admin",
9 | "entity-type-code": "catalog_product",
10 | "source-dir": "var/pacemaker/import",
11 | "target-dir": "var/pacemaker/import",
12 | "empty-attribute-value-constant": "__EMPTY__VALUE__",
13 | "shortcuts": [],
14 | "listeners": [],
15 | "databases": [],
16 | "loggers": [],
17 | "operations": {
18 | "general": [],
19 | "ce": [],
20 | "ee": []
21 | },
22 | "api": {
23 | "magento-domain": ""
24 | },
25 | "ignore-attribute-value-on-update": {},
26 | "config-output": false,
27 | "delimiter": ",",
28 | "enclosure": "\"",
29 | "escape": "\u0000"
30 | }
31 |
--------------------------------------------------------------------------------
/etc/configuration/finder-mappings.json:
--------------------------------------------------------------------------------
1 | {
2 | "finder-mappings": {
3 | "store": {
4 | "TechDivision\\Import\\Utils\\SqlStatementKeys::STORES": "import.repository.finder.factory.yielded"
5 | },
6 | "url_rewrite": {
7 | "TechDivision\\Import\\Utils\\SqlStatementKeys::URL_REWRITES": "import.repository.finder.factory.yielded",
8 | "TechDivision\\Import\\Utils\\SqlStatementKeys::URL_REWRITE_BY_REQUEST_PATH_AND_STORE_ID": "import.repository.finder.factory.unique.cached.static",
9 | "TechDivision\\Import\\Utils\\SqlStatementKeys::URL_REWRITES_BY_ENTITY_TYPE_AND_ENTITY_ID": "import.repository.finder.factory.yielded",
10 | "TechDivision\\Import\\Utils\\SqlStatementKeys::URL_REWRITES_BY_ENTITY_TYPE_AND_ENTITY_ID_AND_STORE_ID": "import.repository.finder.factory.yielded"
11 | },
12 | "core_config_data": {
13 | "TechDivision\\Import\\Utils\\SqlStatementKeys::CORE_CONFIG_DATA": "import.repository.finder.factory.api.core_config_data"
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/etc/configuration/listeners.json:
--------------------------------------------------------------------------------
1 | {
2 | "listeners": [
3 | {
4 | "app.set.up": [
5 | "import.listener.render.ansi.art",
6 | "import.listener.render.operation.info",
7 | "import.listener.render.mysql.info",
8 | "import.listener.render.debug.info",
9 | "import.listener.initialize.registry"
10 | ],
11 | "app.process.transaction.success": [
12 | "import.listener.debug.dump.prepare",
13 | "import.listener.finalize.registry",
14 | "import.listener.render.nostrict.validations",
15 | "import.listener.archive",
16 | "import.listener.clear.artefacts",
17 | "import.listener.clear.directories",
18 | "import.listener.operation.report",
19 | "import.listener.no.files.registry",
20 | "import.listener.invalid.data.no.strict.registry"
21 | ],
22 | "app.process.transaction.failure": [
23 | "import.listener.debug.dump.prepare",
24 | "import.listener.finalize.registry",
25 | "import.listener.render.validations",
26 | "import.listener.render.nostrict.validations"
27 | ],
28 | "app.tear.down": [
29 | "import.listener.import.history",
30 | "import.listener.clear.registry"
31 | ],
32 | "action.create.success.create.url_rewrite": [
33 | "import.listener.cache.url.rewrite"
34 | ],
35 | "action.create.success.update.url_rewrite": [
36 | "import.listener.cache.url.rewrite"
37 | ],
38 | "action.create.success.delete.url_rewrite": [
39 | "import.listener.cache.url.rewrite"
40 | ]
41 | }
42 | ]
43 | }
--------------------------------------------------------------------------------
/etc/configuration/loggers.json:
--------------------------------------------------------------------------------
1 | {
2 | "loggers": {
3 | "system": {
4 | "id": "import.logger.factory.monolog",
5 | "channel-name": "logger/system",
6 | "handlers": [
7 | {
8 | "id": "import.logger.factory.handler.stream.wrapper",
9 | "params": {
10 | "stream": "system.log",
11 | "level": "info"
12 | },
13 | "formatter": {
14 | "id": "import.logger.factory.formatter.line",
15 | "params": {
16 | "format": "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n",
17 | "date-format": "Y-m-d H:i:s",
18 | "allow-inline-line-breaks": true,
19 | "ignore-empty-context-and-extra": true
20 | }
21 | }
22 | },
23 | {
24 | "id": "import.logger.factory.handler.stream.wrapper",
25 | "params": {
26 | "relative": false,
27 | "stream": "php://stdout",
28 | "level": "notice"
29 | },
30 | "formatter": {
31 | "id": "import.logger.factory.formatter.line",
32 | "params": {
33 | "format": "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n",
34 | "date-format": "Y-m-d H:i:s",
35 | "allow-inline-line-breaks": true,
36 | "ignore-empty-context-and-extra": true
37 | }
38 | }
39 | }
40 | ],
41 | "processors": [
42 | {
43 | "id": "import.logger.processor.serial"
44 | },
45 | {
46 | "id": "import.logger.processor.memory.peak.usage"
47 | }
48 | ]
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/etc/configuration/shortcuts.json:
--------------------------------------------------------------------------------
1 | {
2 | "shortcuts": {
3 | "general": {
4 | "general": {
5 | "create-ok-files": [
6 | "general/general/create-ok-files"
7 | ]
8 | }
9 | }
10 | }
11 | }
--------------------------------------------------------------------------------
/phpcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 | TechDivision GmbH coding standard
9 |
10 |
11 | */doc/*
12 | */tests/*
13 | */target/*
14 | */vendor/*
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/phpmd.xml:
--------------------------------------------------------------------------------
1 |
2 |
9 |
10 | TechDivision GmbH default PHPMD rule set
11 |
12 |
13 |
14 |
15 |
16 |
17 | */doc/*
18 | */tests/*
19 | */target/*
20 | */vendor/*
21 |
22 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | tests/unit
6 |
7 |
8 |
9 |
10 | src
11 |
12 | src
13 | src
14 |
15 |
16 |
17 |
18 |
19 |
20 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/src/Adapter/Csv/ExportConfigFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Adapter\Csv;
16 |
17 | /**
18 | * Interface for all CSV export configuration factory implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface ExportConfigFactoryInterface
27 | {
28 |
29 | /**
30 | * Factory method to create a new export configuration instance.
31 | *
32 | * @return \Goodby\CSV\Export\Standard\ExporterConfig The export configuration
33 | */
34 | public function createExportConfig();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Adapter/Csv/LexerConfigFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Adapter\Csv;
16 |
17 | /**
18 | * Interface for all CSV lexer configuration factory implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface LexerConfigFactoryInterface
27 | {
28 |
29 | /**
30 | * Factory method to create a new lexer configuration instance.
31 | *
32 | * @return \Goodby\CSV\Import\Standard\LexerConfig The lexer configuration
33 | */
34 | public function createLexerConfig();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Adapter/ExportAdapterFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Adapter;
16 |
17 | use TechDivision\Import\Configuration\ExportAdapterAwareConfigurationInterface;
18 |
19 | /**
20 | * Interface for all CSV export adapter factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface ExportAdapterFactoryInterface
29 | {
30 |
31 | /**
32 | * Creates and returns the export adapter for the subject with the passed configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\ExportAdapterAwareConfigurationInterface $configuration The subject configuration
35 | *
36 | * @return \TechDivision\Import\Adapter\ExportAdapterInterface The export adapter instance
37 | */
38 | public function createExportAdapter(ExportAdapterAwareConfigurationInterface $configuration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Adapter/FilesystemAdapterFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Adapter;
16 |
17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface;
18 |
19 | /**
20 | * The interface for all filesystem factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface FilesystemAdapterFactoryInterface
29 | {
30 |
31 | /**
32 | * Factory method to create new filesystem adapter instance.
33 | *
34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subjectConfiguration The subject configuration
35 | *
36 | * @return \TechDivision\Import\Adapter\FilesystemAdapterInterface The filesystem adapter instance
37 | */
38 | public function createFilesystemAdapter(SubjectConfigurationInterface $subjectConfiguration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Adapter/ImportAdapterFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Adapter;
16 |
17 | use TechDivision\Import\Configuration\ImportAdapterAwareConfigurationInterface;
18 |
19 | /**
20 | * Interface for all CSV import adapter factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface ImportAdapterFactoryInterface
29 | {
30 |
31 | /**
32 | * Creates and returns the import adapter for the subject with the passed configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\ImportAdapterAwareConfigurationInterface $configuration The subject configuration
35 | *
36 | * @return \TechDivision\Import\Adapter\ExportAdapterInterface The import adapter instance
37 | */
38 | public function createImportAdapter(ImportAdapterAwareConfigurationInterface $configuration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Adapter/PhpFilesystemAdapterFactory.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Adapter;
16 |
17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface;
18 |
19 | /**
20 | * A filesystem adapter factory implementation for filesystem implementation that uses plain PHP functions.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | class PhpFilesystemAdapterFactory implements FilesystemAdapterFactoryInterface
29 | {
30 |
31 | /**
32 | * Factory method to create new filesystem adapter instance.
33 | *
34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subjectConfiguration The subject configuration
35 | *
36 | * @return \TechDivision\Import\Adapter\FilesystemAdapterInterface The filesystem adapter instance
37 | */
38 | public function createFilesystemAdapter(SubjectConfigurationInterface $subjectConfiguration)
39 | {
40 | return new PhpFilesystemAdapter();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Assembler/CategoryAssemblerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Assembler;
16 |
17 | /**
18 | *Interface for catagory data assembler implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface CategoryAssemblerInterface
27 | {
28 |
29 | /**
30 | * Returns an array with the available categories and their
31 | * resolved path as keys.
32 | *
33 | * @return array The array with the categories
34 | */
35 | public function getCategoriesWithResolvedPath();
36 |
37 | /**
38 | * Return's an array with the available categories and their resolved path
39 | * as keys by store view ID.
40 | *
41 | * @param integer $storeViewId The store view ID to return the categories for
42 | *
43 | * @return array The available categories for the passed store view ID
44 | */
45 | public function getCategoriesWithResolvedPathByStoreView($storeViewId);
46 | }
47 |
--------------------------------------------------------------------------------
/src/Callbacks/CallbackFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Callbacks;
16 |
17 | use TechDivision\Import\Subjects\SubjectInterface;
18 |
19 | /**
20 | * interface for all callback factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface CallbackFactoryInterface
29 | {
30 |
31 | /**
32 | * Will be invoked by the callback visitor when a factory has been defined to create the callback instance.
33 | *
34 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance
35 | *
36 | * @return \TechDivision\Import\Callbacks\CallbackInterface The callback instance
37 | */
38 | public function createCallback(SubjectInterface $subject);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Callbacks/CallbackInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Callbacks;
16 |
17 | /**
18 | * interface for all callback implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface CallbackInterface
27 | {
28 |
29 | /**
30 | * Will be invoked by a observer it has been registered for.
31 | *
32 | * @return mixed The modified value
33 | */
34 | public function handle();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Callbacks/CallbackVisitorInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Callbacks;
16 |
17 | use TechDivision\Import\Subjects\SubjectInterface;
18 |
19 | /**
20 | * Interface for all callback visitor implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface CallbackVisitorInterface
29 | {
30 |
31 | /**
32 | * Visitor implementation that initializes the observers of the passed subject.
33 | *
34 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject to initialize the observers for
35 | *
36 | * @return void
37 | */
38 | public function visit(SubjectInterface $subject);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Callbacks/IndexedArrayValidatorCallback.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Callbacks;
16 |
17 | /**
18 | * Array validator callback implementation that expects an indexed array with
19 | * validations, whereas the key is the attribute name.
20 | *
21 | * @author Tim Wagner
22 | * @copyright 2019 TechDivision GmbH
23 | * @license https://opensource.org/licenses/MIT
24 | * @link https://github.com/techdivision/import
25 | * @link http://www.techdivision.com
26 | */
27 | class IndexedArrayValidatorCallback extends ArrayValidatorCallback
28 | {
29 |
30 | /**
31 | * Returns the validations for the attribute with the passed code.
32 | *
33 | * @param string|null $attributeCode The code of the attribute to return the validations for
34 | *
35 | * @return array The allowed values for the attribute with the passed code
36 | */
37 | protected function getValidations($attributeCode = null)
38 | {
39 |
40 | // query whether or not if allowed values have been specified
41 | if (isset($this->validations[$attributeCode])) {
42 | return $this->validations[$attributeCode];
43 | }
44 |
45 | // return an empty array, if NOT
46 | return array();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/src/Callbacks/PipeDelimiterSkuRelationsValidatorCallback.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2021 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Callbacks;
16 |
17 | use TechDivision\Import\Exceptions\InvalidDataException;
18 | use TechDivision\Import\Utils\ColumnKeys;
19 | use TechDivision\Import\Utils\RegistryKeys;
20 |
21 | /**
22 | * A callback implementation that validates the a list of values.
23 | *
24 | * @author Kenza Yamlahi
25 | * @copyright 2021 TechDivision GmbH
26 | * @license https://opensource.org/licenses/MIT
27 | * @link https://github.com/techdivision/import
28 | * @link http://www.techdivision.com
29 | */
30 | class PipeDelimiterSkuRelationsValidatorCallback extends CommaDelimiterSkuRelationsValidatorCallback
31 | {
32 |
33 | /**
34 | * @param string $value the value to explode
35 | * @return string
36 | */
37 | protected function explodeDetailsFromValue($value)
38 | {
39 | $skuValue = $this->getSubject()->explode($value, ',');
40 | foreach ($skuValue as $subValue) {
41 | if (str_starts_with($subValue, ColumnKeys::SKU)) {
42 | list(, $value) = $this->getSubject()->explode($subValue, '=');
43 | return $value;
44 | }
45 | }
46 | // Nothing found? Return origin
47 | return $value;
48 | }
49 |
50 | /**
51 | * @return string
52 | */
53 | protected function getAttributeValueDelimiter()
54 | {
55 | return '|';
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/ConfigurationManagerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import;
16 |
17 | /**
18 | * The interface for the import manager implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface ConfigurationManagerInterface
27 | {
28 |
29 | /**
30 | * Return's the managed configuration instance.
31 | *
32 | * @return \TechDivision\Import\Configuration\ConfigurationInterface The configuration instance
33 | */
34 | public function getConfiguration();
35 |
36 | /**
37 | * Return's an array with the configurations of the operations that has to be executed.
38 | *
39 | * @return \TechDivision\Import\Configuration\OperationConfigurationInterface[] The operation configurations
40 | */
41 | public function getOperations();
42 |
43 | /**
44 | * Return's the array with the plugins that has to be executed.
45 | *
46 | * @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the plugins
47 | * @throws \Exception Is thrown, if no plugins are available for the actual operation
48 | */
49 | public function getPlugins();
50 | }
51 |
--------------------------------------------------------------------------------
/src/ConsoleOptionLoaderInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import-configuration-jms
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import;
16 |
17 | use TechDivision\Import\Configuration\ConfigurationInterface;
18 |
19 | /**
20 | * Interface for console option loader implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import-configuration-jms
26 | * @link http://www.techdivision.com
27 | */
28 | interface ConsoleOptionLoaderInterface
29 | {
30 |
31 | /**
32 | * Load's the input options ans try's to initialize the configuration with the values found.
33 | *
34 | * @param \TechDivision\Import\Configuration\ConfigurationInterface $instance The configuration instance to load the values for
35 | *
36 | * @return void
37 | */
38 | public function load(ConfigurationInterface $instance);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Events/EmitterFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Events;
16 |
17 | /**
18 | * Interface for factory implementations to create a new event emitter instance.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface EmitterFactoryInterface
27 | {
28 |
29 | /**
30 | * The factory method that creates a new emitter instance.
31 | *
32 | * @return void
33 | */
34 | public function createEmitter();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Exceptions/ApplicationFinishedException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2021 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | /**
18 | * A exception that is thrown if the application has been finished normally without any error output.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2021 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class ApplicationFinishedException extends ApplicationStoppedException
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Exceptions/ApplicationStoppedException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | /**
18 | * A exception that is thrown if the application has been stopped.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class ApplicationStoppedException extends \Exception
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Exceptions/FileNotFoundException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | /**
18 | * A exception that is thrown if an expected file has not been found.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class FileNotFoundException extends \Exception
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Exceptions/ImportAlreadyRunningException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | /**
18 | * Exception that is thrown, if an import process is already running.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class ImportAlreadyRunningException extends \Exception
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Exceptions/InvalidDataException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2021 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | use Throwable;
18 |
19 | /**
20 | * A exception that is thrown if a import file with invalid Data.
21 | *
22 | * @author MET
23 | * @copyright 2021 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | class InvalidDataException extends \Exception
29 | {
30 | const INVALID_DATA_CODE = 13;
31 |
32 | /**
33 | * Construct the exception. Note: The message is NOT binary safe.
34 | *
35 | * @param string $message [optional] The Exception message to throw.
36 | * @param int $code [optional] The Exception code.
37 | * @param null|Throwable $previous [optional] The previous throwable used for the exception chaining.
38 | */
39 | public function __construct($message = "", $code = self::INVALID_DATA_CODE, Throwable $previous = null)
40 | {
41 | parent::__construct($message, $code, $previous);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Exceptions/LineNotFoundException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | /**
18 | * A exception that is thrown if an expected line in a file has not been found.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class LineNotFoundException extends \Exception
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Exceptions/MissingFileException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2021 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | use Throwable;
18 |
19 | /**
20 | * A exception that is thrown if a import file is missing or the prefix does not correspond Naming convention
21 | *
22 | * @author MET
23 | * @copyright 2021 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | class MissingFileException extends \Exception
29 | {
30 | const NOT_FOUND_CODE = 4;
31 |
32 | /**
33 | * Construct the exception. Note: The message is NOT binary safe.
34 | *
35 | * @param string $message [optional] The Exception message to throw.
36 | * @param int $code [optional] The Exception code.
37 | * @param null|Throwable $previous [optional] The previous throwable used for the exception chaining.
38 | */
39 | public function __construct($message = "", $code = self::NOT_FOUND_CODE, Throwable $previous = null)
40 | {
41 | parent::__construct($message, $code, $previous);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/src/Exceptions/MissingOkFileException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | /**
18 | * Exception that is thrown, if no OK file for a CSV file is available.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class MissingOkFileException extends \Exception
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Exceptions/OkFileNotEmptyException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | /**
18 | * A exception that is thrown if a .OK file is NOT empty, e. g. before it should be deleted.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class OkFileNotEmptyException extends \Exception
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Exceptions/WrappedColumnException.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Exceptions;
16 |
17 | /**
18 | * Interface for the operation configuration implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class WrappedColumnException extends \Exception
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Handlers/HandlerFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Handlers;
16 |
17 | /**
18 | * Interface for handler factory implementations
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface HandlerFactoryInterface
27 | {
28 |
29 | /**
30 | * Create's and return's a new handler instance.
31 | *
32 | * @return \TechDivision\Import\Handlers\HandlerInterface The new handler instance
33 | */
34 | public function createHandler() : HandlerInterface;
35 | }
36 |
--------------------------------------------------------------------------------
/src/Handlers/HandlerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Handlers;
16 |
17 | /**
18 | * A generic handler interface.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface HandlerInterface
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Handlers/PidFileHandlerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Handlers;
16 |
17 | /**
18 | * A generic interface for PID file handler implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface PidFileHandlerInterface extends HandlerInterface
27 | {
28 |
29 | /**
30 | * Persist the UUID of the actual import process to the PID file.
31 | *
32 | * @return void
33 | * @throws \Exception Is thrown, if the PID can not be locked or the PID can not be added
34 | * @throws \TechDivision\Import\Exceptions\ImportAlreadyRunningException Is thrown, if a import process is already running
35 | */
36 | public function lock();
37 |
38 | /**
39 | * Remove's the UUID of the actual import process from the PID file.
40 | *
41 | * @return void
42 | * @throws \Exception Is thrown, if the PID can not be removed
43 | */
44 | public function unlock();
45 | }
46 |
--------------------------------------------------------------------------------
/src/Interfaces/HookAwareInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2021 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Interfaces;
16 |
17 | /**
18 | * Interface for all implementations that are aware of the setUp() and tearDown() hooks.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2021 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface HookAwareInterface
27 | {
28 |
29 | /**
30 | * Intializes the previously loaded global data for exactly one bunch.
31 | *
32 | * @param string $serial The serial of the actual import
33 | *
34 | * @return void
35 | */
36 | public function setUp($serial);
37 |
38 | /**
39 | * Clean up the global data after importing the variants.
40 | *
41 | * @param string $serial The serial of the actual import
42 | *
43 | * @return void
44 | */
45 | public function tearDown($serial);
46 | }
47 |
--------------------------------------------------------------------------------
/src/Listeners/Renderer/Debug/GenericDebugCompositeRenderer.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Listeners\Renderer\Debug;
16 |
17 | use TechDivision\Import\Listeners\Renderer\GenericCompositeRenderer;
18 |
19 | /**
20 | * A generic debug composite renderer instance.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2020 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | class GenericDebugCompositeRenderer extends GenericCompositeRenderer
29 | {
30 |
31 | /**
32 | * Renders the data to some output, e. g. the console or a logger.
33 | *
34 | * @param string $serial The serial of the import to render the dump artefacts for
35 | *
36 | * @return void
37 | */
38 | public function render(string $serial = null)
39 | {
40 | foreach ($this->getRenderers() as $renderer) {
41 | $renderer->render($serial);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/Listeners/Renderer/Debug/InfoFileRenderer.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Listeners\Renderer\Debug;
16 |
17 | use TechDivision\Import\Utils\RegistryKeys;
18 |
19 | /**
20 | * A renderer for the PHP info.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2020 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import-cli
26 | * @link http://www.techdivision.com
27 | */
28 | class InfoFileRenderer extends AbstractDebugRenderer
29 | {
30 |
31 | /**
32 | * Renders the data to some output, e. g. the console or a logger.
33 | *
34 | * @param string $serial The serial of the import to render the dump artefacts for
35 | *
36 | * @return void
37 | */
38 | public function render(string $serial = null)
39 | {
40 |
41 | // load the actual status
42 | $status = $this->getRegistryProcessor()->getAttribute(RegistryKeys::STATUS);
43 |
44 | // clear the filecache
45 | clearstatcache();
46 |
47 | // query whether or not the configured source directory is available
48 | if (!is_dir($sourceDir = $status[RegistryKeys::SOURCE_DIRECTORY])) {
49 | throw new \Exception(sprintf('Configured source directory %s is not available!', $sourceDir));
50 | }
51 |
52 | // render the PHP info content
53 | ob_start();
54 | phpinfo();
55 |
56 | // finally write the PHP info to a file in the source directory
57 | $this->write(ob_get_clean(), sprintf('%s/debug-php-info.txt', $sourceDir));
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Listeners/Renderer/RendererInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Listeners\Renderer;
16 |
17 | /**
18 | * The interface for renderer implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface RendererInterface
27 | {
28 |
29 | /**
30 | * Renders the data to some output, e. g. the console or a logger.
31 | *
32 | * @return void
33 | */
34 | public function render();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Listeners/Renderer/Validations/ValidationRendererInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Listeners\Renderer\Validations;
16 |
17 | use TechDivision\Import\Listeners\Renderer\RendererInterface;
18 |
19 | /**
20 | * The interface for validation renderer implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface ValidationRendererInterface extends RendererInterface
29 | {
30 |
31 | /**
32 | * Renders the validations to some output, e. g. the console or a logger.
33 | *
34 | * @param array $validations The validations to render
35 | *
36 | * @return void
37 | */
38 | public function render(array $validations = array());
39 | }
40 |
--------------------------------------------------------------------------------
/src/Loaders/BooleanOptionValueLoader.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | /**
18 | * Loader for boolean option values.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class BooleanOptionValueLoader implements LoaderInterface
27 | {
28 |
29 | /**
30 | * Array with the string => boolean mapping.
31 | *
32 | * @var array
33 | */
34 | protected $booleanValues = array(
35 | 'true' => 1,
36 | 'yes' => 1,
37 | '1' => 1,
38 | 'false' => 0,
39 | 'no' => 0,
40 | '0' => 0
41 | );
42 |
43 | /**
44 | * Loads and returns data the custom validation data.
45 | *
46 | * @return \ArrayAccess The array with the data
47 | */
48 | public function load()
49 | {
50 | return $this->booleanValues;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/Loaders/ColumnNameLoader.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | /**
18 | * Loader for table column names.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class ColumnNameLoader implements LoaderInterface
27 | {
28 |
29 | /**
30 | * The column metadata loader instance.
31 | *
32 | * @var \TechDivision\Import\Loaders\LoaderInterface
33 | */
34 | protected $columnMetadataLoader;
35 |
36 | /**
37 | * Construct a new instance.
38 | *
39 | * @param \TechDivision\Import\Loaders\LoaderInterface $columnMetadataLoader The column metadata loader instance
40 | */
41 | public function __construct(LoaderInterface $columnMetadataLoader)
42 | {
43 | $this->columnMetadataLoader = $columnMetadataLoader;
44 | }
45 |
46 | /**
47 | * Loads and returns data.
48 | *
49 | * @param string $tableName The table name to return the list for
50 | *
51 | * @return \ArrayAccess The array with the data
52 | */
53 | public function load($tableName = null)
54 | {
55 | return array_keys($this->columnMetadataLoader->load($tableName));
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Loaders/EntityTypeHeaderMappingLoader.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | /**
18 | * A loader that loads the header mappings from the configuration using a specific entity type
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class EntityTypeHeaderMappingLoader implements LoaderInterface
27 | {
28 |
29 | /**
30 | * The header mappings for the entity type with the code passed to the constructor.
31 | *
32 | * @var array
33 | */
34 | private $headerMappings;
35 |
36 | /**
37 | * Initialize the loader with the parent loader and the entity type code.
38 | *
39 | * @param \TechDivision\Import\Loaders\LoaderInterface $parentLoader The parent loader for the header mappings
40 | * @param string $entityTypeCode The entity type code to load the header mappings for
41 | */
42 | public function __construct(LoaderInterface $parentLoader, string $entityTypeCode)
43 | {
44 | $this->headerMappings = $parentLoader->load($entityTypeCode);
45 | }
46 |
47 | /**
48 | * Loads and returns data.
49 | *
50 | * @return array The array with the raw data
51 | */
52 | public function load() : array
53 | {
54 | return $this->headerMappings;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/Loaders/Filters/FilterInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders\Filters;
16 |
17 | /**
18 | * Factory for file writer instances.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface FilterInterface
27 | {
28 |
29 | /**
30 | * The filter's unique name.
31 | *
32 | * @return string The unique name
33 | */
34 | public function getName() : string;
35 |
36 | /**
37 | * Return's the flag used to define what will be passed to the callback invoked
38 | * by the `array_filter()` method.
39 | *
40 | * @return int The flag
41 | */
42 | public function getFlag() : int;
43 | }
44 |
--------------------------------------------------------------------------------
/src/Loaders/Filters/PregMatchFilterInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders\Filters;
16 |
17 | use TechDivision\Import\Interfaces\PregMatchAwareInterface;
18 |
19 | /**
20 | * Interface for preg match aware filter implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2020 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface PregMatchFilterInterface extends FilterInterface, PregMatchAwareInterface
29 | {
30 | }
31 |
--------------------------------------------------------------------------------
/src/Loaders/HeaderMappingLoader.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | use TechDivision\Import\Configuration\ConfigurationInterface;
18 |
19 | /**
20 | * Loader that loads the header mappings from the configuration
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2020 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | class HeaderMappingLoader implements LoaderInterface
29 | {
30 |
31 | /**
32 | * The array with the available header mappings.
33 | *
34 | * @var array
35 | */
36 | private $headerMappings;
37 |
38 | /**
39 | * Initializes the loader with the configuration instance.
40 | *
41 | * @param array \TechDivision\Import\Configuration\ConfigurationInterface $configuration The array with the values
42 | */
43 | public function __construct(ConfigurationInterface $configuration)
44 | {
45 | $this->headerMappings = $configuration->getHeaderMappings();
46 | }
47 |
48 | /**
49 | * Load's and return's the values.
50 | *
51 | * @param string $entityTypeCode The entity type code to return the header mappings for
52 | *
53 | * @return array The array with the values
54 | */
55 | public function load(string $entityTypeCode = null) : array
56 | {
57 | return isset($this->headerMappings[$entityTypeCode]) ? $this->headerMappings[$entityTypeCode] : array();
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/src/Loaders/LoaderFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | /**
18 | * Interface for loader factory implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface LoaderFactoryInterface
27 | {
28 |
29 | /**
30 | * Create's and return's the apropriate loader instance.
31 | *
32 | * @return \TechDivision\Import\Loaders\LoaderInterface The loader instance
33 | */
34 | public function createLoader() : LoaderInterface;
35 | }
36 |
--------------------------------------------------------------------------------
/src/Loaders/LoaderInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | /**
18 | * Interface for generic loader implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface LoaderInterface
27 | {
28 |
29 | /**
30 | * Loads and returns data.
31 | *
32 | * @return \ArrayAccess The array with the data
33 | */
34 | public function load();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Loaders/ResetAwareLoaderInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | /**
18 | * Interface for reset aware loader implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface ResetAwareLoaderInterface extends LoaderInterface
27 | {
28 |
29 | /**
30 | * Reset's the loader instance.
31 | *
32 | * @return void
33 | */
34 | public function reset();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Loaders/SortedLoaderInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | /**
18 | * Interface for sorted loader implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | * @link https://www.php.net/uasort
26 | */
27 | interface SortedLoaderInterface extends LoaderInterface
28 | {
29 |
30 | /**
31 | * Add's the passed sorter to the loader instance.
32 | *
33 | * @param callable $sorter The sorter to add
34 | *
35 | * @return void
36 | */
37 | public function addSorter(callable $sorter) : void;
38 |
39 | /**
40 | * Return's the array with the sorter callbacks.
41 | *
42 | * @return callable[] The sorter callbacks
43 | */
44 | public function getSorters() : array;
45 | }
46 |
--------------------------------------------------------------------------------
/src/Loaders/Sorters/DefaultOkFileSorter.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders\Sorters;
16 |
17 | /**
18 | * Factory for file writer instances.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class DefaultOkFileSorter
27 | {
28 |
29 | /**
30 | * Compare's that size of the passed arrays.
31 | *
32 | * @param array $a The first array
33 | * @param array $b The second array
34 | *
35 | * @return int int < 0 if size of a is less than the size of b; > 0 if the size of a is greater than size of b, and 0 if size of both is equal
36 | */
37 | public function __invoke(array $a, array $b) : int
38 | {
39 |
40 | // count the number of elements
41 | $countA = sizeof($a);
42 | $countB = sizeof($b);
43 |
44 | // return 0, if the size is equal
45 | if ($countA === $countB) {
46 | return 0;
47 | }
48 |
49 | // return -1 if th size of a > b, else 1
50 | return ($countB < $countA) ? - 1 : 1;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/Loaders/Sorters/SortStringsAscSorter.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders\Sorters;
16 |
17 | /**
18 | * Callback that can be used to sort strings in an ascending order.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | * @link https://php.net/strcmp
26 | */
27 | class SortStringsAscSorter
28 | {
29 |
30 | /**
31 | * Compare's that passed strings binary safe and return's an integer, depending on the comparison result.
32 | *
33 | * @param string $str1 The first string
34 | * @param string $str2 The second string
35 | *
36 | * @return int int < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
37 | */
38 | public function __invoke(string $str1, string $str2) : int
39 | {
40 | return strcmp($str1, $str2);
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/src/Loaders/Sorters/SorterImplInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders\Sorters;
16 |
17 | /**
18 | * Interface for sorter implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2020 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface SorterImplInterface
27 | {
28 |
29 | /**
30 | * Add's the passed sorter to the loader instance.
31 | *
32 | * @param callable $sorter The sorter to add
33 | *
34 | * @return void
35 | */
36 | public function addSorter(callable $sorter) : void;
37 |
38 | /**
39 | * Return's the array with the sorter callbacks.
40 | *
41 | * @return callable[] The sorter callbacks
42 | */
43 | public function getSorters() : array;
44 |
45 | /**
46 | * Sorts the passed array with data by applying the registered sorters on it.
47 | *
48 | * @param array $data The array to be sorted
49 | *
50 | * @return void
51 | */
52 | public function sort(array &$data) : void;
53 | }
54 |
--------------------------------------------------------------------------------
/src/Loaders/StoreLoader.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | use TechDivision\Import\Services\ImportProcessorInterface;
18 |
19 | /**
20 | * Loader for the available stores.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | class StoreLoader implements LoaderInterface
29 | {
30 |
31 | /**
32 | * The stores.
33 | *
34 | * @var array
35 | */
36 | protected $stores = array();
37 |
38 | /**
39 | * Construct that initializes the iterator with the import processor instance.
40 | *
41 | * @param \TechDivision\Import\Services\ImportProcessorInterface $importProcessor The import processor instance
42 | */
43 | public function __construct(ImportProcessorInterface $importProcessor)
44 | {
45 | $this->stores = $importProcessor->getStores();
46 | }
47 |
48 | /**
49 | * Loads and returns data.
50 | *
51 | * @return \ArrayAccess The array with the data
52 | */
53 | public function load()
54 | {
55 | return $this->stores;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/Loaders/StoreWebsiteLoader.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loaders;
16 |
17 | use TechDivision\Import\Utils\MemberNames;
18 | use TechDivision\Import\Services\ImportProcessorInterface;
19 |
20 | /**
21 | * Loader for store websites.
22 | *
23 | * @author Tim Wagner
24 | * @copyright 2019 TechDivision GmbH
25 | * @license https://opensource.org/licenses/MIT
26 | * @link https://github.com/techdivision/import
27 | * @link http://www.techdivision.com
28 | */
29 | class StoreWebsiteLoader implements LoaderInterface
30 | {
31 |
32 | /**
33 | * The store websites.
34 | *
35 | * @var array
36 | */
37 | protected $storeWebsites = array();
38 |
39 | /**
40 | * Construct that initializes the iterator with the import processor instance.
41 | *
42 | * @param \TechDivision\Import\Services\ImportProcessorInterface $importProcessor The import processor instance
43 | */
44 | public function __construct(ImportProcessorInterface $importProcessor)
45 | {
46 | // load the store websites
47 | $storeWebsites = $importProcessor->getStoreWebsites();
48 |
49 | // initialize the array with the store websites
50 | foreach ($storeWebsites as $storeWebsite) {
51 | $this->storeWebsites[] = $storeWebsite[MemberNames::CODE];
52 | }
53 | }
54 |
55 | /**
56 | * Loads and returns data.
57 | *
58 | * @return \ArrayAccess The array with the data
59 | */
60 | public function load()
61 | {
62 | return $this->storeWebsites;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/Loggers/FormatterFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers;
16 |
17 | use TechDivision\Import\Configuration\Logger\FormatterConfigurationInterface;
18 |
19 | /**
20 | * Interface for formatter factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface FormatterFactoryInterface
29 | {
30 |
31 | /**
32 | * Creates a new formatter instance based on the passed configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\Logger\FormatterConfigurationInterface $formatterConfiguration The formatter configuration
35 | *
36 | * @return object The formatter instance
37 | */
38 | public function factory(FormatterConfigurationInterface $formatterConfiguration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Loggers/HandlerFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers;
16 |
17 | use TechDivision\Import\Configuration\Logger\HandlerConfigurationInterface;
18 |
19 | /**
20 | * Interface for handler factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface HandlerFactoryInterface
29 | {
30 |
31 | /**
32 | * Creates a new formatter instance based on the passed configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\Logger\HandlerConfigurationInterface $handlerConfiguration The handler configuration
35 | *
36 | * @return \Monolog\Handler\HandlerInterface The handler instance
37 | */
38 | public function factory(HandlerConfigurationInterface $handlerConfiguration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Loggers/Handlers/ResetAwareHandlerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers\Handlers;
16 |
17 | use Monolog\Handler\HandlerInterface;
18 |
19 | /**
20 | * Interface for reset() method aware handler implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface ResetAwareHandlerInterface extends HandlerInterface
29 | {
30 |
31 | /**
32 | * Reset's the handler instance.
33 | *
34 | * @return void
35 | */
36 | public function reset();
37 | }
38 |
--------------------------------------------------------------------------------
/src/Loggers/LineFormatterFactory.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers;
16 |
17 | use Monolog\Formatter\LineFormatter;
18 | use TechDivision\Import\Utils\ConfigurationUtil;
19 | use TechDivision\Import\Configuration\Logger\FormatterConfigurationInterface;
20 |
21 | /**
22 | * Line Formatter factory implementation.
23 | *
24 | * @author Tim Wagner
25 | * @copyright 2019 TechDivision GmbH
26 | * @license https://opensource.org/licenses/MIT
27 | * @link https://github.com/techdivision/import
28 | * @link http://www.techdivision.com
29 | */
30 | class LineFormatterFactory implements FormatterFactoryInterface
31 | {
32 |
33 | /**
34 | * Creates a new formatter instance based on the passed configuration.
35 | *
36 | * @param \TechDivision\Import\Configuration\Logger\FormatterConfigurationInterface $formatterConfiguration The formatter configuration
37 | *
38 | * @return object The formatter instance
39 | */
40 | public function factory(FormatterConfigurationInterface $formatterConfiguration)
41 | {
42 | $reflectionClass = new \ReflectionClass(LineFormatter::class);
43 | return $reflectionClass->newInstanceArgs(ConfigurationUtil::prepareConstructorArgs($reflectionClass, $formatterConfiguration->getParams()));
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/Loggers/LoggerFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers;
16 |
17 | /**
18 | * The interface for a logger factory implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface LoggerFactoryInterface
27 | {
28 |
29 | /**
30 | * Create's and return's the loggers to use.
31 | *
32 | * @return \Doctrine\Common\Collections\ArrayCollection The array with the initialized loggers
33 | */
34 | public function createLoggers();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Loggers/MonologLoggerFormatterFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers;
16 |
17 | use TechDivision\Import\Configuration\Logger\FormatterConfigurationInterface;
18 |
19 | /**
20 | * Interface for Monolog Logger formatter factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface MonologLoggerFormatterFactoryInterface
29 | {
30 |
31 | /**
32 | * Creates a new logger handler formatter instance based on the passed formatter configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\Logger\HandlerConfigurationInterface $formatterConfiguration The formatter configuration
35 | *
36 | * @return \Monolog\Formatter\FormatterInterface The logger handler formatter instance
37 | */
38 | public function factory(FormatterConfigurationInterface $formatterConfiguration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Loggers/MonologLoggerHandlerFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers;
16 |
17 | use TechDivision\Import\Configuration\Logger\HandlerConfigurationInterface;
18 |
19 | /**
20 | * Interface for Monolog Logger handler factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface MonologLoggerHandlerFactoryInterface
29 | {
30 |
31 | /**
32 | * Creates a new logger handler instance based on the passed handler configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\Logger\HandlerConfigurationInterface $handlerConfiguration The handler configuration
35 | *
36 | * @return \Monolog\Handler\HandlerInterface The logger handler instance
37 | */
38 | public function factory(HandlerConfigurationInterface $handlerConfiguration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Loggers/ProcessorFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers;
16 |
17 | use TechDivision\Import\Configuration\Logger\ProcessorConfigurationInterface;
18 |
19 | /**
20 | * Interface for processor factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface ProcessorFactoryInterface
29 | {
30 |
31 | /**
32 | * Creates a new processor instance based on the passed configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\Logger\ProcessorConfigurationInterface $processorConfiguration The processor configuration
35 | *
36 | * @return object The processor instance
37 | */
38 | public function factory(ProcessorConfigurationInterface $processorConfiguration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Loggers/SwiftMailer/TransportMailerFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Loggers\SwiftMailer;
16 |
17 | use TechDivision\Import\Configuration\SwiftMailer\TransportConfigurationInterface;
18 |
19 | /**
20 | * Interface for mailer transport factory implementations, e. g. a simple Swift sendmail transport.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 201 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface TransportMailerFactoryInterface
29 | {
30 |
31 | /**
32 | * Creates a new swift mailer instance based on the passed transport configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\SwiftMailer\TransportConfigurationInterface $transportConfiguration The mailer configuration
35 | *
36 | * @return \Swift_Mailer The mailer instance
37 | */
38 | public function factory(TransportConfigurationInterface $transportConfiguration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Modules/ModuleInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Modules;
16 |
17 | /**
18 | * Interface for generic module implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface ModuleInterface
27 | {
28 |
29 | /**
30 | * Inovkes the plug-in functionality.
31 | *
32 | * @return void
33 | */
34 | public function process();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Observers/AttributeCodeAndValueAwareObserverInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers;
16 |
17 | /**
18 | * Interface for all attribute code and value aware observer implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface AttributeCodeAndValueAwareObserverInterface extends ObserverInterface
27 | {
28 |
29 | /**
30 | * The attribute code that has to be processed.
31 | *
32 | * @return string The attribute code
33 | */
34 | public function getAttributeCode();
35 |
36 | /**
37 | * The attribute value that has to be processed.
38 | *
39 | * @return string The attribute value
40 | */
41 | public function getAttributeValue();
42 | }
43 |
--------------------------------------------------------------------------------
/src/Observers/AttributeLoaderInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers;
16 |
17 | /**
18 | * Interface for all dynamic attribute loader implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface AttributeLoaderInterface
27 | {
28 |
29 | /**
30 | * Prepare the attributes of the entity that has to be persisted.
31 | *
32 | * @param \TechDivision\Import\Observers\DynamicAttributeObserverInterface $observer The observer to load the attributes for
33 | * @param array $columns The array with the possible columns (column name as key and backend type as value) to load the data from
34 | *
35 | * @return array The prepared attributes
36 | * @throws \Exception Is thrown, if the size of the option values doesn't equals the size of swatch values, in case
37 | */
38 | public function load(DynamicAttributeObserverInterface $observer, array $columns);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Observers/EntityMergers/EntityMergerInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2020 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers\EntityMergers;
16 |
17 | use TechDivision\Import\Observers\ObserverInterface;
18 |
19 | /**
20 | * Interface for entity merger implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2020 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface EntityMergerInterface
29 | {
30 |
31 | /**
32 | * Merge's and return's the entity with the passed attributes.
33 | *
34 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer instance to detect the state for
35 | * @param array $entity The entity loaded from the database
36 | * @param array $attr The entity data from the import file
37 | *
38 | * @return array The entity attributes that has to be merged
39 | */
40 | public function merge(ObserverInterface $observer, array $entity, array $attr) : array;
41 | }
42 |
--------------------------------------------------------------------------------
/src/Observers/GenericColumnCollectorObserver.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2021 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers;
16 |
17 | use Ramsey\Uuid\Uuid;
18 |
19 | /**
20 | * Observer that loads the data of a set of configurable columns
21 | * into the registry for further processing, e. g. validation.
22 | *
23 | * As index the column name and a UUID will be used, whereas it
24 | * is not clear to which entity the collected data belongs. This
25 | * observer can therefore be used when only the collected data
26 | * is of interest, for example you want to have a list of SKUs
27 | * that are part of the import file.
28 | *
29 | * @author Tim Wagner
30 | * @copyright 2021 TechDivision GmbH
31 | * @license https://opensource.org/licenses/MIT
32 | * @link https://github.com/techdivision/import
33 | * @link http://www.techdivision.com
34 | */
35 | class GenericColumnCollectorObserver extends AbstractColumnCollectorObserver
36 | {
37 |
38 | /**
39 | * Return's the primary key value that will be used as second incdex.
40 | *
41 | * @return string The primary key to be used
42 | */
43 | protected function getPrimaryKey() : string
44 | {
45 | return Uuid::uuid4()->toString();
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Observers/ObserverFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers;
16 |
17 | use TechDivision\Import\Subjects\SubjectInterface;
18 |
19 | /**
20 | * interface for all observer factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface ObserverFactoryInterface
29 | {
30 |
31 | /**
32 | * Will be invoked by the observer visitor when a factory has been defined to create the observer instance.
33 | *
34 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance
35 | *
36 | * @return \TechDivision\Import\Observers\ObserverInterface The observer instance
37 | */
38 | public function createObserver(SubjectInterface $subject);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Observers/ObserverInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers;
16 |
17 | use TechDivision\Import\Subjects\SubjectInterface;
18 |
19 | /**
20 | * interface for all observer implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface ObserverInterface
29 | {
30 |
31 | /**
32 | * Will be invoked by the action on the events the listener has been registered for.
33 | *
34 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject instance
35 | *
36 | * @return array The modified row
37 | */
38 | public function handle(SubjectInterface $subject);
39 |
40 | /**
41 | * Return's the observer's subject instance.
42 | *
43 | * @return \TechDivision\Import\Subjects\SubjectInterface The observer's subject instance
44 | */
45 | public function getSubject();
46 |
47 | /**
48 | * Set's the obeserver's subject instance to initialize the observer with.
49 | *
50 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The observer's subject
51 | *
52 | * @return void
53 | */
54 | public function setSubject(SubjectInterface $subject);
55 | }
56 |
--------------------------------------------------------------------------------
/src/Observers/ObserverVisitorInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers;
16 |
17 | use TechDivision\Import\Subjects\SubjectInterface;
18 |
19 | /**
20 | * Interface for all observer visitor implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface ObserverVisitorInterface
29 | {
30 |
31 | /**
32 | * Visitor implementation that initializes the observers of the passed subject.
33 | *
34 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The subject to initialize the observers for
35 | *
36 | * @return void
37 | */
38 | public function visit(SubjectInterface $subject);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Observers/StateDetectorAwareObserverInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers;
16 |
17 | /**
18 | * interface for all state detector aware observer implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface StateDetectorAwareObserverInterface
27 | {
28 |
29 | /**
30 | * Returns an array of the columns with their types to detect state.
31 | *
32 | * @return array The array with the column names as key and their type as value
33 | */
34 | public function getColumns();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Observers/StateDetectorInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import-change-set
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers;
16 |
17 | /**
18 | * Generic state detector interface.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import-change-set
24 | * @link http://www.techdivision.com
25 | */
26 | interface StateDetectorInterface
27 | {
28 |
29 | /**
30 | * Detect's and return's the entity state on the specific entity conditions and return's it.
31 | *
32 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer instance to detect the state for
33 | * @param array $entity The entity loaded from the database
34 | * @param array $attr The entity data from the import file
35 | * @param string|null $changeSetName The change set name to use
36 | *
37 | * @return string The detected entity state
38 | */
39 | public function detect(ObserverInterface $observer, array $entity, array $attr, $changeSetName = null);
40 | }
41 |
--------------------------------------------------------------------------------
/src/Observers/StateDetectors/SimpleStateDetector.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Observers\StateDetectors;
16 |
17 | use TechDivision\Import\Dbal\Utils\EntityStatus;
18 | use TechDivision\Import\Observers\ObserverInterface;
19 | use TechDivision\Import\Observers\StateDetectorInterface;
20 |
21 | /**
22 | * Simple state detector implementation.
23 | *
24 | * @author Tim Wagner
25 | * @copyright 2019 TechDivision GmbH
26 | * @license https://opensource.org/licenses/MIT
27 | * @link https://github.com/techdivision/import
28 | * @link http://www.techdivision.com
29 | */
30 | class SimpleStateDetector implements StateDetectorInterface
31 | {
32 |
33 | /**
34 | * Detect's and return's the entity state on the specific entity conditions and return's it.
35 | *
36 | * @param \TechDivision\Import\Observers\ObserverInterface $observer The observer instance to detect the state for
37 | * @param array $entity The entity loaded from the database
38 | * @param array $attr The entity data from the import file
39 | * @param string|null $changeSetName The change set name to use
40 | *
41 | * @return string The detected entity state
42 | */
43 | public function detect(ObserverInterface $observer, array $entity, array $attr, $changeSetName = null)
44 | {
45 | return EntityStatus::STATUS_UPDATE;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Plugins/GlobalDataPlugin.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Plugins;
16 |
17 | use TechDivision\Import\Utils\RegistryKeys;
18 |
19 | /**
20 | * Plugin that loads the global data.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | class GlobalDataPlugin extends AbstractPlugin
29 | {
30 |
31 | /**
32 | * Process the plugin functionality.
33 | *
34 | * @return void
35 | * @throws \Exception Is thrown, if the plugin can not be processed
36 | */
37 | public function process()
38 | {
39 |
40 | // load the global data from the import processor
41 | $globalData = $this->getImportProcessor()->getGlobalData();
42 |
43 | // add the status with the global data
44 | $this->getRegistryProcessor()->mergeAttributesRecursive(
45 | RegistryKeys::STATUS,
46 | array(RegistryKeys::GLOBAL_DATA => $globalData)
47 | );
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/Plugins/PluginExecutorInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Plugins;
16 |
17 | use TechDivision\Import\Configuration\PluginConfigurationInterface;
18 |
19 | /**
20 | * The interface for all plugin executor instances.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2019 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface PluginExecutorInterface
29 | {
30 |
31 | /**
32 | * Executes the plugin with the passed configuration.
33 | *
34 | * @param \TechDivision\Import\Configuration\PluginConfigurationInterface $plugin The message with the plugin information
35 | *
36 | * @return void
37 | */
38 | public function execute(PluginConfigurationInterface $plugin);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Plugins/PluginFactoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Plugins;
16 |
17 | use TechDivision\Import\Configuration\PluginConfigurationInterface;
18 |
19 | /**
20 | * The interface for all plugin factory implementations.
21 | *
22 | * @author Tim Wagner
23 | * @copyright 2016 TechDivision GmbH
24 | * @license https://opensource.org/licenses/MIT
25 | * @link https://github.com/techdivision/import
26 | * @link http://www.techdivision.com
27 | */
28 | interface PluginFactoryInterface
29 | {
30 |
31 | /**
32 | * Factory method to create new plugin instance.
33 | *
34 | * @param \TechDivision\Import\Configuration\PluginConfigurationInterface $pluginConfiguration The plugin configuration
35 | *
36 | * @return \TechDivision\Import\Plugins\PluginInterface The plugin instance
37 | */
38 | public function createPlugin(PluginConfigurationInterface $pluginConfiguration);
39 | }
40 |
--------------------------------------------------------------------------------
/src/Plugins/SubjectAwarePluginInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Plugins;
16 |
17 | /**
18 | * The interface for all subject aware plugin implementations.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2017 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface SubjectAwarePluginInterface
27 | {
28 | }
29 |
--------------------------------------------------------------------------------
/src/Plugins/VoidPlugin.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Plugins;
16 |
17 | /**
18 | * Plugin that has no functionality itself, but can be used to trigger listeners for example.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | class VoidPlugin extends AbstractPlugin
27 | {
28 |
29 | /**
30 | * Process the plugin functionality.
31 | *
32 | * @return void
33 | * @throws \Exception Is thrown, if the plugin can not be processed
34 | */
35 | public function process()
36 | {
37 | // do nothing here
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/Repositories/AdminUserRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2019 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * Repository implementation to load admin user data.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2019 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface AdminUserRepositoryInterface extends RepositoryInterface
27 | {
28 |
29 | /**
30 | * Return's an array with all available admin users.
31 | *
32 | * @return array The available admin users
33 | */
34 | public function findAll();
35 |
36 | /**
37 | * Load's and return's the admin user with the passed username.
38 | *
39 | * @param string $username The username of the admin user to return
40 | *
41 | * @return array|null The admin user with the passed username
42 | */
43 | public function findOneByUsername($username);
44 | }
45 |
--------------------------------------------------------------------------------
/src/Repositories/CategoryRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * Interface for a category data repository implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface CategoryRepositoryInterface extends RepositoryInterface
27 | {
28 |
29 | /**
30 | * Return's an array with all available categories.
31 | *
32 | * @return array The available categories
33 | */
34 | public function findAll();
35 |
36 | /**
37 | * Return's an array with all available categories by store view ID.
38 | *
39 | * @param integer $storeViewId The store view ID to return the categories for
40 | *
41 | * @return array The available categories for the passed store view ID
42 | */
43 | public function findAllByStoreView($storeViewId);
44 |
45 | /**
46 | * Return's an array with the root categories with the store code as key.
47 | *
48 | * @return array The root categories
49 | */
50 | public function findAllRootCategories();
51 | }
52 |
--------------------------------------------------------------------------------
/src/Repositories/CategoryVarcharRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * Interface for a category varchar data repository implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface CategoryVarcharRepositoryInterface extends RepositoryInterface
27 | {
28 |
29 | /**
30 | * Returns the category varchar values for the categories with
31 | * the passed with the passed entity IDs.
32 | *
33 | * @param array $entityIds The array with the category IDs
34 | *
35 | * @return mixed The category varchar values
36 | */
37 | public function findAllByEntityIds(array $entityIds);
38 |
39 | /**
40 | * Returns the category varchar values for the categories with
41 | * the passed with the passed entity ID.
42 | *
43 | * @param int $entityId The category ID
44 | *
45 | * @return array The category varchar values
46 | */
47 | public function findByEntityId($entityId);
48 | }
49 |
--------------------------------------------------------------------------------
/src/Repositories/CoreConfigDataRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * Interface for a Magento 2 configuration data repository implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface CoreConfigDataRepositoryInterface extends RepositoryInterface
27 | {
28 |
29 | /**
30 | * Return's an array with the Magento 2 configuration.
31 | *
32 | * @return array The configuration
33 | */
34 | public function findAll();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Repositories/CustomerGroupRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @author Tim Wagner
10 | * @copyright 2019 REFUSiON GmbH
11 | * @license https://opensource.org/licenses/MIT
12 | * @link https://github.com/techdivision/import
13 | * @link https://www.techdivision.com
14 | * @link https://www.refusion.com
15 | */
16 |
17 | namespace TechDivision\Import\Repositories;
18 |
19 | /**
20 | * The interface to be implemented by repositories that allow loading customer groups.
21 | *
22 | * @author Klaas-Tido Rühl
23 | * @author Tim Wagner
24 | * @copyright 2019 REFUSiON GmbH
25 | * @license https://opensource.org/licenses/MIT
26 | * @link https://github.com/techdivision/import
27 | * @link https://www.techdivision.com
28 | * @link https://www.refusion.com
29 | */
30 | interface CustomerGroupRepositoryInterface extends RepositoryInterface
31 | {
32 |
33 | /**
34 | * Returns an array with the available customer groups and their code as keys.
35 | *
36 | * @return array The array with the customer groups
37 | */
38 | public function findAll();
39 | }
40 |
--------------------------------------------------------------------------------
/src/Repositories/EavEntityTypeRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * Interface for a EAV entity type data repository implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface EavEntityTypeRepositoryInterface extends RepositoryInterface
27 | {
28 |
29 | /**
30 | * Return's an array with all available EAV entity types with the entity type code as key.
31 | *
32 | * @return array The available link types
33 | */
34 | public function findAll();
35 |
36 | /**
37 | * Return's an EAV entity type with the passed entity type code.
38 | *
39 | * @param string $entityTypeCode The code of the entity type to return
40 | *
41 | * @return array The entity type with the passed entity type code
42 | */
43 | public function findOneByEntityTypeCode($entityTypeCode);
44 | }
45 |
--------------------------------------------------------------------------------
/src/Repositories/ImageTypeRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * Interface for a image type data repository implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface ImageTypeRepositoryInterface extends RepositoryInterface
27 | {
28 |
29 | /**
30 | * Return's an array with all available link types with the link type code as key.
31 | *
32 | * @return array The available link types
33 | */
34 | public function findAll();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Repositories/LinkAttributeRepository.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | use TechDivision\Import\Utils\SqlStatementKeys;
18 | use TechDivision\Import\Dbal\Collection\Repositories\AbstractRepository;
19 |
20 | /**
21 | * Repository implementation to load link attribute data.
22 | *
23 | * @author Tim Wagner
24 | * @copyright 2016 TechDivision GmbH
25 | * @license https://opensource.org/licenses/MIT
26 | * @link https://github.com/techdivision/import
27 | * @link http://www.techdivision.com
28 | */
29 | class LinkAttributeRepository extends AbstractRepository implements LinkAttributeRepositoryInterface
30 | {
31 |
32 | /**
33 | * The statement to load the available link attributes.
34 | *
35 | * @var \PDOStatement
36 | */
37 | protected $linkAttributesStmt;
38 |
39 | /**
40 | * Initializes the repository's prepared statements.
41 | *
42 | * @return void
43 | */
44 | public function init()
45 | {
46 |
47 | // initialize the prepared statements
48 | $this->linkAttributesStmt =
49 | $this->getConnection()->prepare($this->loadStatement(SqlStatementKeys::LINK_ATTRIBUTES));
50 | }
51 |
52 | /**
53 | * Return's an array with all available link attributes.
54 | *
55 | * @return array The available link attributes
56 | */
57 | public function findAll()
58 | {
59 | $this->linkAttributesStmt->execute();
60 | return $this->linkAttributesStmt->fetchAll(\PDO::FETCH_ASSOC);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/Repositories/LinkAttributeRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * Interface for a link attribute dat repository implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface LinkAttributeRepositoryInterface extends RepositoryInterface
27 | {
28 |
29 | /**
30 | * Return's an array with all available link attributes.
31 | *
32 | * @return array The available link attributes
33 | */
34 | public function findAll();
35 | }
36 |
--------------------------------------------------------------------------------
/src/Repositories/LinkTypeRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * Interface for a link type data repository implementation.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | */
26 | interface LinkTypeRepositoryInterface extends RepositoryInterface
27 | {
28 |
29 | /**
30 | * Return's an array with all available image types for the passed entity type code
31 | * and frontend input type with the link type code as key.
32 | *
33 | * @return array The available image types
34 | */
35 | public function findAll();
36 | }
37 |
--------------------------------------------------------------------------------
/src/Repositories/RepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH
10 | * @license https://opensource.org/licenses/MIT
11 | * @link https://github.com/techdivision/import
12 | * @link http://www.techdivision.com
13 | */
14 |
15 | namespace TechDivision\Import\Repositories;
16 |
17 | /**
18 | * The respository interface.
19 | *
20 | * @author Tim Wagner
21 | * @copyright 2016 TechDivision GmbH
22 | * @license https://opensource.org/licenses/MIT
23 | * @link https://github.com/techdivision/import
24 | * @link http://www.techdivision.com
25 | * @deprecated Since 16.8.3
26 | * @see \TechDivision\Import\Dbal\Repositories\RepositoryInterface
27 | */
28 | interface RepositoryInterface extends \TechDivision\Import\Dbal\Repositories\RepositoryInterface
29 | {
30 | }
31 |
--------------------------------------------------------------------------------
/src/Repositories/StoreRepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @copyright 2016 TechDivision GmbH