├── .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 | [![Latest Stable Version](https://img.shields.io/packagist/v/techdivision/import.svg?style=flat-square)](https://packagist.org/packages/techdivision/import) 4 | [![Total Downloads](https://img.shields.io/packagist/dt/techdivision/import.svg?style=flat-square)](https://packagist.org/packages/techdivision/import) 5 | [![License](https://img.shields.io/packagist/l/techdivision/import.svg?style=flat-square)](https://packagist.org/packages/techdivision/import) 6 | [![Build Status](https://img.shields.io/travis/techdivision/import/master.svg?style=flat-square)](http://travis-ci.org/techdivision/import) 7 | [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/techdivision/import/master.svg?style=flat-square)](https://scrutinizer-ci.com/g/techdivision/import/?branch=master) [![Code Coverage](https://img.shields.io/scrutinizer/coverage/g/techdivision/import/master.svg?style=flat-square)](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 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 store repository 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 StoreRepositoryInterface extends RepositoryInterface 27 | { 28 | 29 | /** 30 | * Return's an array with the available stores and their 31 | * store codes as keys. 32 | * 33 | * @return array The array with all available stores 34 | */ 35 | public function findAll(); 36 | 37 | /** 38 | * Return's the default store. 39 | * 40 | * @return array The default store 41 | */ 42 | public function findOneByDefault(); 43 | } 44 | -------------------------------------------------------------------------------- /src/Repositories/StoreWebsiteRepositoryInterface.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 store website 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 StoreWebsiteRepositoryInterface extends RepositoryInterface 27 | { 28 | 29 | /** 30 | * Return's an array with the available store websites and their 31 | * code as keys. 32 | * 33 | * @return array The array with all available store websites 34 | */ 35 | public function findAll(); 36 | } 37 | -------------------------------------------------------------------------------- /src/Repositories/TaxClassRepositoryInterface.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 tax class 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 TaxClassRepositoryInterface extends RepositoryInterface 27 | { 28 | 29 | /** 30 | * Return's an array with the available tax classes and their 31 | * class names as keys. 32 | * 33 | * @return array The array with all available tax classes 34 | */ 35 | public function findAll(); 36 | } 37 | -------------------------------------------------------------------------------- /src/Services/ConfigurationProcessorInterface.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\Services; 16 | 17 | /** 18 | * Interface for a configuration processor implementation that provides the data to access Magento configuration. 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 ConfigurationProcessorInterface 27 | { 28 | 29 | /** 30 | * Return's the repository to access store websites. 31 | * 32 | * @return \TechDivision\Import\Repositories\StoreWebsiteRepositoryInterface The repository instance 33 | */ 34 | public function getStoreWebsiteRepository(); 35 | 36 | /** 37 | * Return's the repository to access the Magento 2 configuration. 38 | * 39 | * @return \TechDivision\Import\Repositories\CoreConfigDataRepositoryInterface The repository instance 40 | */ 41 | public function getCoreConfigDataRepository(); 42 | 43 | /** 44 | * Return's an array with the available store websites. 45 | * 46 | * @return array The array with the available store websites 47 | */ 48 | public function getStoreWebsites(); 49 | 50 | /** 51 | * Return's an array with the Magento 2 configuration. 52 | * 53 | * @return array The Magento 2 configuration 54 | */ 55 | public function getCoreConfigData(); 56 | } 57 | -------------------------------------------------------------------------------- /src/Services/EavAwareProcessorInterface.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\Services; 16 | 17 | /** 18 | * Interface for a EAV processor. 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 EavAwareProcessorInterface 27 | { 28 | 29 | /** 30 | * Return's an EAV entity type with the passed entity type code. 31 | * 32 | * @param string $entityTypeCode The code of the entity type to return 33 | * 34 | * @return array The entity type with the passed entity type code 35 | */ 36 | public function loadEavEntityTypeByEntityTypeCode($entityTypeCode); 37 | 38 | /** 39 | * Load's and return's the EAV attribute option value with the passed entity type ID, code, store ID and value. 40 | * 41 | * @param string $entityTypeId The entity type ID of the EAV attribute to load the option value for 42 | * @param string $attributeCode The code of the EAV attribute option to load 43 | * @param integer $storeId The store ID of the attribute option to load 44 | * @param string $value The value of the attribute option to load 45 | * 46 | * @return array The EAV attribute option value 47 | */ 48 | public function loadAttributeOptionValueByEntityTypeIdAndAttributeCodeAndStoreIdAndValue($entityTypeId, $attributeCode, $storeId, $value); 49 | } 50 | -------------------------------------------------------------------------------- /src/Subjects/CastValueSubjectInterface.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\Subjects; 16 | 17 | /** 18 | * The interface for all EAV subject 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 CastValueSubjectInterface 27 | { 28 | 29 | /** 30 | * Cast's the passed value based on the backend type information. 31 | * 32 | * @param string $backendType The backend type to cast to 33 | * @param mixed $value The value to be casted 34 | * 35 | * @return mixed The casted value 36 | */ 37 | public function castValueByBackendType($backendType, $value); 38 | } 39 | -------------------------------------------------------------------------------- /src/Subjects/CleanUpColumnsSubjectInterface.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\Subjects; 16 | 17 | /** 18 | * The interface for all subject implementations that supports filesystem handling. 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 CleanUpColumnsSubjectInterface 27 | { 28 | 29 | /** 30 | * Merge the columns from the configuration with all image type columns to define which 31 | * columns should be cleaned-up. 32 | * 33 | * @return array The columns that has to be cleaned-up 34 | */ 35 | public function getCleanUpColumns(); 36 | } 37 | -------------------------------------------------------------------------------- /src/Subjects/DateConverterSubjectInterface.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2018 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\Subjects; 16 | 17 | use TechDivision\Import\Subjects\I18n\DateConverterInterface; 18 | 19 | /** 20 | * The interface for all subjects that provides date converting functionality. 21 | * 22 | * @author Tim Wagner 23 | * @copyright 2018 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 DateConverterSubjectInterface 29 | { 30 | 31 | /** 32 | * Sets the date converter instance. 33 | * 34 | * @param \TechDivision\Import\Subjects\I18n\DateConverterInterface $dateConverter The date converter instance 35 | * 36 | * @return void 37 | */ 38 | public function setDateConverter(DateConverterInterface $dateConverter); 39 | 40 | /** 41 | * Returns the date converter instance. 42 | * 43 | * @return \TechDivision\Import\Subjects\I18n\DateConverterInterface The date converter instance 44 | */ 45 | public function getDateConverter(); 46 | } 47 | -------------------------------------------------------------------------------- /src/Subjects/DateConverterTrait.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\Subjects; 16 | 17 | use TechDivision\Import\Subjects\I18n\DateConverterInterface; 18 | 19 | /** 20 | * The trait implementation that provides date convertering functionality. 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 | trait DateConverterTrait 29 | { 30 | 31 | /** 32 | * Return the number converter. 33 | * 34 | * @return \TechDivision\Import\Subjects\I18n\DateConverterInterface 35 | */ 36 | protected $dateConverter; 37 | 38 | /** 39 | * Sets the date converter instance. 40 | * 41 | * @param \TechDivision\Import\Subjects\I18n\DateConverterInterface $dateConverter The date converter instance 42 | * 43 | * @return void 44 | */ 45 | public function setDateConverter(DateConverterInterface $dateConverter) 46 | { 47 | $this->dateConverter = $dateConverter; 48 | } 49 | 50 | /** 51 | * Returns the date converter instance. 52 | * 53 | * @return \TechDivision\Import\Subjects\I18n\DateConverterInterface The date converter instance 54 | */ 55 | public function getDateConverter() 56 | { 57 | return $this->dateConverter; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Subjects/EntitySubjectInterface.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\Subjects; 16 | 17 | /** 18 | * The interface for all entity subject 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 EntitySubjectInterface 27 | { 28 | 29 | /** 30 | * Return's the ID of the entity that has been created recently. 31 | * 32 | * @return integer The entity ID 33 | */ 34 | public function getLastEntityId(); 35 | } 36 | -------------------------------------------------------------------------------- /src/Subjects/FileResolver/FileResolverFactoryInterface.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\Subjects\FileResolver; 16 | 17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface; 18 | 19 | /** 20 | * Interface for all file resolver factory instances. 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 FileResolverFactoryInterface 29 | { 30 | 31 | /** 32 | * Creates and returns the file resolver instance for the subject with the passed configuration. 33 | * 34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject The subject to create the file resolver for 35 | * 36 | * @return \TechDivision\Import\Subjects\FileResolver\FileResolverInterface The file resolver instance 37 | */ 38 | public function createFileResolver(SubjectConfigurationInterface $subject) : FileResolverInterface; 39 | } 40 | -------------------------------------------------------------------------------- /src/Subjects/FileWriter/FileWriterFactoryInterface.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\Subjects\FileWriter; 16 | 17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface; 18 | 19 | /** 20 | * Interface for all file writer factory instances. 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 FileWriterFactoryInterface 29 | { 30 | 31 | /** 32 | * Creates and returns the file writer instance for the subject with the passed configuration. 33 | * 34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject The subject to create the file resolver for 35 | * 36 | * @return \TechDivision\Import\Subjects\FileWriter\FileWriterInterface The file writer instance 37 | */ 38 | public function createFileWriter(SubjectConfigurationInterface $subject) : FileWriterInterface; 39 | } 40 | -------------------------------------------------------------------------------- /src/Subjects/FileWriter/FileWriterInterface.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\Subjects\FileWriter; 16 | 17 | /** 18 | * Interface for all file writer 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 FileWriterInterface 27 | { 28 | } 29 | -------------------------------------------------------------------------------- /src/Subjects/FilesystemSubjectInterface.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\Subjects; 16 | 17 | /** 18 | * The interface for all subject implementations that supports filesystem handling. 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 FilesystemSubjectInterface 27 | { 28 | 29 | /** 30 | * Return's the filesystem adapater instance. 31 | * 32 | * @return \TechDivision\Import\Adapter\FilesystemAdapterInterface The filesystem adapter instance 33 | */ 34 | public function getFilesystemAdapter(); 35 | 36 | /** 37 | * This method tries to resolve the passed path and returns it. If the path 38 | * is relative, the actual working directory will be prepended. 39 | * 40 | * @param string $path The path to be resolved 41 | * 42 | * @return string The resolved path 43 | * @throws \InvalidArgumentException Is thrown, if the path can not be resolved 44 | */ 45 | public function resolvePath($path); 46 | } 47 | -------------------------------------------------------------------------------- /src/Subjects/I18n/DateConverterFactoryInterface.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2018 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\Subjects\I18n; 16 | 17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface; 18 | 19 | /** 20 | * Interface for date converter factory implementations. 21 | * 22 | * @author Tim Wagner 23 | * @copyright 2018 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 DateConverterFactoryInterface 29 | { 30 | 31 | /** 32 | * Creates and returns the date converter instance for the subject with the passed configuration. 33 | * 34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject The subject to create the date converter for 35 | * 36 | * @return \TechDivision\Import\Subjects\I18n\DateConverterInterface The date converter instance 37 | */ 38 | public function createDateConverter(SubjectConfigurationInterface $subject); 39 | } 40 | -------------------------------------------------------------------------------- /src/Subjects/I18n/DateConverterInterface.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\Subjects\I18n; 16 | 17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface; 18 | 19 | /** 20 | * Interface for all date converter 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 DateConverterInterface 29 | { 30 | 31 | /** 32 | * Sets the subject configuration instance. 33 | * 34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subjectConfiguration The subject configuration 35 | * 36 | * @return void 37 | */ 38 | public function setSubjectConfiguration(SubjectConfigurationInterface $subjectConfiguration); 39 | 40 | /** 41 | * Returns the subject configuration instance. 42 | * 43 | * @return \TechDivision\Import\Configuration\SubjectConfigurationInterface The subject configuration 44 | */ 45 | public function getSubjectConfiguration(); 46 | 47 | /** 48 | * Converts the passed date into a Magento 2 compatible date format. 49 | * 50 | * @param string $date The date to convert 51 | * @param string $format The date format to convert to 52 | * 53 | * @return string The converted date 54 | */ 55 | public function convert($date, $format = 'Y-m-d H:i:s'); 56 | } 57 | -------------------------------------------------------------------------------- /src/Subjects/I18n/NumberConverterFactoryInterface.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2018 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\Subjects\I18n; 16 | 17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface; 18 | 19 | /** 20 | * Interface for number converter factory implementations. 21 | * 22 | * @author Tim Wagner 23 | * @copyright 2018 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 NumberConverterFactoryInterface 29 | { 30 | 31 | /** 32 | * Creates and returns the number converter instance for the subject with the passed configuration. 33 | * 34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject The subject to create the number converter for 35 | * 36 | * @return \TechDivision\Import\Subjects\I18n\NumberConverterInterface The number converter instance 37 | */ 38 | public function createNumberConverter(SubjectConfigurationInterface $subject); 39 | } 40 | -------------------------------------------------------------------------------- /src/Subjects/NumberConverterSubjectInterface.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\Subjects; 16 | 17 | use TechDivision\Import\Subjects\I18n\NumberConverterInterface; 18 | 19 | /** 20 | * The interface for all subjects that provides number converting functionality. 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 NumberConverterSubjectInterface 29 | { 30 | 31 | /** 32 | * Sets the number converter instance. 33 | * 34 | * @param \TechDivision\Import\Subjects\I18n\NumberConverterInterface $numberConverter The number converter instance 35 | * 36 | * @return void 37 | */ 38 | public function setNumberConverter(NumberConverterInterface $numberConverter); 39 | 40 | /** 41 | * Returns the number converter instance. 42 | * 43 | * @return \TechDivision\Import\Subjects\I18n\NumberConverterInterface The number converter instance 44 | */ 45 | public function getNumberConverter(); 46 | } 47 | -------------------------------------------------------------------------------- /src/Subjects/NumberConverterTrait.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\Subjects; 16 | 17 | use TechDivision\Import\Subjects\I18n\NumberConverterInterface; 18 | 19 | /** 20 | * The trait implementation that provides number convertering functionality. 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 | trait NumberConverterTrait 29 | { 30 | 31 | /** 32 | * Return the number converter. 33 | * 34 | * @return \TechDivision\Import\Subjects\I18n\NumberConverterInterface 35 | */ 36 | protected $numberConverter; 37 | 38 | /** 39 | * Sets the number converter instance. 40 | * 41 | * @param \TechDivision\Import\Subjects\I18n\NumberConverterInterface $numberConverter The number converter instance 42 | * 43 | * @return void 44 | */ 45 | public function setNumberConverter(NumberConverterInterface $numberConverter) 46 | { 47 | $this->numberConverter = $numberConverter; 48 | } 49 | 50 | /** 51 | * Returns the number converter instance. 52 | * 53 | * @return \TechDivision\Import\Subjects\I18n\NumberConverterInterface The number converter instance 54 | */ 55 | public function getNumberConverter() 56 | { 57 | return $this->numberConverter; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Subjects/SubjectExecutorInterface.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\Subjects; 16 | 17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface; 18 | 19 | /** 20 | * The interface for all subject executor implementations. 21 | * 22 | * @author Tim Wagner 23 | * @copyright 2017 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 SubjectExecutorInterface 29 | { 30 | 31 | /** 32 | * Executes the passed subject. 33 | * 34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subject The subject configuration instance 35 | * @param array $matches The bunch matches 36 | * @param string $serial The UUID of the actual import 37 | * @param string $pathname The path to the file to import 38 | * 39 | * @return void 40 | */ 41 | public function execute(SubjectConfigurationInterface $subject, array $matches, $serial, $pathname); 42 | } 43 | -------------------------------------------------------------------------------- /src/Subjects/SubjectFactoryInterface.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\Subjects; 16 | 17 | use TechDivision\Import\Configuration\SubjectConfigurationInterface; 18 | 19 | /** 20 | * The interface for all subject 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 SubjectFactoryInterface 29 | { 30 | 31 | /** 32 | * Factory method to create new subject instance. 33 | * 34 | * @param \TechDivision\Import\Configuration\SubjectConfigurationInterface $subjectConfiguration The subject configuration 35 | * 36 | * @return \TechDivision\Import\Subjects\SubjectInterface The subject instance 37 | */ 38 | public function createSubject(SubjectConfigurationInterface $subjectConfiguration); 39 | } 40 | -------------------------------------------------------------------------------- /src/Subjects/UrlKeyAwareSubjectInterface.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\Subjects; 16 | 17 | /** 18 | * The interface for all URL key aware subject 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 UrlKeyAwareSubjectInterface 27 | { 28 | 29 | /** 30 | * Return's the configured entity type code. 31 | * 32 | * @return array The requested entity type code 33 | * @throws \Exception Is thrown, if the requested entity type code is not available 34 | */ 35 | public function getEntityTypeCode(); 36 | 37 | /** 38 | * Return's the store ID of the actual row, or of the default store 39 | * if no store view code is set in the CSV file. 40 | * 41 | * @param string|null $default The default store view code to use, if no store view code is set in the CSV file 42 | * 43 | * @return integer The ID of the actual store 44 | * @throws \Exception Is thrown, if the store with the actual code is not available 45 | */ 46 | public function getRowStoreId($default = null); 47 | } 48 | -------------------------------------------------------------------------------- /src/Subjects/ValidatorSubject.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\Subjects; 16 | 17 | use TechDivision\Import\Utils\FrontendInputTypes; 18 | 19 | /** 20 | * Generic validator subject implementation. 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 ValidatorSubject extends AbstractEavSubject 29 | { 30 | 31 | /** 32 | * The default mappings for the user defined attributes, based on the attributes frontend input type. 33 | * 34 | * @var array 35 | */ 36 | protected $defaultFrontendInputCallbackMappings = array( 37 | FrontendInputTypes::SELECT => array('import.callback.validator.select'), 38 | FrontendInputTypes::BOOLEAN => array('import.callback.validator.boolean'), 39 | FrontendInputTypes::MULTISELECT => array('import.callback.validator.multiselect') 40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /src/Utils/BunchKeys.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\Utils; 16 | 17 | /** 18 | * A utility class for the bunch handling. 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 BunchKeys 27 | { 28 | 29 | /** 30 | * This is a utility class, so protect it against direct 31 | * instantiation. 32 | */ 33 | private function __construct() 34 | { 35 | } 36 | 37 | /** 38 | * This is a utility class, so protect it against cloning. 39 | * 40 | * @return void 41 | */ 42 | private function __clone() 43 | { 44 | } 45 | 46 | /** 47 | * The key for the prefix part found in the filename. 48 | * 49 | * @var string 50 | */ 51 | const PREFIX = 'prefix'; 52 | 53 | /** 54 | * The key for the filename part found in the filename. 55 | * 56 | * @var string 57 | */ 58 | const FILENAME = 'filename'; 59 | 60 | /** 61 | * The key for the counter part found in the filename. 62 | * 63 | * @var string 64 | */ 65 | const COUNTER = 'counter'; 66 | 67 | /** 68 | * Return's an array with all available bunch keys. 69 | * 70 | * @return array The available bunch keys 71 | */ 72 | public static function getAllKeys() 73 | { 74 | return array(BunchKeys::PREFIX, BunchKeys::FILENAME, BunchKeys::COUNTER); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /src/Utils/ColumnNamesUtiInterface.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\Utils; 16 | 17 | /** 18 | * Interface for utility class implementations name handling for dynamic column handling. 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 ColumnNamesUtiInterface 27 | { 28 | 29 | /** 30 | * The token used to identifiy the dynamic column names. 31 | * 32 | * @var string 33 | */ 34 | const TOKEN = 'column-names'; 35 | } 36 | -------------------------------------------------------------------------------- /src/Utils/ColumnPlaceholdersUtiInterface.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\Utils; 16 | 17 | /** 18 | * Interface for utility class implementations placeholder handling for dynamic column handling . 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 ColumnPlaceholdersUtiInterface 27 | { 28 | 29 | /** 30 | * The token used to identifiy the dynamic column placeholders. 31 | * 32 | * @var string 33 | */ 34 | const TOKEN = 'column-placeholders'; 35 | } 36 | -------------------------------------------------------------------------------- /src/Utils/ColumnValuesUtilInterface.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\Utils; 16 | 17 | /** 18 | * Interface for utility class implementations value handling for dynamic column handling. 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 ColumnValuesUtilInterface 27 | { 28 | 29 | /** 30 | * The token used to identifiy the dynamic column values. 31 | * 32 | * @var string 33 | */ 34 | const TOKEN = 'column-values'; 35 | } 36 | -------------------------------------------------------------------------------- /src/Utils/CoreConfigDataKeys.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\Utils; 16 | 17 | /** 18 | * Utility class containing the keys Magento uses to persist values in the "core_config_data table". 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 CoreConfigDataKeys 27 | { 28 | 29 | /** 30 | * This is a utility class, so protect it against direct 31 | * instantiation. 32 | */ 33 | private function __construct() 34 | { 35 | } 36 | 37 | /** 38 | * This is a utility class, so protect it against cloning. 39 | * 40 | * @return void 41 | */ 42 | private function __clone() 43 | { 44 | } 45 | 46 | /** 47 | * Name for the column 'catalog/seo/product_url_suffix'. 48 | * 49 | * @var string 50 | */ 51 | const CATALOG_SEO_PRODUCT_URL_SUFFIX = 'catalog/seo/product_url_suffix'; 52 | 53 | /** 54 | * Name for the column 'catalog/seo/category_url_suffix'. 55 | * 56 | * @var string 57 | */ 58 | const CATALOG_SEO_CATEGORY_URL_SUFFIX = 'catalog/seo/category_url_suffix'; 59 | } 60 | -------------------------------------------------------------------------------- /src/Utils/EditionNames.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\Utils; 16 | 17 | /** 18 | * Utility class containing the supported Magento edition names. 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 EditionNames extends \ArrayObject implements EditionNamesInterface 27 | { 28 | /** 29 | * Construct a new edition names instance. 30 | * 31 | * @param array $editionNames The array with the additional edition names 32 | * @link http://www.php.net/manual/en/arrayobject.construct.php 33 | */ 34 | public function __construct(array $editionNames = array()) 35 | { 36 | 37 | // merge the edition names with the passed ones 38 | $mergedEditionNames = array_merge( 39 | array( 40 | EditionNamesInterface::CE, 41 | EditionNamesInterface::EE 42 | ), 43 | $editionNames 44 | ); 45 | 46 | // initialize the parent class with the merged edition names 47 | parent::__construct($mergedEditionNames); 48 | } 49 | 50 | /** 51 | * Query whether or not the passed edition name is valid. 52 | * 53 | * @param string $editionName The edition name to query for 54 | * 55 | * @return boolean TRUE if the edition name is valid, else FALSE 56 | */ 57 | public function isEditionName($editionName) 58 | { 59 | return in_array($editionName, (array) $this); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/Utils/EditionNamesInterface.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\Utils; 16 | 17 | /** 18 | * Interface for an utility class containing the supported Magento edition names. 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 EditionNamesInterface 27 | { 28 | 29 | /** 30 | * Name for the member 'CE'. 31 | * 32 | * @var string 33 | */ 34 | const CE = 'CE'; 35 | 36 | /** 37 | * Name for the member 'EE'. 38 | * 39 | * @var string 40 | */ 41 | const EE = 'EE'; 42 | 43 | /** 44 | * Query whether or not the passed edition name is valid. 45 | * 46 | * @param string $editionName The edition name to query for 47 | * 48 | * @return boolean TRUE if the edition name is valid, else FALSE 49 | */ 50 | public function isEditionName($editionName); 51 | } 52 | -------------------------------------------------------------------------------- /src/Utils/EntityStatus.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\Utils; 16 | 17 | /** 18 | * Utility class containing the entity status. 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\Utils\EntityStatus 27 | */ 28 | class EntityStatus extends \TechDivision\Import\Dbal\Utils\EntityStatus 29 | { 30 | } 31 | -------------------------------------------------------------------------------- /src/Utils/EnumInterface.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\Utils; 16 | 17 | /** 18 | * The entity types for the URL rewrite handling. 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 EnumInterface 27 | { 28 | 29 | /** 30 | * Query whether or not the passed value is valid. 31 | * 32 | * @param string $value Thevalue to query for 33 | * 34 | * @return boolean TRUE if the value is valid, else FALSE 35 | */ 36 | public function isValid($value) : bool; 37 | 38 | /** 39 | * Query whether or not the actual instance has the passed value. 40 | * 41 | * @param string $value The value to query for 42 | * 43 | * @return bool TRUE if the instance equals the passed value, else FALSE 44 | */ 45 | public function equals($value) : bool; 46 | 47 | /** 48 | * Return's the enum's value. 49 | * 50 | * @return string The enum's value 51 | */ 52 | public function __toString() : string; 53 | } 54 | -------------------------------------------------------------------------------- /src/Utils/FileUploadConfigurationKeys.php: -------------------------------------------------------------------------------- 1 | 9 | * @author Bernhard Wick 10 | * @copyright 2017 TechDivision GmbH 11 | * @license https://opensource.org/licenses/MIT 12 | * @link https://github.com/techdivision/import-product-media 13 | * @link http://www.techdivision.com 14 | */ 15 | 16 | namespace TechDivision\Import\Utils; 17 | 18 | /** 19 | * Utility class containing the configuration keys specific for file upload aware classes. 20 | * 21 | * @author Tim Wagner 22 | * @author Bernhard Wick 23 | * @copyright 2017 TechDivision GmbH 24 | * @license https://opensource.org/licenses/MIT 25 | * @link https://github.com/techdivision/import-product-media 26 | * @link http://www.techdivision.com 27 | */ 28 | class FileUploadConfigurationKeys 29 | { 30 | 31 | /** 32 | * Name for the column 'media-directory'. 33 | * 34 | * @var string 35 | */ 36 | const MEDIA_DIRECTORY = 'media-directory'; 37 | 38 | /** 39 | * Name for the column 'images-file-directory'. 40 | * 41 | * @var string 42 | */ 43 | const IMAGES_FILE_DIRECTORY = 'images-file-directory'; 44 | 45 | /** 46 | * Name for the column 'copy-images'. 47 | * 48 | * @var string 49 | */ 50 | const COPY_IMAGES = 'copy-images'; 51 | 52 | /** 53 | * Name for the column 'override-images'. 54 | * 55 | * @var string 56 | */ 57 | const OVERRIDE_IMAGES = 'override-images'; 58 | } 59 | -------------------------------------------------------------------------------- /src/Utils/Filter/ConvertLiteralUrl.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\Utils\Filter; 16 | 17 | /** 18 | * Filter to convert URLs. 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 ConvertLiteralUrl extends ConvertLiteral 27 | { 28 | /** 29 | * Filter and return the value. 30 | * 31 | * @param string $string The value to filter 32 | * 33 | * @return string The filtered value 34 | */ 35 | public function filter($string) 36 | { 37 | 38 | // replace all characters that are not numbers or simple chars 39 | $string = preg_replace('#[^0-9a-z]+#i', '-', parent::filter($string)); 40 | $string = strtolower($string); 41 | $string = trim($string, '-'); 42 | 43 | // return the converted URL 44 | return $string; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/Utils/Filter/UrlKeyFilterTrait.php: -------------------------------------------------------------------------------- 1 | 9 | * @copyright 2016 TechDivision GmbH 10 | * @license https://opensource.org/licenses/MIT 11 | * @link https://github.com/techdivision/import-category 12 | * @link http://www.techdivision.com 13 | */ 14 | 15 | namespace TechDivision\Import\Utils\Filter; 16 | 17 | /** 18 | * Trait that provides string to URL key convertion functionality. 19 | * 20 | * @author Tim Wagner 21 | * @copyright 2016 TechDivision GmbH 22 | * @license https://opensource.org/licenses/MIT 23 | * @link https://github.com/techdivision/import-category 24 | * @link http://www.techdivision.com 25 | */ 26 | trait UrlKeyFilterTrait 27 | { 28 | 29 | /** 30 | * The URL filter instance. 31 | * 32 | * @var \Laminas\Filter\FilterInterface 33 | */ 34 | protected $convertLiteralUrlFilter; 35 | 36 | /** 37 | * Initialize's and return's the URL key filter. 38 | * 39 | * @return \Laminas\Filter\FilterInterface The URL key filter 40 | */ 41 | protected function getConvertLiteralUrlFilter() 42 | { 43 | return $this->convertLiteralUrlFilter; 44 | } 45 | 46 | /** 47 | * Convert's the passed string into a valid URL key. 48 | * 49 | * @param string $string The string to be converted, e. g. the product name 50 | * 51 | * @return string The converted string as valid URL key 52 | */ 53 | protected function convertNameToUrlKey($string) 54 | { 55 | return $this->getConvertLiteralUrlFilter()->filter($string); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/Utils/FrontendInputTypes.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\Utils; 16 | 17 | /** 18 | * Utility class containing the available frontend input types. 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 FrontendInputTypes extends \TechDivision\Import\Serializer\Csv\Utils\FrontendInputTypes 27 | { 28 | 29 | /** 30 | * Name for the frontend input type 'select'. 31 | * 32 | * @var string 33 | */ 34 | const SELECT = 'select'; 35 | } 36 | -------------------------------------------------------------------------------- /src/Utils/Generators/GeneratorInterface.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\Utils\Generators; 16 | 17 | /** 18 | * The interface for all UID generators 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 GeneratorInterface 27 | { 28 | 29 | /** 30 | * Create a unique identifier. 31 | * 32 | * @return int|string The unique identifier 33 | */ 34 | public function generate(); 35 | } 36 | -------------------------------------------------------------------------------- /src/Utils/LoggerKeys.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\Utils; 16 | 17 | /** 18 | * A utility class for the logger keys. 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 LoggerKeys 27 | { 28 | 29 | /** 30 | * This is a utility class, so protect it against direct 31 | * instantiation. 32 | */ 33 | private function __construct() 34 | { 35 | } 36 | 37 | /** 38 | * This is a utility class, so protect it against cloning. 39 | * 40 | * @return void 41 | */ 42 | private function __clone() 43 | { 44 | } 45 | 46 | /** 47 | * The key for system logger. 48 | * 49 | * @var string 50 | */ 51 | const SYSTEM = 'system'; 52 | 53 | /** 54 | * The key for mail logger. 55 | * 56 | * @var string 57 | */ 58 | const MAIL = 'mail'; 59 | 60 | /** 61 | * The key for param 'bubble'. 62 | * 63 | * @var string 64 | */ 65 | const BUBBLE = 'bubble'; 66 | 67 | /** 68 | * The key for param 'log-level'. 69 | * 70 | * @var string 71 | */ 72 | const LOG_LEVEL = 'log-level'; 73 | } 74 | -------------------------------------------------------------------------------- /src/Utils/Mappings/MapperInterface.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\Utils\Mappings; 16 | 17 | /** 18 | * Mapping for mapper 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 MapperInterface 27 | { 28 | 29 | /** 30 | * Map the passed value. 31 | * 32 | * @param string $value The value to map 33 | * 34 | * @return string The mapped value 35 | */ 36 | public function map(string $value) : string; 37 | } 38 | -------------------------------------------------------------------------------- /src/Utils/OperationKeys.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\Utils; 16 | 17 | /** 18 | * A utility class for the available operations. 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 OperationKeys 27 | { 28 | 29 | /** 30 | * This is a utility class, so protect it against direct 31 | * instantiation. 32 | */ 33 | private function __construct() 34 | { 35 | } 36 | 37 | /** 38 | * This is a utility class, so protect it against cloning. 39 | * 40 | * @return void 41 | */ 42 | private function __clone() 43 | { 44 | } 45 | 46 | /** 47 | * The key for 'move-files' operation. 48 | * 49 | * @var string 50 | */ 51 | const MOVE_FILES = 'move-files'; 52 | 53 | /** 54 | * The key for 'convert' operation. 55 | * 56 | * @var string 57 | */ 58 | const CONVERT = 'convert'; 59 | 60 | /** 61 | * The key for 'add-update' operation. 62 | * 63 | * @var string 64 | */ 65 | const ADD_UPDATE = 'add-update'; 66 | 67 | /** 68 | * The key for 'replace' operation. 69 | * 70 | * @var string 71 | */ 72 | const REPLACE = 'replace'; 73 | 74 | /** 75 | * The key for 'delete' operation. 76 | * 77 | * @var string 78 | */ 79 | const DELETE = 'delete'; 80 | } 81 | -------------------------------------------------------------------------------- /src/Utils/OperationNames.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\Utils; 16 | 17 | /** 18 | * Utility class containing the operation 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 OperationNames 27 | { 28 | 29 | /** 30 | * The operation key for a row that has to be created. 31 | * 32 | * @var string 33 | */ 34 | const CREATE = 'create'; 35 | 36 | /** 37 | * The operation key for a row that has to be updated. 38 | * 39 | * @var string 40 | */ 41 | const UPDATE = 'update'; 42 | 43 | /** 44 | * The operation key for a row that has to be deleted. 45 | * 46 | * @var string 47 | */ 48 | const DELETE = 'delete'; 49 | 50 | /** 51 | * The operation key for a row that has to be skipped. 52 | * 53 | * @var string 54 | */ 55 | const SKIP = 'skip'; 56 | } 57 | -------------------------------------------------------------------------------- /src/Utils/PrimaryKeyUtilInterface.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\Utils; 16 | 17 | /** 18 | * Interface for an utility class for edition based primary key handling. 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 | * @deprecated Since 16.8.3 26 | * @see \TechDivision\Import\Dbal\Utils\PrimaryKeyUtilInterface 27 | */ 28 | interface PrimaryKeyUtilInterface extends \TechDivision\Import\Dbal\Utils\PrimaryKeyUtilInterface 29 | { 30 | } 31 | -------------------------------------------------------------------------------- /src/Utils/ProductTypes.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\Utils; 16 | 17 | /** 18 | * Utility class containing the product types. 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 ProductTypes 27 | { 28 | 29 | /** 30 | * This is a utility class, so protect it against direct 31 | * instantiation. 32 | */ 33 | private function __construct() 34 | { 35 | } 36 | 37 | /** 38 | * This is a utility class, so protect it against cloning. 39 | * 40 | * @return void 41 | */ 42 | private function __clone() 43 | { 44 | } 45 | 46 | /** 47 | * Name for the column 'simple'. 48 | * 49 | * @var string 50 | */ 51 | const SIMPLE = 'simple'; 52 | 53 | /** 54 | * Name for the column 'bundle'. 55 | * 56 | * @var string 57 | */ 58 | const BUNDLE = 'bundle'; 59 | 60 | /** 61 | * Name for the column 'configurable'. 62 | * 63 | * @var string 64 | */ 65 | const CONFIGURABLE = 'configurable'; 66 | 67 | /** 68 | * Name for the column 'configurable'. 69 | * 70 | * @var string 71 | */ 72 | const VIRTUAL = 'virtual'; 73 | 74 | /** 75 | * Name for the column 'downloadable'. 76 | * 77 | * @var string 78 | */ 79 | const DOWNLOADABLE = 'downloadable'; 80 | } 81 | -------------------------------------------------------------------------------- /src/Utils/ScopeKeys.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\Utils; 16 | 17 | /** 18 | * Utility class containing the keys Magento uses to persist values in the "core_config_data table". 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 ScopeKeys 27 | { 28 | 29 | /** 30 | * This is a utility class, so protect it against direct 31 | * instantiation. 32 | */ 33 | private function __construct() 34 | { 35 | } 36 | 37 | /** 38 | * This is a utility class, so protect it against cloning. 39 | * 40 | * @return void 41 | */ 42 | private function __clone() 43 | { 44 | } 45 | 46 | /** 47 | * Name for the 'default' scope. 48 | * 49 | * @var string 50 | */ 51 | const SCOPE_DEFAULT = 'default'; 52 | 53 | /** 54 | * Name for the 'stores' scope. 55 | * 56 | * @var string 57 | */ 58 | const SCOPE_WEBSITES = 'websites'; 59 | 60 | /** 61 | * Name for the 'stores' scope. 62 | * 63 | * @var string 64 | */ 65 | const SCOPE_STORES = 'stores'; 66 | } 67 | -------------------------------------------------------------------------------- /src/Utils/StoreViewCodes.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\Utils; 16 | 17 | /** 18 | * Utility class containing the available store view codes. 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 StoreViewCodes 27 | { 28 | 29 | /** 30 | * The store view code for the admin store view. 31 | * 32 | * @var string 33 | */ 34 | const ADMIN = 'admin'; 35 | 36 | /** 37 | * The store view code for the default store view. 38 | * 39 | * @var string 40 | */ 41 | const DEF = 'default'; 42 | 43 | /** 44 | * This is a utility class, so protect it against direct 45 | * instantiation. 46 | */ 47 | private function __construct() 48 | { 49 | } 50 | 51 | /** 52 | * This is a utility class, so protect it against cloning. 53 | * 54 | * @return void 55 | */ 56 | private function __clone() 57 | { 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /src/Utils/TablePrefixUtilInterface.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\Utils; 16 | 17 | /** 18 | * Interface for table prefix utility implementations. 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 | * @deprecated Since 16.8.3 26 | * @see \TechDivision\Import\Dbal\Utils\TablePrefixUtilInterface 27 | */ 28 | interface TablePrefixUtilInterface extends \TechDivision\Import\Dbal\Utils\TablePrefixUtilInterface 29 | { 30 | } 31 | -------------------------------------------------------------------------------- /symfony/DependencyInjection/ImportExtension.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\DependencyInjection; 16 | 17 | use Symfony\Component\Config\FileLocator; 18 | use Symfony\Component\HttpKernel\DependencyInjection\Extension; 19 | use Symfony\Component\DependencyInjection\ContainerBuilder; 20 | use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; 21 | 22 | /** 23 | * The symfony extension implementation for the M2IF import library. 24 | * 25 | * @author Tim Wagner 26 | * @copyright 2016 TechDivision GmbH 27 | * @license https://opensource.org/licenses/MIT 28 | * @link https://github.com/techdivision/import 29 | * @link http://www.techdivision.com 30 | */ 31 | class ImportExtension extends Extension 32 | { 33 | 34 | /** 35 | * Load's the bundles DI configuration. 36 | * 37 | * @param array $configs The array with the configuration 38 | * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container The container instance 39 | */ 40 | public function load(array $configs, ContainerBuilder $container) 41 | { 42 | $loader = new XmlFileLoader($container, new FileLocator(dirname(__DIR__) . '/Resources/config')); 43 | $loader->load('services.xml'); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /symfony/ImportBundle.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; 16 | 17 | use Symfony\Component\HttpKernel\Bundle\Bundle; 18 | 19 | /** 20 | * The symfony bundle implementation for the M2IF import library. 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 ImportBundle extends Bundle 29 | { 30 | } -------------------------------------------------------------------------------- /tests/unit/AbstractRowTraitImpl.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; 16 | 17 | use TechDivision\Import\Subjects\SubjectInterface; 18 | 19 | /** 20 | * Wrapper for a subject that uses the row trait implementation. 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 | abstract class AbstractRowTraitImpl implements SubjectInterface 29 | { 30 | 31 | /** 32 | * The trait that provides header handling functionality. 33 | * 34 | * @var TechDivision\Import\HeaderTrait 35 | */ 36 | use HeaderTrait; 37 | 38 | /** 39 | * The trait that provides row handling functionality. 40 | * 41 | * @var TechDivision\Import\RowTrait 42 | */ 43 | use RowTrait; 44 | } 45 | -------------------------------------------------------------------------------- /tests/unit/Observers/EntitySubjectImpl.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 | use TechDivision\Import\Subjects\EavSubjectInterface; 19 | use TechDivision\Import\Subjects\EntitySubjectInterface; 20 | 21 | /** 22 | * Test class for a entity subject implementation. 23 | * 24 | * @author Tim Wagner 25 | * @copyright 2016 TechDivision GmbH 26 | * @license https://opensource.org/licenses/MIT 27 | * @link https://github.com/techdivision/import 28 | * @link http://www.techdivision.com 29 | */ 30 | abstract class EntitySubjectImpl implements SubjectInterface, EavSubjectInterface, EntitySubjectInterface 31 | { 32 | } 33 | -------------------------------------------------------------------------------- /tests/unit/Observers/FileUploadSubjectImpl.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 | use TechDivision\Import\Subjects\FileUploadSubjectInterface; 19 | 20 | /** 21 | * Test class for the file upload trait implementation. 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 | abstract class FileUploadSubjectImpl implements SubjectInterface, FileUploadSubjectInterface 30 | { 31 | } 32 | -------------------------------------------------------------------------------- /tests/unit/Plugins/ExportableSubjectImpl.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\Subjects\SubjectInterface; 18 | use TechDivision\Import\Subjects\ExportableSubjectInterface; 19 | 20 | /** 21 | * Test class for the exportable subject implementation. 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 | abstract class ExportableSubjectImpl implements SubjectInterface, ExportableSubjectInterface 30 | { 31 | } 32 | -------------------------------------------------------------------------------- /tests/unit/Plugins/_files/product-import_20170720-125052_01.csv: -------------------------------------------------------------------------------- 1 | col1 2 | val1 -------------------------------------------------------------------------------- /tests/unit/Subjects/ExportableTraitImpl.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\Subjects; 16 | 17 | /** 18 | * Wrapper for a subject that uses the exportable trait 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 | abstract class ExportableTraitImpl implements SubjectInterface, ExportableSubjectInterface 27 | { 28 | 29 | /** 30 | * The trait that implements the export functionality. 31 | * 32 | * @var \TechDivision\Import\Subjects\ExportableTrait 33 | */ 34 | use ExportableTrait; 35 | } 36 | -------------------------------------------------------------------------------- /tests/unit/Subjects/FileUploadTraitImpl.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\Subjects; 16 | 17 | /** 18 | * Test class for the file upload trait 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 FileUploadTraitImpl 27 | { 28 | 29 | /** 30 | * The filesystem trait. 31 | * 32 | * @var \TechDivision\Import\Subjects\FilesystemTrait 33 | */ 34 | use FilesystemTrait; 35 | 36 | /** 37 | * The file upload trait we want to test. 38 | * 39 | * @var \TechDivision\Import\Subjects\FileUploadTrait 40 | */ 41 | use FileUploadTrait; 42 | } 43 | -------------------------------------------------------------------------------- /tests/unit/Subjects/FilesystemTraitImpl.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\Subjects; 16 | 17 | /** 18 | * Test class for the filesystem trait 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 FilesystemTraitImpl 27 | { 28 | 29 | /** 30 | * The filesystem trait. 31 | * 32 | * @var \TechDivision\Import\Subjects\FilesystemTrait 33 | */ 34 | use FilesystemTrait; 35 | } 36 | -------------------------------------------------------------------------------- /tests/unit/Subjects/SkipObserverImpl.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\Subjects; 16 | 17 | use TechDivision\Import\Observers\ObserverInterface; 18 | 19 | /** 20 | * Mock observer that invokes a subject's skip() method. 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 SkipObserverImpl implements 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 | * @see \TechDivision\Import\Observers\ObserverInterface::handle() 38 | */ 39 | public function handle(SubjectInterface $subject) 40 | { 41 | $subject->skipRow(); 42 | return $subject->getRow(); 43 | } 44 | 45 | /** 46 | * Set's the obeserver's subject instance to initialize the observer with. 47 | * 48 | * @param \TechDivision\Import\Subjects\SubjectInterface $subject The observer's subject 49 | * 50 | * @return void 51 | */ 52 | public function setSubject($subject) 53 | { 54 | } 55 | 56 | /** 57 | * Return's the observer's subject instance. 58 | * 59 | * @return \TechDivision\Import\Subjects\SubjectInterface The observer's subject instance 60 | */ 61 | public function getSubject() 62 | { 63 | } 64 | } 65 | --------------------------------------------------------------------------------