From e05a60c2ecbbf94019bc4bdc049b37d5a4094e6a Mon Sep 17 00:00:00 2001 From: mage2-team Date: Fri, 28 Nov 2014 11:40:11 -0800 Subject: [PATCH] 0.1.0-alpha106 * Various improvements: * Refactored Service Layer of the Magento_Tax Module * Stabilized functional tests for the Backend module * Stabilized functional tests for the CatalogRule module * Stabilized functional tests for the Checkout module * Stabilized functional tests for the CurrencySymbol module * Stabilized functional tests for the Shipping module * Stabilized functional tests for the Tax module * Stabilized functional tests for the User module * Added Readme.md files to the following modules: * Magento\RequireJs * Magento\Ui * Fixed bugs: * Fixed an issue where product image assignment to a store view was not considered when displaying a product * Fixed shipping address area blinking when billing address is filled during checkout with a virtual product * Fixed an issue where filter_store.html was not found * Fixed an issue where the customer account access menu did not expand on the storefront * Fixed an issue where CMS blocks did not open when clicking from a grid * Fixed an issue where the Create Product page was completely blocked after closing the New Attribute pop-up * Fixed an issue where Stock Status was disabled for Bundle and Grouped products * Fixed an issue where a product could not be saved without filling a not required bundle option * Fixed broken "per page" selectors on the Customer's account pages * Fixed the wrong behavior of JS loaders on the storefront pages * Fixed Shopping cart price rule form validation * Fixed an issue where the 'Please wait' spinner persisted when creating a customer custom attribute with existing code * Fixed a Google Chrome specific issue where subcategories were not displayed correctly on the first hover for category item * Fixed an issue where the 'Please wait' spinner did not disappear when creating customer with invalid email * Fixed an issue where the Username field auto-focus on admin login page revealed password in case of fast typing * Fixed an issue where Bundle Product original Price was not displayed in case of discount * Fixed wrong discount calculation for bundle options * Fixed an issue where wrong discount and total amounts were displayed on the order creation page when reordering an order with a bundle product in the Admin panel * Fixed an issue where admin tax notifications did not appear/disappear unless cache was flushed or disabled * Fixed an issue where catalog price and shopping cart price did not match when display currency was different from the base currency * Fixed an issue where Tax classes did not allow 'None' as a valid 'product tax class' * Fixed an issue where token-based authentication did not work if compilation was enabled * Fixed the sample code in index.php illustrating multi websites set up * Fixed commands in Setup CLI to match the ones displayed in help * Fixed an issue where searching by a part of a product name in Advanced Search did not give correct results * Fixed an issue where 404 page is displayed after Search Term mass deletion * Fixed an issue where Popular Search Terms were not displayed on the storefront * Fixed an issue where it was impossible to add Gift Message during one page checkout * Fixed an issue where the optional Postal code setting did not work correctly * Fixed an issue where product price details were missing in summary block in the shopping cart when the Back to shopping cart link was clicked on multishipping page * Fixed an issue where the 404 error page was displayed instead of the Index Management page after saving mass update * Fixed an issue where the "Out of Stock" message was not displayed for a bundle product when there was not enough of one of the associated products in stock * Fixed an issue with the Newsletters Report page in the Admin panel * Fixed an issue where Catalog price rule was not applying correct rates on specific products * Fixed an issue where a fatal error was thrown after clicking a link to a downloadable product * Fixed an issue a warning page for Grouped product with enabled MAP * Fixed an issue where a configurable product was not displayed in catalog product grid after updating with "Add configurable attributes to the new set based on current" * Fixed the inconsistent behavior in the integration tests for the Indexer functionality * Fixed an issue where the What's this? information tip link was not presented on product page with configured Minimum Advertised Price (MAP) * Processed GitHub requests: * [#742](https://github.com/magento/magento2/issues/742) -- Admin notifications count overflow * [#720](https://github.com/magento/magento2/issues/720) -- https filedriver is not working * [#686](https://github.com/magento/magento2/issues/686) -- Product save validation errors in the admin don't hide the overlay * [#702](https://github.com/magento/magento2/issues/702) -- Base table or view not found * [#652](https://github.com/magento/magento2/issues/652) -- Multishipping checkout not to change the Billing address js issue * [#648](https://github.com/magento/magento2/issues/648) -- An equal (=) sign in the hash of the product page to to break the tabs functionality * Service Contracts: * Refactored usage of new API of the Customer module * Implemented Service Contracts for the Sales module * Refactored Service Contracts for the Catalog module * Refactored Service Contracts for the Grouped module * UI Improvements: * Implemented the Form component in Magento UI Library * Removed extra JS loaders for category saving * Improved the behavior of Categories management in the Admin panel * Implemented the keyboard navigation through HTML elements * Improved the HTML structure and UI of the Catalog Category Link, Catalog Product Link and CMS Static Block widgets * Added UI Library documentation * Fixed Blank & Luma themes UI bugs * Fixed footer alignment * Published the Luma theme and removed the Plushe theme * Framework Improvements: * Added the ability to configure the list of loaded modules before installation * Merged SQL and Data Upgrades * Moved \Magento\TestFramework\Utility\Files to Magento Framework * Setup tool improvements: * Removed duplication with Framework * Deployment configuration is refactored from XML format in local.xml to associated array in config.php * Improved performance * Search improvements: * Integrated the Full Text Search library into the Layered Navigation functionality --- .gitignore | 4 +- .htaccess | 1 - CHANGELOG.md | 89 +- Gruntfile.js | 105 + .../Magento/AdminNotification/Model/Feed.php | 14 +- .../Model/System/Message/Security.php | 2 +- .../Magento/AdminNotification/composer.json | 10 +- .../Magento/AdminNotification/etc/module.xml | 2 +- .../view/adminhtml/requirejs-config.js | 33 + .../adminhtml/templates/toolbar_entry.phtml | 2 +- .../view/adminhtml/web/system/notification.js | 1 + .../Authorization/Model/Resource/Setup.php | 2 +- app/code/Magento/Authorization/composer.json | 6 +- app/code/Magento/Authorization/etc/module.xml | 2 +- .../Authorizenet/Model/Authorizenet.php | 5 +- .../Authorizenet/Model/Directpost/Request.php | 4 +- app/code/Magento/Authorizenet/composer.json | 18 +- app/code/Magento/Authorizenet/etc/module.xml | 2 +- .../view/frontend/requirejs-config.js | 31 + .../frontend/templates/directpost/form.phtml | 4 +- .../frontend/web/authorizenet-authenticate.js | 1 + .../view/frontend/web/js/direct-post.js | 2 +- .../Backend/App/Area/FrontNameResolver.php | 29 +- app/code/Magento/Backend/App/UserConfig.php | 106 + .../Form/Fieldset/Modules/DisableOutput.php | 2 +- .../Magento/Backend/Helper/Dashboard/Data.php | 13 +- app/code/Magento/Backend/Model/Config.php | 35 + .../Model/Config/Backend/Admin/Custom.php | 4 +- .../Model/Config/Backend/Admin/Custompath.php | 2 +- .../Admin/Password/Link/Expirationperiod.php | 4 +- .../Model/Config/Backend/Admin/Robots.php | 4 +- .../Model/Config/Backend/Admin/Usecustom.php | 4 +- .../Config/Backend/Admin/Usesecretkey.php | 2 +- .../Backend/Model/Config/Backend/Baseurl.php | 4 +- .../Backend/Model/Config/Backend/Cache.php | 2 +- .../Model/Config/Backend/Cookie/Domain.php | 2 +- .../Model/Config/Backend/Cookie/Lifetime.php | 2 +- .../Model/Config/Backend/Cookie/Path.php | 2 +- .../Model/Config/Backend/Currency/Allow.php | 2 +- .../Model/Config/Backend/Currency/Base.php | 2 +- .../Model/Config/Backend/Currency/Cron.php | 2 +- .../Backend/Currency/DefaultCurrency.php | 2 +- .../Model/Config/Backend/Datashare.php | 2 +- .../Model/Config/Backend/Email/Address.php | 2 +- .../Model/Config/Backend/Email/Logo.php | 4 +- .../Model/Config/Backend/Email/Sender.php | 2 +- .../Model/Config/Backend/Encrypted.php | 2 +- .../Backend/Model/Config/Backend/File.php | 2 +- .../Backend/Model/Config/Backend/Filename.php | 2 +- .../Model/Config/Backend/Image/Adapter.php | 2 +- .../Backend/Model/Config/Backend/Locale.php | 2 +- .../Model/Config/Backend/Locale/Timezone.php | 2 +- .../Backend/Model/Config/Backend/Log/Cron.php | 2 +- .../Backend/Model/Config/Backend/Secure.php | 2 +- .../Model/Config/Backend/Serialized.php | 2 +- .../Backend/Serialized/ArraySerialized.php | 4 +- .../Config/Backend/Storage/Media/Database.php | 2 +- .../Backend/Model/Config/Backend/Store.php | 2 +- .../Model/Config/Backend/Translate.php | 2 +- .../Config/Source/Storage/Media/Database.php | 25 +- .../Backend/Model/Config/Structure.php | 7 +- app/code/Magento/Backend/Model/Menu/Item.php | 2 +- .../Magento/Backend/Model/Search/Customer.php | 44 +- .../Backend/Model/Session/AdminConfig.php | 13 +- .../Magento/Backend/Model/Session/Quote.php | 30 +- .../Backend/Service/V1/ModuleService.php | 7 +- app/code/Magento/Backend/composer.json | 34 +- app/code/Magento/Backend/etc/di.xml | 10 - app/code/Magento/Backend/etc/module.xml | 2 +- .../Backend/view/adminhtml/layout/default.xml | 1 - .../view/adminhtml/requirejs-config.js | 58 + .../adminhtml/templates/admin/login.phtml | 25 +- .../view/adminhtml/templates/admin/page.phtml | 4 - .../adminhtml/templates/page/header.phtml | 2 +- .../templates/page/js/components.phtml | 15 - .../templates/page/js/require_js.phtml | 6 +- .../adminhtml/templates/store/switcher.phtml | 2 +- .../system/storage/media/synchronize.phtml | 2 - .../adminhtml/web/system/validation-rules.js | 1 - .../Backup/Model/Config/Backend/Cron.php | 2 +- app/code/Magento/Backup/composer.json | 12 +- app/code/Magento/Backup/etc/module.xml | 2 +- .../Catalog/Product/View/Type/Bundle.php | 29 +- .../Bundle/Model/Plugin/BundleOptions.php | 140 + .../Magento/Bundle/Model/Plugin/Product.php | 59 + .../Magento/Bundle/Model/Product/Price.php | 50 +- .../Magento/Bundle/Model/Product/Type.php | 42 +- app/code/Magento/Bundle/Model/Selection.php | 4 +- .../Adjustment/BundleCalculatorInterface.php | 19 +- .../Bundle/Pricing/Adjustment/Calculator.php | 54 +- .../Pricing/Price/BundleOptionPrice.php | 4 +- .../Pricing/Price/BundleRegularPrice.php | 96 + .../Pricing/Price/BundleSelectionPrice.php | 45 +- .../Bundle/Pricing/Price/ConfiguredPrice.php | 4 +- .../Bundle/Pricing/Price/FinalPrice.php | 46 +- .../Bundle/Pricing/Price/GroupPrice.php | 8 + .../Pricing/Price/RegularPriceInterface.php | 45 + .../Bundle/Pricing/Price/SpecialPrice.php | 8 + .../Bundle/Pricing/Price/TierPrice.php | 8 + .../V1/Product/BundleProductSaveProcessor.php | 1 + .../Service/V1/Product/Link/WriteService.php | 29 +- .../Service/V1/Product/Option/ReadService.php | 11 + .../V1/Product/Option/WriteService.php | 19 +- app/code/Magento/Bundle/composer.json | 30 +- ...all-1.6.0.0.php => data-install-2.0.0.php} | 27 +- app/code/Magento/Bundle/etc/data_object.xml | 6 +- app/code/Magento/Bundle/etc/di.xml | 14 +- app/code/Magento/Bundle/etc/module.xml | 2 +- .../sql/bundle_setup/install-1.6.0.0.php | 829 --- .../Bundle/sql/bundle_setup/install-2.0.0.php | 1026 ++++ .../upgrade-1.6.0.0-1.6.0.0.1.php | 83 - .../view/adminhtml/requirejs-config.js} | 14 +- .../templates/product/edit/bundle.phtml | 2 - .../product/edit/bundle/option.phtml | 2 +- .../view/adminhtml/web/js/bundle-product.js | 42 +- .../templates/product/price/final_price.phtml | 58 +- .../product/price/selection/amount.phtml | 2 +- .../catalog_product_view_type_bundle.xml | 9 +- .../Bundle/view/frontend/requirejs-config.js | 32 + .../Bundle/view/frontend/web/bundle.js | 2 +- .../view/frontend/web/js/product-summary.js | 2 + .../Bundle/view/frontend/web/js/slide.js | 10 +- app/code/Magento/Captcha/composer.json | 14 +- app/code/Magento/Captcha/etc/module.xml | 2 +- .../view/frontend/requirejs-config.js} | 16 +- .../view/frontend/templates/default.phtml | 10 +- .../Captcha/view/frontend/web/captcha.js | 9 +- .../Api/AttributeSetManagementInterface.php} | 25 +- .../Api/AttributeSetRepositoryInterface.php | 76 + ...goryAttributeOptionManagementInterface.php | 41 + .../CategoryAttributeRepositoryInterface.php} | 33 +- .../Api/CategoryLinkManagementInterface.php | 36 + .../Api/CategoryLinkRepositoryInterface.php | 64 + .../Api/CategoryManagementInterface.php} | 40 +- .../Api/CategoryRepositoryInterface.php | 70 + .../Api/Data/CategoryAttributeInterface.php | 32 + ...ategoryAttributeSearchResultsInterface.php | 35 + .../Catalog/Api/Data/CategoryInterface.php | 100 + .../Api/Data/CategoryProductLinkInterface.php | 45 + .../Api/Data/CategoryTreeInterface.php} | 62 +- .../Api/Data/EavAttributeInterface.php | 174 + .../Api/Data/ProductAttributeDataBuilder.php | 410 ++ .../Api/Data/ProductAttributeInterface.php | 32 + ...ibuteMediaGalleryEntryContentInterface.php | 54 + ...uctAttributeMediaGalleryEntryInterface.php | 78 + ...ProductAttributeSearchResultsInterface.php | 35 + .../Data/ProductAttributeTypeInterface.php | 46 + .../Api/Data/ProductCustomOptionInterface.php | 116 + .../Data/ProductCustomOptionTypeInterface.php | 49 + .../ProductCustomOptionValuesInterface.php | 71 + .../Api/Data/ProductGroupPriceInterface.php | 42 + .../Catalog/Api/Data/ProductInterface.php | 139 + .../Data/ProductLinkAttributeInterface.php | 42 + .../Catalog/Api/Data/ProductLinkInterface.php | 63 + .../Api/Data/ProductLinkSearchResults.php} | 11 +- .../Api/Data/ProductLinkTypeInterface.php | 42 + .../Data/ProductSearchResultsInterface.php | 35 + .../Api/Data/ProductTierPriceInterface.php} | 29 +- .../Catalog/Api/Data/ProductTypeInterface.php | 43 + ...oductAttributeGroupRepositoryInterface.php | 69 + .../ProductAttributeManagementInterface.php | 62 + ...tributeMediaGalleryManagementInterface.php | 97 + ...ductAttributeOptionManagementInterface.php | 61 + .../ProductAttributeRepositoryInterface.php | 79 + .../ProductAttributeTypesListInterface.php | 35 + ...ProductCustomOptionRepositoryInterface.php | 68 + .../ProductCustomOptionTypeListInterface.php | 35 + .../ProductGroupPriceManagementInterface.php | 61 + .../Api/ProductLinkManagementInterface.php} | 38 +- .../Api/ProductLinkRepositoryInterface.php} | 44 +- .../Api/ProductLinkTypeListInterface.php | 43 + ...oductMediaAttributeManagementInterface.php | 35 + .../Api/ProductRepositoryInterface.php | 76 + .../ProductTierPriceManagementInterface.php | 63 + .../Catalog/Api/ProductTypeListInterface.php | 36 + .../Adminhtml/Category/AbstractCategory.php | 21 +- .../Block/Adminhtml/Category/Edit/Form.php | 55 +- .../Product/Attribute/Edit/Tab/Front.php | 15 + .../Block/Adminhtml/Product/Edit/Js.php | 8 +- .../Adminhtml/Product/Edit/Tab/Attributes.php | 1 + .../Edit/Tab/Price/Group/AbstractGroup.php | 34 +- .../Adminhtml/Product/Edit/Tab/Price/Tier.php | 4 +- .../Magento/Catalog/Block/Category/View.php | 6 +- app/code/Magento/Catalog/Block/Navigation.php | 9 +- .../Catalog/Block/Product/ListProduct.php | 6 +- .../Block/Product/ProductList/Promotion.php | 18 +- .../Block/Product/ProductList/Random.php | 18 +- .../Magento/Catalog/Block/Product/View.php | 34 +- .../Controller/Adminhtml/Category/Save.php | 51 +- .../Product/Action/Attribute/Save.php | 7 - .../Adminhtml/Product/Attribute/Save.php | 136 +- .../Catalog/Controller/Category/View.php | 16 +- app/code/Magento/Catalog/Helper/Data.php | 38 +- .../Magento/Catalog/Model/AbstractModel.php | 10 +- app/code/Magento/Catalog/Model/Category.php | 170 +- .../Catalog/Model/Category/Attribute.php | 166 + .../Category/Attribute/OptionManagement.php} | 33 +- .../Model/Category/AttributeRepository.php | 107 + .../Magento/Catalog/Model/Category/Tree.php | 165 + .../Catalog/Model/CategoryLinkManagement.php | 77 + .../Catalog/Model/CategoryLinkRepository.php | 118 + .../Catalog/Model/CategoryManagement.php | 93 + .../Catalog/Model/CategoryProductLink.php | 53 + .../Catalog/Model/CategoryRepository.php | 185 + .../Catalog/Model/Config/Backend/Category.php | 2 +- .../Model/Config/Source/Price/Step.php | 11 +- .../Catalog/Model/Entity/Attribute.php | 18 +- .../Category/Flat/System/Config/Mode.php | 2 +- .../Product/Flat/System/Config/Mode.php | 2 +- .../Product/Price/Plugin/CustomerGroup.php | 24 +- .../Price/System/Config/PriceScope.php | 2 +- .../Magento/Catalog/Model/Layer/Category.php | 7 +- .../Catalog/Model/Layer/Category/Context.php | 41 - .../Category/FilterableAttributeList.php | 8 +- .../Model/Layer/Filter/AbstractFilter.php | 71 +- .../Catalog/Model/Layer/Filter/Attribute.php | 58 +- .../Catalog/Model/Layer/Filter/Category.php | 110 +- .../Layer/Filter/DataProvider/Category.php | 185 + .../Layer/Filter/DataProvider/Decimal.php | 165 + .../Model/Layer/Filter/DataProvider/Price.php | 400 ++ .../Catalog/Model/Layer/Filter/Decimal.php | 132 +- .../Layer/Filter/Dynamic/AlgorithmFactory.php | 99 + .../Filter/Dynamic/AlgorithmInterface.php | 34 + .../Model/Layer/Filter/Dynamic/Auto.php | 147 + .../Model/Layer/Filter/Dynamic/Improved.php | 128 + .../Model/Layer/Filter/Dynamic/Manual.php | 120 + .../Model/Layer/Filter/FilterInterface.php | 157 + .../Model/Layer/Filter/Item/DataBuilder.php | 74 + .../Catalog/Model/Layer/Filter/Price.php | 452 +- .../Model/Layer/Filter/Price/Range.php | 80 + .../Model/Layer/Filter/Price/Render.php | 116 + .../Catalog/Model/Layer/FilterList.php | 29 +- .../Magento/Catalog/Model/Layer/Resolver.php | 92 + .../Magento/Catalog/Model/Layer/Search.php | 5 +- .../Catalog/Model/Layer/Search/Context.php | 45 - .../Model/Layer/Search/Filter/Attribute.php | 4 +- .../Layer/Search/FilterableAttributeList.php | 6 +- app/code/Magento/Catalog/Model/Observer.php | 6 +- app/code/Magento/Catalog/Model/Product.php | 142 +- .../Product/Attribute/Backend/Groupprice.php | 11 +- .../Backend/Groupprice/AbstractGroupprice.php | 16 +- .../Product/Attribute/Backend/Tierprice.php | 11 +- .../Catalog/Model/Product/Attribute/Group.php | 4 +- .../Model/Product/Attribute/Management.php | 75 + .../Product/Attribute/OptionManagement.php | 83 + .../Model/Product/Attribute/Repository.php | 306 ++ .../Model/Product/Attribute/SetManagement.php | 91 + .../Model/Product/Attribute/SetRepository.php | 139 + .../Catalog/Model/Product/Attribute/Type.php | 26 +- .../Model/Product/Attribute/TypesList.php | 68 + .../AttributeSet/AlreadyExistsException.php | 29 + .../Model/Product/AttributeSet/Build.php | 124 + .../Catalog/Model/Product/Compare/Item.php | 4 +- .../Product/Gallery/ContentValidator.php | 108 + .../Catalog/Model/Product/Gallery/Entry.php | 81 +- .../Model/Product/Gallery/EntryResolver.php | 75 + .../Product/Gallery/GalleryManagement.php | 326 ++ .../Model/Product/GroupPrice.php} | 30 +- .../Model/Product/GroupPriceManagement.php | 174 + .../Model/Product/LinkTypeProvider.php | 70 +- .../Product/Media/AttributeManagement.php | 67 + .../Product/Media/GalleryEntryContent.php | 34 +- .../Magento/Catalog/Model/Product/Option.php | 149 +- .../Model/Product/Option/Converter.php} | 50 +- .../Model/Product/Option/Repository.php | 186 + .../Catalog/Model/Product/Option/Type.php | 59 + .../Model/Product/Option/Type/File.php | 471 +- .../Product/Option/Type/File/Exception.php | 29 + .../Option/Type/File/LargeSizeException.php | 29 + .../Option/Type/File/NotImageException.php | 29 + .../Type/File/OptionRequiredException.php | 29 + .../Type/File/RunValidationException.php | 29 + .../Option/Type/File/ValidateFactory.php | 36 + .../Product/Option/Type/File/Validator.php | 203 + .../Option/Type/File/ValidatorFile.php | 236 + .../Option/Type/File/ValidatorInfo.php | 168 + .../Catalog/Model/Product/Option/Value.php | 61 +- .../Catalog/Model/Product/PriceModifier.php | 27 +- .../Catalog/Model/Product/TierPrice.php | 23 +- .../Model/Product/TierPriceManagement.php | 201 + .../Catalog/Model/Product/Type/Price.php | 13 +- .../Model/ProductAttributeGroupRepository.php | 114 + .../Catalog/Model/ProductLink/Attribute.php | 46 + .../Model/ProductLink/CollectionProvider.php | 74 + .../CollectionProvider/Crosssell.php | 36 + .../CollectionProvider/Related.php | 36 + .../ProductLink/CollectionProvider/Upsell.php | 36 + .../CollectionProviderInterface.php | 36 + .../Converter/ConverterInterface.php | 36 + .../ProductLink/Converter/ConverterPool.php} | 36 +- .../Converter/DefaultConverter.php} | 21 +- .../Catalog/Model/ProductLink/Link.php | 134 + .../Catalog/Model/ProductLink/Management.php | 172 + .../Catalog/Model/ProductLink/Repository.php | 147 + .../Catalog/Model/ProductLink/Type.php | 46 + .../Catalog/Model/ProductOptions/Config.php | 3 +- .../Catalog/Model/ProductOptions/TypeList.php | 72 + .../Catalog/Model/ProductRepository.php | 235 +- .../Magento/Catalog/Model/ProductType.php | 32 +- .../Magento/Catalog/Model/ProductTypeList.php | 85 + .../Category/Attribute/Collection.php | 4 +- .../Catalog/Model/Resource/Eav/Attribute.php | 161 +- .../Model/Resource/Layer/Filter/Attribute.php | 10 +- .../Model/Resource/Layer/Filter/Decimal.php | 16 +- .../Model/Resource/Layer/Filter/Price.php | 12 +- .../Catalog/Model/Resource/Product.php | 56 +- .../Product/Attribute/Backend/Media.php | 25 +- .../Resource/Product/Attribute/Collection.php | 4 +- .../Model/Resource/Product/Collection.php | 17 +- .../Product/Compare/Item/Collection.php | 3 + .../Magento/Catalog/Model/Resource/Setup.php | 73 +- .../Magento/Catalog/Model/Rss/Category.php | 6 +- .../Backend/Catalog/Url/Rewrite/Suffix.php | 6 +- .../Catalog/Pricing/Price/ConfiguredPrice.php | 4 +- .../Catalog/Pricing/Price/FinalPrice.php | 28 +- .../Catalog/Pricing/Price/GroupPrice.php | 19 +- .../Catalog/Pricing/Price/RegularPrice.php | 3 +- .../Catalog/Pricing/Price/SpecialPrice.php | 18 +- .../Pricing/Price/SpecialPriceInterface.php | 5 + .../Catalog/Pricing/Price/TierPrice.php | 42 +- .../Pricing/Price/TierPriceInterface.php | 5 + .../Catalog/Pricing/Render/FinalPriceBox.php | 3 +- .../Attribute/ReadServiceInterface.php | 3 + .../V1/Category/MetadataServiceInterface.php | 4 +- .../ProductLinks/ReadServiceInterface.php | 7 + .../ProductLinks/WriteServiceInterface.php | 13 + .../V1/Category/ReadServiceInterface.php | 5 + .../V1/Category/Tree/ReadServiceInterface.php | 4 + .../Service/V1/Category/WriteService.php | 2 - .../V1/Category/WriteServiceInterface.php | 11 + .../Catalog/Service/V1/Data/Category.php | 2 + .../Service/V1/Data/Category/Mapper.php | 12 +- .../Service/V1/Data/Category/ProductLink.php | 5 +- .../Service/V1/Data/Eav/AttributeMetadata.php | 2 + .../Service/V1/Data/Eav/AttributeSet.php | 2 + .../Data/Eav/Category/AttributeMetadata.php | 1 + .../Service/V1/Data/Eav/Category/Tree.php | 2 + .../Catalog/Service/V1/Data/Eav/Option.php | 2 + .../Catalog/Service/V1/Data/Product.php | 2 + .../Service/V1/Data/Product/GroupPrice.php | 2 + .../Service/V1/Data/Product/TierPrice.php | 2 + .../Catalog/Service/V1/Data/ProductMapper.php | 19 +- .../Catalog/Service/V1/Data/ProductType.php | 2 + .../Catalog/Service/V1/MetadataService.php | 2 + .../Service/V1/MetadataServiceInterface.php | 2 + .../Attribute/Media/ReadServiceInterface.php | 6 + .../Attribute/Media/WriteServiceInterface.php | 6 + .../Attribute/Option/ReadServiceInterface.php | 5 + .../Option/WriteServiceInterface.php | 8 + .../Attribute/ReadServiceInterface.php | 6 + .../V1/Product/Attribute/WriteService.php | 2 +- .../Attribute/WriteServiceInterface.php | 6 + .../AttributeGroup/ReadServiceInterface.php | 2 + .../AttributeGroup/WriteServiceInterface.php | 6 + .../AttributeServiceInterface.php | 4 + .../AttributeSet/ReadServiceInterface.php | 6 + .../AttributeSet/WriteServiceInterface.php | 6 + .../V1/Product/CustomOptions/Data/Option.php | 4 +- .../CustomOptions/Data/Option/Metadata.php | 3 +- .../Product/CustomOptions/Data/OptionType.php | 4 +- .../CustomOptions/ReadServiceInterface.php | 14 + .../CustomOptions/WriteServiceInterface.php | 14 + .../Service/V1/Product/GroupPriceService.php | 18 +- .../V1/Product/GroupPriceServiceInterface.php | 10 + .../V1/Product/Link/Data/LinkAttribute.php | 2 + .../Service/V1/Product/Link/Data/LinkType.php | 2 + .../V1/Product/Link/Data/ProductLink.php | 3 +- .../Service/V1/Product/Link/ReadService.php | 12 +- .../V1/Product/Link/ReadServiceInterface.php | 12 + .../Service/V1/Product/Link/WriteService.php | 18 +- .../V1/Product/Link/WriteServiceInterface.php | 13 + .../V1/Product/MetadataServiceInterface.php | 2 + .../Service/V1/Product/TierPriceService.php | 32 +- .../V1/Product/TierPriceServiceInterface.php | 10 + .../Catalog/Service/V1/ProductService.php | 1 + .../Service/V1/ProductServiceInterface.php | 12 + .../V1/ProductTypeServiceInterface.php | 5 + app/code/Magento/Catalog/composer.json | 48 +- .../catalog_setup/data-install-1.6.0.0.php | 166 - .../data/catalog_setup/data-install-2.0.0.php | 267 + .../data-upgrade-1.6.0.0.1-1.6.0.0.2.php | 50 - .../data-upgrade-1.6.0.0.12-1.6.0.0.13.php | 61 - .../data-upgrade-1.6.0.0.13-1.6.0.0.14.php | 74 - .../data-upgrade-1.6.0.0.14-1.6.0.0.15.php | 35 - .../data-upgrade-1.6.0.0.16-1.6.0.0.17.php | 58 - .../data-upgrade-1.6.0.0.17-1.6.0.0.18.php | 66 - .../data-upgrade-1.6.0.0.18-1.6.0.0.19.php | 51 - .../data-upgrade-1.6.0.0.20-1.6.0.0.21.php | 120 - .../data-upgrade-1.6.0.0.21-1.6.0.0.22.php | 56 - .../data-upgrade-1.6.0.0.23-1.6.0.0.24.php | 67 - .../data-upgrade-1.6.0.0.24-1.6.0.0.25.php | 31 - .../data-upgrade-1.6.0.0.28-1.6.0.0.29.php | 39 - .../data-upgrade-1.6.0.0.4-1.6.0.0.5.php | 64 - .../data-upgrade-1.6.0.0.9-1.6.0.0.10.php | 42 - app/code/Magento/Catalog/etc/di.xml | 130 +- app/code/Magento/Catalog/etc/module.xml | 2 +- app/code/Magento/Catalog/etc/webapi.xml | 292 +- app/code/Magento/Catalog/i18n/de_DE.csv | 1 - app/code/Magento/Catalog/i18n/en_US.csv | 1 - app/code/Magento/Catalog/i18n/es_ES.csv | 1 - app/code/Magento/Catalog/i18n/fr_FR.csv | 1 - app/code/Magento/Catalog/i18n/nl_NL.csv | 1 - app/code/Magento/Catalog/i18n/pt_BR.csv | 1 - app/code/Magento/Catalog/i18n/zh_CN.csv | 1 - .../sql/catalog_setup/install-1.6.0.0.0.php | 3889 -------------- .../sql/catalog_setup/install-2.0.0.php | 4530 +++++++++++++++++ .../upgrade-1.6.0.0.11-1.6.0.0.12.php | 32 - .../upgrade-1.6.0.0.2-1.6.0.0.3.php | 48 - .../upgrade-1.6.0.0.25-1.6.0.0.26.php | 46 - .../upgrade-1.6.0.0.26-1.6.0.0.27.php | 59 - .../upgrade-1.6.0.0.27-1.6.0.0.28.php | 36 - .../upgrade-1.6.0.0.4-1.6.0.0.5.php | 38 - .../upgrade-1.6.0.0.6-1.6.0.0.7.php | 37 - .../upgrade-1.6.0.0.7-1.6.0.0.8.php | 74 - .../upgrade-1.6.0.0.8-1.6.0.0.9.php | 46 - .../upgrade-1.6.0.0.9-1.6.0.0.10.php | 216 - .../view/adminhtml/requirejs-config.js} | 27 +- .../templates/catalog/category/edit.phtml | 60 +- .../catalog/category/edit/form.phtml | 15 +- .../templates/catalog/category/tree.phtml | 63 +- .../templates/catalog/product/edit.phtml | 2 +- .../product/edit/attribute/search.phtml | 2 +- .../web/catalog/base-image-uploader.js | 10 +- .../adminhtml/web/catalog/category/form.js | 9 +- .../view/adminhtml/web/catalog/product.js | 5 +- .../adminhtml/web/js/bootstrap/product-new.js | 1 - .../view/adminhtml/web/js/category-tree.js | 3 +- .../adminhtml/web/js/new-category-dialog.js | 2 + .../view/adminhtml/web/js/product-gallery.js | 5 +- .../product/price/amount/default.phtml | 2 +- .../product/price/amount/option.phtml | 2 +- .../Catalog/view/base/web/js/tier-price.js | 9 +- .../frontend/layout/catalog_product_view.xml | 30 +- .../Catalog/view/frontend/requirejs-config.js | 39 + .../category/widget/link/link_block.phtml | 4 +- .../category/widget/link/link_inline.phtml | 4 +- .../frontend/templates/product/list.phtml | 63 +- .../frontend/templates/product/listing.phtml | 2 +- .../templates/product/view/addtocart.phtml | 4 +- .../templates/product/view/attributes.phtml | 6 +- .../product/view/options/wrapper.phtml | 2 +- .../product/widget/link/link_block.phtml | 4 +- .../product/widget/link/link_inline.phtml | 4 +- .../Catalog/view/frontend/web/js/compare.js | 5 +- .../view/frontend/web/js/date-option.js | 3 + .../view/frontend/web/js/file-option.js | 9 +- .../Catalog/view/frontend/web/js/gallery.js | 2 + .../Catalog/view/frontend/web/js/list.js | 9 +- .../view/frontend/web/js/price-option.js | 2 + .../frontend/web/js/product/list/toolbar.js | 6 +- .../view/frontend/web/js/related-products.js | 2 + .../view/frontend/web/js/upsell-products.js | 8 +- .../frontend/web/product/view/validation.js | 4 + .../Model/Import/Product.php | 20 +- .../Magento/CatalogImportExport/composer.json | 20 +- .../CatalogImportExport/etc/module.xml | 2 +- .../Adminhtml/Form/Field/Customergroup.php | 42 +- .../Block/Adminhtml/Form/Field/Stock.php | 3 +- .../CatalogInventory/Helper/Minsaleqty.php | 30 +- .../Model/Adminhtml/Stock/Item.php | 58 +- .../Model/Config/Backend/Backorders.php | 2 +- .../Model/Config/Backend/Managestock.php | 2 +- .../CatalogInventory/Model/Stock/Item.php | 22 + .../Model/System/Config/Backend/Minqty.php | 4 +- .../System/Config/Backend/Minsaleqty.php | 2 +- .../System/Config/Backend/Qtyincrements.php | 2 +- .../Magento/CatalogInventory/composer.json | 18 +- ...3-1.6.0.0.4.php => data-install-2.0.0.php} | 11 +- .../data-upgrade-1.6.0.0.0-1.6.0.0.1.php | 34 - .../Magento/CatalogInventory/etc/module.xml | 2 +- .../install-1.6.0.0.php | 390 -- .../cataloginventory_setup/install-2.0.0.php | 458 ++ .../upgrade-1.6.0.0.1-1.6.0.0.2.php | 42 - .../upgrade-1.6.0.0.2-1.6.0.0.3.php | 39 - .../upgrade-1.6.0.0.5-1.6.0.0.6.php | 53 - .../upgrade-1.6.0.0.6-1.6.0.0.7.php | 72 - .../Adminhtml/Promo/Catalog/Edit/Tab/Main.php | 25 +- .../Model/Indexer/IndexBuilder.php | 43 +- .../Magento/CatalogRule/Model/Observer.php | 15 +- .../Pricing/Price/CatalogRulePrice.php | 9 +- app/code/Magento/CatalogRule/composer.json | 20 +- ...0.3-1.6.0.4.php => data-install-2.0.0.php} | 6 +- app/code/Magento/CatalogRule/etc/module.xml | 2 +- .../sql/catalogrule_setup/install-1.6.0.0.php | 412 -- .../sql/catalogrule_setup/install-2.0.0.php | 533 ++ .../upgrade-1.6.0.0-1.6.0.1.php | 53 - .../upgrade-1.6.0.1-1.6.0.2.php | 127 - .../upgrade-1.6.0.2-1.6.0.3.php | 49 - .../upgrade-1.6.0.3-1.6.0.4.php | 57 - .../adminhtml/templates/promo/fieldset.phtml | 6 +- .../CatalogSearch/Block/Advanced/Result.php | 10 +- .../Magento/CatalogSearch/Block/Result.php | 10 +- .../Controller/Advanced/Result.php | 16 +- .../CatalogSearch/Controller/Result/Index.php | 16 +- .../Mysql/Aggregation/DataProvider.php | 214 +- .../Adapter/Mysql/Filter/Preprocessor.php | 24 +- .../Aggregation/Category/DataProvider.php | 127 + .../Magento/CatalogSearch/Model/Advanced.php | 5 +- .../Model/Config/Backend/Search/Type.php | 99 - .../Model/Config/Source/Search/Type.php | 46 - .../Magento/CatalogSearch/Model/Fulltext.php | 23 - .../Model/Indexer/Fulltext/Action/Full.php | 85 +- .../CatalogSearch/Model/Layer/Advanced.php | 5 +- .../Advanced/FilterableAttributeList.php | 6 +- .../ItemCollectionProvider.php | 23 +- .../Model/Layer/Filter/Attribute.php | 130 + .../Model/Layer/Filter/Category.php | 147 + .../Model/Layer/Filter/Decimal.php | 168 + .../Model/Layer/Filter/Price.php | 278 + .../Layer/Search/AvailabilityFlag/Plugin.php | 83 - .../Model/Resource/Advanced/Collection.php | 6 +- .../Model/Resource/{Fulltext => }/Engine.php | 111 +- .../Model/Resource/EngineInterface.php | 10 + .../Model/Resource/EngineProvider.php | 24 +- .../Model/Resource/Fulltext/Collection.php | 145 +- .../Resource/Product/CollectionFactory.php | 80 + .../Model/Resource/Search/Collection.php | 3 + .../Model/Search/IndexBuilder.php | 107 + .../Model/Search/RequestGenerator.php | 63 +- app/code/Magento/CatalogSearch/composer.json | 24 +- .../CatalogSearch/etc/adminhtml/system.xml | 10 - app/code/Magento/CatalogSearch/etc/config.xml | 6 +- app/code/Magento/CatalogSearch/etc/di.xml | 109 +- .../Magento/CatalogSearch/etc/frontend/di.xml | 3 - app/code/Magento/CatalogSearch/etc/module.xml | 2 +- .../CatalogSearch/etc/search_request.xml | 43 +- .../catalogsearch_setup/install-1.6.0.0.php | 83 - .../sql/catalogsearch_setup/install-2.0.0.php | 89 + .../view/frontend/requirejs-config.js} | 16 +- .../Magento/CatalogUrlRewrite/composer.json | 18 +- ...all-1.0.0.0.php => data-install-2.0.0.php} | 16 +- .../Magento/CatalogUrlRewrite/etc/module.xml | 2 +- .../install-1.0.0.0.php | 80 - .../catalogurlrewrite_setup/install-2.0.0.php | 85 + app/code/Magento/Centinel/composer.json | 14 +- app/code/Magento/Centinel/etc/module.xml | 2 +- .../view/frontend/requirejs-config.js | 30 + .../frontend/web/centinel-authenticate.js | 3 +- .../Checkout/Block/Adminhtml/CartTab.php | 90 + .../Magento/Checkout/Block/Cart/Crosssell.php | 2 +- app/code/Magento/Checkout/Block/Cart/Link.php | 2 + app/code/Magento/Checkout/Block/Link.php | 2 + .../Block/Onepage/AbstractOnepage.php | 4 +- app/code/Magento/Checkout/Model/Session.php | 3 +- .../Magento/Checkout/Model/Type/Onepage.php | 24 +- .../Checkout/Service/V1/Item/WriteService.php | 14 +- app/code/Magento/Checkout/composer.json | 37 +- ...all-1.6.0.0.php => data-install-2.0.0.php} | 0 app/code/Magento/Checkout/etc/module.xml | 3 +- .../layout/checkout_onepage_index.xml | 4 +- .../view/frontend/requirejs-config.js | 25 +- .../view/frontend/templates/cart/coupon.phtml | 4 +- .../view/frontend/templates/cart/form.phtml | 2 +- .../cart/item/configure/updatecart.phtml | 2 +- .../templates/cart/item/default.phtml | 2 +- .../view/frontend/templates/onepage.phtml | 25 +- .../frontend/templates/onepage/billing.phtml | 4 +- .../frontend/templates/onepage/login.phtml | 177 +- .../templates/onepage/review/info.phtml | 2 +- .../templates/onepage/review/totals.phtml | 6 +- .../frontend/templates/onepage/shipping.phtml | 4 +- .../frontend/templates/total/default.phtml | 6 +- .../frontend/templates/total/nominal.phtml | 12 +- .../view/frontend/web/js/discount-codes.js | 4 +- .../view/frontend/web/js/opc-billing-info.js | 3 +- .../frontend/web/js/opc-checkout-method.js | 2 + .../view/frontend/web/js/opc-order-review.js | 3 +- .../view/frontend/web/js/opc-payment-info.js | 3 +- .../view/frontend/web/js/opc-shipping-info.js | 3 +- .../frontend/web/js/opc-shipping-method.js | 3 +- .../Checkout/view/frontend/web/js/overview.js | 3 +- .../frontend/web/js/payment-authentication.js | 1 + .../Checkout/view/frontend/web/js/payment.js | 2 + .../view/frontend/web/js/region-updater.js | 10 +- .../view/frontend/web/js/shopping-cart.js | 4 +- .../Checkout/view/frontend/web/js/sidebar.js | 1 + .../CheckoutAgreements/Model/Agreement.php | 4 +- .../Magento/CheckoutAgreements/composer.json | 10 +- .../Magento/CheckoutAgreements/etc/di.xml | 2 +- .../Magento/CheckoutAgreements/etc/module.xml | 2 +- ...{install-1.0.0.0.php => install-2.0.0.php} | 0 app/code/Magento/Cms/Model/Block.php | 4 +- app/code/Magento/Cms/Model/Resource/Setup.php | 2 +- .../Cms/Ui/DataProvider/Block/Row/Actions.php | 5 +- .../Ui/DataProvider/Page/Options/IsActive.php | 2 +- .../DataProvider/Page/Options/PageLayout.php | 2 +- .../Cms/Ui/DataProvider/Page/Row/Actions.php | 6 +- app/code/Magento/Cms/composer.json | 20 +- .../Magento/Cms/etc/frontend/page_types.xml | 1 + app/code/Magento/Cms/etc/module.xml | 2 +- .../adminhtml/layout/cms_block_listing.xml | 91 +- .../adminhtml/layout/cms_page_listing.xml | 234 +- .../view/adminhtml/requirejs-config.js} | 16 +- .../Cms/view/adminhtml/web/js/folder-tree.js | 8 +- .../templates/widget/link/link_block.phtml | 6 +- .../templates/widget/link/link_inline.phtml | 6 +- .../widget/static_block/default.phtml | 4 +- app/code/Magento/CmsUrlRewrite/composer.json | 8 +- app/code/Magento/CmsUrlRewrite/etc/module.xml | 2 +- .../ConfigurableImportExport/composer.json | 14 +- .../ConfigurableImportExport/etc/module.xml | 2 +- .../Product/Type/Configurable/Attribute.php | 4 +- .../Model/Product/Type/Configurable/Price.php | 12 +- .../Product/Collection/AssociatedProduct.php | 5 + .../Plugin/Model/Resource/Product.php | 34 +- .../Pricing/Price/AttributePrice.php | 37 +- .../Magento/ConfigurableProduct/composer.json | 28 +- ...all-1.0.0.0.php => data-install-2.0.0.php} | 4 +- .../ConfigurableProduct/etc/adminhtml/di.xml | 3 + .../ConfigurableProduct/etc/module.xml | 2 +- .../install-1.0.0.0.php | 290 -- .../install-2.0.0.php | 318 ++ .../view/adminhtml/requirejs-config.js | 31 + .../catalog/product/edit/super/matrix.phtml | 4 +- .../web/catalog/product-variation.js | 6 +- .../web/catalog/product/attribute.js | 4 +- .../view/frontend/requirejs-config.js | 30 + .../view/frontend/web/js/configurable.js | 2 + app/code/Magento/Contact/Helper/Data.php | 6 +- app/code/Magento/Contact/composer.json | 12 +- app/code/Magento/Contact/etc/module.xml | 2 +- .../Core/Model/Design/Backend/Exceptions.php | 4 +- .../Core/Model/Design/Backend/Theme.php | 4 +- app/code/Magento/Core/Model/Layout/Update.php | 4 +- .../Magento/Core/Model/Resource/Setup.php | 2 +- app/code/Magento/Core/Model/Theme.php | 8 +- app/code/Magento/Core/Model/Theme/File.php | 8 +- app/code/Magento/Core/composer.json | 16 +- app/code/Magento/Core/etc/cache.xml | 2 +- app/code/Magento/Core/etc/di.xml | 16 +- app/code/Magento/Core/etc/module.xml | 2 +- .../view/adminhtml/requirejs-config.js} | 16 +- .../view/frontend/requirejs-config.js} | 16 +- .../view/frontend/web/js/require-cookie.js | 4 +- .../Model/Config/Backend/Product/Alert.php | 2 +- .../Cron/Model/Config/Backend/Sitemap.php | 2 +- app/code/Magento/Cron/composer.json | 8 +- app/code/Magento/Cron/etc/module.xml | 2 +- app/code/Magento/CurrencySymbol/composer.json | 14 +- .../Magento/CurrencySymbol/etc/module.xml | 2 +- .../Api/AddressRepositoryInterface.php | 2 +- .../Api/CustomerRepositoryInterface.php | 3 +- .../Customer/Api/Data/CustomerInterface.php | 2 +- .../Customer/Api/GroupManagementInterface.php | 25 + .../Customer/Api/GroupRepositoryInterface.php | 2 +- .../Block/Account/AuthorizationLink.php | 2 + .../Customer/Block/Account/Customer.php | 14 +- .../Customer/Block/Account/Dashboard.php | 56 +- .../Block/Account/Dashboard/Address.php | 36 +- .../Customer/Block/Account/Dashboard/Info.php | 3 +- .../Magento/Customer/Block/Account/Link.php | 5 + .../Customer/Block/Account/RegisterLink.php | 2 + .../Magento/Customer/Block/Address/Book.php | 52 +- .../Magento/Customer/Block/Address/Edit.php | 40 +- .../Address/Renderer/DefaultRenderer.php | 17 +- .../Magento/Customer/Block/Adminhtml/Edit.php | 31 +- .../Block/Adminhtml/Edit/BackButton.php} | 35 +- .../Block/Adminhtml/Edit/DeleteButton.php | 84 + .../Customer/Block/Adminhtml/Edit/Form.php | 25 +- .../Block/Adminhtml/Edit/GenericButton.php | 85 + .../Adminhtml/Edit/InvalidateTokenButton.php | 61 + .../Block/Adminhtml/Edit/OrderButton.php | 80 + .../Edit/Renderer/Attribute/Group.php | 2 +- .../Block/Adminhtml/Edit/ResetButton.php | 46 + .../Adminhtml/Edit/ResetPasswordButton.php | 59 + .../Adminhtml/Edit/SaveAndContinueButton.php | 78 + .../Block/Adminhtml/Edit/SaveButton.php | 77 + .../Block/Adminhtml/Edit/Tab/Account.php | 66 +- .../Block/Adminhtml/Edit/Tab/Addresses.php | 79 +- .../Block/Adminhtml/Edit/Tab/Carts.php | 8 +- .../Adminhtml/Edit/Tab/GenericMetadata.php | 40 +- .../Block/Adminhtml/Edit/Tab/Newsletter.php | 119 +- .../Block/Adminhtml/Edit/Tab/View.php | 33 +- .../Adminhtml/Edit/Tab/View/Accordion.php | 175 - .../Adminhtml/Edit/Tab/View/PersonalInfo.php | 92 +- .../Customer/Block/Adminhtml/Edit/Tabs.php | 177 - .../Customer/Block/Adminhtml/Group/Edit.php | 34 +- .../Block/Adminhtml/Group/Edit/Form.php | 38 +- app/code/Magento/Customer/Block/Form/Edit.php | 22 +- .../Magento/Customer/Block/Form/Register.php | 2 +- .../Magento/Customer/Block/Newsletter.php | 18 +- .../Customer/Block/Widget/AbstractWidget.php | 17 +- .../Magento/Customer/Block/Widget/Dob.php | 12 +- .../Magento/Customer/Block/Widget/Gender.php | 31 +- .../Magento/Customer/Block/Widget/Name.php | 39 +- .../Magento/Customer/Block/Widget/Taxvat.php | 16 +- .../Customer/Controller/Account/Confirm.php | 24 +- .../Controller/Account/Confirmation.php | 14 +- .../Controller/Account/CreatePassword.php | 14 +- .../Controller/Account/CreatePost.php | 67 +- .../Customer/Controller/Account/Edit.php | 22 +- .../Customer/Controller/Account/EditPost.php | 17 +- .../Controller/Account/ForgotPasswordPost.php | 19 +- .../Customer/Controller/Account/LoginPost.php | 14 +- .../Controller/Account/ResetPasswordPost.php | 22 +- .../Magento/Customer/Controller/Address.php | 24 - .../Customer/Controller/Address/Delete.php | 4 +- .../Customer/Controller/Address/FormPost.php | 4 +- .../Customer/Controller/Address/Index.php | 48 +- .../Customer/Controller/Adminhtml/Group.php | 24 +- .../Controller/Adminhtml/Group/Delete.php | 2 +- .../Controller/Adminhtml/Group/NewAction.php | 2 +- .../Controller/Adminhtml/Group/Save.php | 52 +- .../Customer/Controller/Adminhtml/Index.php | 122 +- .../Controller/Adminhtml/Index/Delete.php | 2 +- .../Controller/Adminhtml/Index/Edit.php | 46 +- .../Adminhtml/Index/MassAssignGroup.php | 15 +- .../Controller/Adminhtml/Index/MassDelete.php | 2 +- .../Adminhtml/Index/MassSubscribe.php | 2 +- .../Adminhtml/Index/MassUnsubscribe.php | 2 +- .../Adminhtml/Index/ResetPassword.php | 7 +- .../Controller/Adminhtml/Index/Save.php | 117 +- .../Controller/Adminhtml/Index/Validate.php | 46 +- app/code/Magento/Customer/Helper/Address.php | 22 +- .../Helper/Session/CurrentCustomer.php | 28 +- .../Helper/Session/CurrentCustomerAddress.php | 33 +- app/code/Magento/Customer/Helper/View.php | 13 +- .../Customer/Model/AccountManagement.php | 77 +- app/code/Magento/Customer/Model/Address.php | 51 +- .../Model/Address/AbstractAddress.php | 76 +- .../Customer/Model/Address/Converter.php | 23 +- .../Magento/Customer/Model/Address/Mapper.php | 72 + .../Model/App/Action/ContextPlugin.php | 3 +- .../AttributeMetadataConverter.php | 30 +- .../AttributeMetadataDataProvider.php | 4 +- .../Model/Config/Backend/Address/Street.php | 6 +- .../Password/Link/Expirationperiod.php | 4 +- .../Model/Config/Backend/Show/Customer.php | 8 +- .../Magento/Customer/Model/Config/Share.php | 2 +- .../Customer/Model/Config/Source/Group.php | 14 +- .../Model/Config/Source/Group/Multiselect.php | 14 +- app/code/Magento/Customer/Model/Converter.php | 30 +- app/code/Magento/Customer/Model/Customer.php | 51 +- .../Model/Customer/Attribute/Source/Group.php | 14 +- .../Model/Customer/Mapper.php} | 39 +- .../Customer/Model/CustomerExtractor.php | 24 +- .../Magento/Customer/Model/Data/Address.php | 2 +- .../Magento/Customer/Model/Data/Customer.php | 5 +- .../Customer/Model/Data/CustomerBuilder.php | 251 - app/code/Magento/Customer/Model/Group.php | 8 +- .../Customer/Model/GroupManagement.php | 79 +- .../Magento/Customer/Model/GroupRegistry.php | 4 +- .../Model/Metadata/AddressMetadata.php | 8 +- .../Model/Metadata/CustomerMetadata.php | 8 +- .../Model/Metadata/ElementFactory.php | 4 +- .../Magento/Customer/Model/Metadata/Form.php | 32 +- .../Model/Metadata/Form/AbstractData.php | 8 +- .../Customer/Model/Metadata/Form/File.php | 4 +- .../Customer/Model/Metadata/Form/Postcode.php | 6 +- .../Customer/Model/Metadata/Form/Text.php | 4 +- .../Customer/Model/Metadata/Validator.php | 2 +- app/code/Magento/Customer/Model/Observer.php | 14 +- .../Customer/Model/Resource/Address.php | 10 + .../Model/Resource/AddressRepository.php | 11 +- .../Customer/Grid/ServiceCollection.php | 27 +- .../Model/Resource/CustomerRepository.php | 39 +- .../Magento/Customer/Model/Resource/Group.php | 14 +- .../Resource/Group/Grid/ServiceCollection.php | 29 +- .../Model/Resource/GroupRepository.php | 24 +- app/code/Magento/Customer/Model/Session.php | 32 +- app/code/Magento/Customer/Model/Vat.php | 20 - app/code/Magento/Customer/Model/Visitor.php | 2 +- .../Service/V1/AddressMetadataService.php | 8 +- .../Service/V1/CustomerAccountService.php | 43 +- .../V1/CustomerAccountServiceInterface.php | 16 +- .../Service/V1/CustomerAddressService.php | 2 +- .../Service/V1/CustomerGroupService.php | 18 +- .../Service/V1/CustomerMetadataService.php | 19 +- .../Service/V1/Data/AddressConverter.php | 2 +- .../Service/V1/Data/CustomerDetails.php | 2 +- .../V1/Data/CustomerDetailsBuilder.php | 10 +- app/code/Magento/Customer/composer.json | 37 +- .../Customer/etc/data_source/customer.xml | 80 + .../etc/data_source/customer_address.xml | 105 + .../etc/data_source/customer_group.xml | 15 +- app/code/Magento/Customer/etc/di.xml | 7 +- app/code/Magento/Customer/etc/module.xml | 3 +- app/code/Magento/Customer/etc/webapi.xml | 2 +- .../view/adminhtml/layout/customer_form.xml | 90 + .../adminhtml/layout/customer_index_edit.xml | 18 +- .../view/adminhtml/requirejs-config.js | 35 + .../adminhtml/templates/tab/addresses.phtml | 7 +- .../adminhtml/web/edit/tab/js/addresses.js | 7 +- .../layout/customer_account_confirmation.xml | 2 +- .../layout/customer_account_login.xml | 2 +- .../view/frontend/requirejs-config.js | 35 + .../frontend/templates/account/customer.phtml | 2 +- .../frontend/templates/address/book.phtml | 2 +- .../view/frontend/templates/form/login.phtml | 8 +- .../frontend/templates/form/register.phtml | 2 +- .../frontend/templates/js/components.phtml | 15 - .../view/frontend/templates/newcustomer.phtml | 6 +- .../Customer/view/frontend/web/address.js | 15 +- .../view/frontend/web/js/checkout-balance.js | 8 +- .../view/frontend/web/set-password.js | 5 +- .../CustomerImportExport/composer.json | 16 +- .../CustomerImportExport/etc/module.xml | 2 +- app/code/Magento/DesignEditor/composer.json | 14 +- app/code/Magento/DesignEditor/etc/module.xml | 2 +- .../view/adminhtml/requirejs-config.js | 31 + .../view/adminhtml/web/js/dialog.js | 3 +- .../view/adminhtml/web/js/theme-edit.js | 5 +- .../view/adminhtml/web/js/theme-revert.js | 5 +- app/code/Magento/Dhl/Model/Resource/Setup.php | 2 +- app/code/Magento/Dhl/composer.json | 22 +- app/code/Magento/Dhl/etc/module.xml | 2 +- .../Model/Currency/Import/Webservicex.php | 4 +- app/code/Magento/Directory/Model/Observer.php | 1 - .../Magento/Directory/Model/PriceCurrency.php | 85 +- .../Model/Resource/Region/Collection.php | 8 +- .../Directory/Model/Resource/Setup.php | 2 +- app/code/Magento/Directory/composer.json | 10 +- app/code/Magento/Directory/etc/module.xml | 2 +- .../Block/Catalog/Product/Links.php | 42 +- .../Magento/Downloadable/Helper/Download.php | 23 +- app/code/Magento/Downloadable/Model/Link.php | 4 +- .../Downloadable/Model/Link/Purchased.php | 4 +- .../Model/Link/Purchased/Item.php | 4 +- .../Plugin/Downloadable.php | 13 +- .../Magento/Downloadable/Model/Sample.php | 4 +- .../Downloadable/Pricing/Price/LinkPrice.php | 4 +- app/code/Magento/Downloadable/composer.json | 34 +- ...all-1.6.0.0.php => data-install-2.0.0.php} | 24 +- .../data-upgrade-1.6.0.0.1-1.6.0.0.2.php | 37 - .../data-upgrade-1.6.0.0.2-1.6.0.0.3.php | 31 - app/code/Magento/Downloadable/etc/module.xml | 2 +- .../downloadable_setup/install-1.6.0.0.php | 654 --- .../sql/downloadable_setup/install-2.0.0.php | 728 +++ .../upgrade-1.6.0.0.1-1.6.0.0.2.php | 30 - .../view/adminhtml/requirejs-config.js | 28 + .../templates/product/edit/downloadable.phtml | 2 - .../product/edit/downloadable/links.phtml | 1 - ...catalog_product_view_type_downloadable.xml | 2 +- .../view/frontend/requirejs-config.js} | 16 +- .../templates/catalog/product/links.phtml | 18 +- .../checkout/cart/item/default.phtml | 2 +- .../items/renderer/downloadable.phtml | 2 +- .../view/frontend/web/downloadable.js | 5 +- .../Api/AttributeGroupRepositoryInterface.php | 76 + .../Eav/Api/AttributeManagementInterface.php | 64 + .../AttributeOptionManagementInterface.php | 66 + .../Eav/Api/AttributeRepositoryInterface.php | 75 + .../Api/AttributeSetManagementInterface.php} | 34 +- .../Api/AttributeSetRepositoryInterface.php | 76 + .../Data/AttributeFrontendLabelInterface.php | 42 + .../Api/Data/AttributeGroupDataBuilder.php | 108 + .../Eav/Api/Data/AttributeGroupInterface.php | 55 + .../AttributeGroupSearchResultsInterface.php | 35 + .../Eav/Api/Data/AttributeInterface.php | 181 + .../Eav/Api/Data/AttributeOptionInterface.php | 80 + .../Data/AttributeOptionLabelInterface.php | 46 + .../Data/AttributeSearchResultsInterface.php | 35 + .../Eav/Api/Data/AttributeSetDataBuilder.php | 118 + .../Eav/Api/Data/AttributeSetInterface.php | 55 + .../AttributeSetSearchResultsInterface.php | 35 + .../AttributeValidationRuleInterface.php} | 6 +- app/code/Magento/Eav/Model/Attribute.php | 5 +- .../Eav/Model/Attribute/GroupRepository.php | 196 + .../Magento/Eav/Model/AttributeManagement.php | 176 + .../Magento/Eav/Model/AttributeRepository.php | 218 + .../Eav/Model/AttributeSetManagement.php | 83 + .../Eav/Model/AttributeSetRepository.php | 177 + app/code/Magento/Eav/Model/Config.php | 1 + .../Eav/Model/Entity/AbstractEntity.php | 86 +- .../Magento/Eav/Model/Entity/Attribute.php | 20 +- .../Entity/Attribute/AbstractAttribute.php | 142 +- .../Model/Entity/Attribute/FrontendLabel.php | 45 + .../Eav/Model/Entity/Attribute/Group.php | 33 +- .../Eav/Model/Entity/Attribute/Option.php | 46 +- .../Model/Entity/Attribute/OptionLabel.php} | 29 +- .../Entity/Attribute/OptionManagement.php | 148 + .../Eav/Model/Entity/Attribute/Set.php | 52 +- .../Model/Entity/Attribute/ValidationRule.php | 45 + app/code/Magento/Eav/Model/Entity/Setup.php | 2 +- .../Eav/Model/Entity/Setup/Context.php | 12 +- app/code/Magento/Eav/Model/Form/Element.php | 4 +- app/code/Magento/Eav/Model/Form/Fieldset.php | 4 +- .../Model/Resource/Attribute/Collection.php | 10 +- .../Eav/Model/Resource/Entity/Attribute.php | 23 +- .../Resource/Entity/Attribute/Collection.php | 51 + .../Model/Resource/Entity/Attribute/Set.php | 32 +- app/code/Magento/Eav/composer.json | 12 +- .../data-upgrade-1.6.0.1-1.6.0.2.php | 35 - ...0.0-1.6.0.1.php => data-upgrade-2.0.0.php} | 29 +- app/code/Magento/Eav/etc/di.xml | 16 + app/code/Magento/Eav/etc/module.xml | 2 +- app/code/Magento/Eav/etc/webapi.xml | 58 + ...{install-1.6.0.0.php => install-2.0.0.php} | 12 + app/code/Magento/Email/Model/Template.php | 4 +- app/code/Magento/Email/composer.json | 12 +- app/code/Magento/Email/etc/module.xml | 2 +- app/code/Magento/Fedex/composer.json | 18 +- .../data/fedex_setup/data-install-2.0.0.php | 4 +- app/code/Magento/Fedex/etc/module.xml | 2 +- .../GiftMessage/Service/V1/WriteService.php | 12 +- app/code/Magento/GiftMessage/composer.json | 22 +- ...all-1.6.0.0.php => data-install-2.0.0.php} | 14 + .../data-upgrade-1.6.0.0-1.6.0.1.php | 38 - app/code/Magento/GiftMessage/etc/module.xml | 2 +- ...{install-1.6.0.0.php => install-2.0.0.php} | 0 .../view/frontend/requirejs-config.js} | 14 +- .../view/frontend/web/extra-options.js | 3 +- .../view/frontend/web/gift-options.js | 3 +- app/code/Magento/GoogleAdwords/composer.json | 8 +- app/code/Magento/GoogleAdwords/etc/module.xml | 2 +- .../Magento/GoogleAnalytics/composer.json | 8 +- .../Magento/GoogleAnalytics/etc/module.xml | 2 +- .../Magento/GoogleOptimizer/composer.json | 14 +- .../Magento/GoogleOptimizer/etc/module.xml | 2 +- .../googleoptimizer_setup/install-2.0.0.0.php | 87 - .../googleoptimizer_setup/install-2.0.0.php | 91 + .../GoogleShopping/Model/Attribute/Tax.php | 52 +- .../GoogleShopping/Model/Resource/Setup.php | 2 +- app/code/Magento/GoogleShopping/composer.json | 20 +- ...all-1.6.0.0.php => data-install-2.0.0.php} | 8 +- .../Magento/GoogleShopping/etc/module.xml | 2 +- .../googleshopping_setup/install-1.6.0.0.php | 184 - .../googleshopping_setup/install-2.0.0.php | 202 + .../upgrade-1.6.0.0-1.6.0.0.1.php | 32 - .../Magento/GroupedImportExport/composer.json | 14 +- .../GroupedImportExport/etc/module.xml | 2 +- .../Product/Composite/Fieldset/Grouped.php | 11 - .../Link}/CollectionProvider/Grouped.php | 6 +- .../Product/Link}/ProductEntity/Converter.php | 16 +- .../Model/Product/Type/Grouped.php | 2 +- .../Grouped/AssociatedProductsCollection.php | 3 + app/code/Magento/GroupedProduct/composer.json | 24 +- ...stall-0.0.1.php => data-install-2.0.0.php} | 34 +- .../GroupedProduct/etc/data_object.xml | 6 +- app/code/Magento/GroupedProduct/etc/di.xml | 22 +- .../Magento/GroupedProduct/etc/module.xml | 2 +- .../view/adminhtml/requirejs-config.js | 30 + .../view/adminhtml/web/js/grouped-product.js | 3 + .../templates/product/view/type/grouped.phtml | 2 +- app/code/Magento/ImportExport/composer.json | 14 +- app/code/Magento/ImportExport/etc/module.xml | 2 +- ...{install-1.6.0.0.php => install-2.0.0.php} | 62 +- .../upgrade-1.6.0.1-1.6.0.2.php | 32 - .../upgrade-1.6.0.2-1.6.0.3.php | 36 - .../upgrade-1.6.0.3-1.6.0.4.php | 28 - .../Magento/Indexer/Model/Indexer/State.php | 4 +- .../Indexer/Model/Mview/View/State.php | 4 +- app/code/Magento/Indexer/composer.json | 8 +- app/code/Magento/Indexer/etc/module.xml | 2 +- ...{install-1.0.0.0.php => install-2.0.0.php} | 122 +- .../Magento/Integration/Model/Integration.php | 4 +- .../Integration/Model/Oauth/Consumer.php | 4 +- .../Magento/Integration/Model/Oauth/Nonce.php | 4 +- .../Magento/Integration/Model/Oauth/Token.php | 8 +- .../Integration/Model/Resource/Setup.php | 2 +- .../Service/V1/CustomerTokenService.php | 14 +- app/code/Magento/Integration/composer.json | 16 +- app/code/Magento/Integration/etc/module.xml | 2 +- .../view/adminhtml/requirejs-config.js | 30 + .../view/adminhtml/web/js/integration.js | 19 +- .../LayeredNavigation/Block/Navigation.php | 6 +- .../Block/Navigation/State.php | 8 +- .../Magento/LayeredNavigation/composer.json | 8 +- .../LayeredNavigation/etc/frontend/di.xml | 22 +- .../Magento/LayeredNavigation/etc/module.xml | 2 +- .../catalog_category_view_type_layered.xml | 2 +- .../layout/catalogsearch_advanced_result.xml | 2 +- .../layout/catalogsearch_result_index.xml | 2 +- .../Customer/Edit/Tab/View/Status.php | 10 +- .../Resource/Visitor/Online/Collection.php | 4 +- app/code/Magento/Log/Model/Visitor.php | 6 +- app/code/Magento/Log/composer.json | 14 +- .../data/log_setup/data-install-1.6.0.0.php | 2 +- app/code/Magento/Log/etc/module.xml | 2 +- ...tomer_index_edit.xml => customer_form.xml} | 0 app/code/Magento/Msrp/Helper/Data.php | 13 +- .../Magento/Msrp/Pricing/Price/MsrpPrice.php | 4 +- app/code/Magento/Msrp/composer.json | 24 +- ...all-1.0.0.0.php => data-install-2.0.0.php} | 8 +- app/code/Magento/Msrp/etc/module.xml | 2 +- .../base/templates/product/price/msrp.phtml | 6 +- .../Magento/Msrp/view/base/web/js/msrp.js | 10 +- .../Msrp/view/frontend/requirejs-config.js | 30 + .../Model/Checkout/Type/Multishipping.php | 2 +- .../Checkout/Type/Multishipping/Plugin.php | 42 +- app/code/Magento/Multishipping/composer.json | 20 +- .../Magento/Multishipping/etc/frontend/di.xml | 3 + app/code/Magento/Multishipping/etc/module.xml | 2 +- .../view/frontend/requirejs-config.js | 30 + .../templates/checkout/addresses.phtml | 2 +- .../templates/checkout/overview.phtml | 4 +- .../view/frontend/web/js/multi-shipping.js | 3 +- .../Controller/Adminhtml/Problem/Grid.php | 2 +- .../Controller/Adminhtml/Problem/Index.php | 2 +- .../Magento/Newsletter/Controller/Manage.php | 6 +- .../Model/Plugin/CustomerPlugin.php | 8 +- .../Newsletter/Model/Resource/Subscriber.php | 4 +- .../Model/Resource/Subscriber/Collection.php | 4 +- .../Magento/Newsletter/Model/Subscriber.php | 2 +- .../Magento/Newsletter/Model/Template.php | 4 +- app/code/Magento/Newsletter/composer.json | 22 +- .../data-upgrade-1.6.0.0-1.6.0.1.php | 40 - .../data-upgrade-1.6.0.1-1.6.0.2.php | 53 - app/code/Magento/Newsletter/etc/module.xml | 2 +- .../sql/newsletter_setup/install-1.6.0.0.php | 431 -- .../sql/newsletter_setup/install-2.0.0.php | 478 ++ .../view/adminhtml/layout/customer_form.xml | 32 + .../layout/newsletter_queue_preview_popup.xml | 1 - .../newsletter_template_preview_popup.xml | 1 - .../view/frontend/requirejs-config.js | 30 + .../view/frontend/web/newsletter.js | 5 +- .../Magento/OfflinePayments/composer.json | 6 +- .../Magento/OfflinePayments/etc/module.xml | 2 +- .../Model/Config/Backend/Tablerate.php | 2 +- .../Magento/OfflineShipping/composer.json | 20 +- .../Magento/OfflineShipping/etc/module.xml | 2 +- app/code/Magento/Ogone/composer.json | 12 +- .../data/ogone_setup/data-install-2.0.0.php | 2 +- app/code/Magento/Ogone/etc/module.xml | 2 +- .../Model/System/Config/Backend/Ttl.php | 2 +- .../Model/System/Config/Backend/Varnish.php | 2 +- app/code/Magento/PageCache/composer.json | 8 +- app/code/Magento/PageCache/etc/module.xml | 2 +- .../view/frontend/requirejs-config.js | 35 + .../view/frontend/web/js/form-key.js | 4 +- .../view/frontend/web/js/page-cache.js | 2 + .../PayPalRecurringPayment/composer.json | 16 +- .../PayPalRecurringPayment/etc/module.xml | 2 +- app/code/Magento/Payment/Model/Info.php | 8 +- app/code/Magento/Payment/Model/Method/Cc.php | 2 +- app/code/Magento/Payment/composer.json | 14 +- app/code/Magento/Payment/etc/module.xml | 2 +- .../Payment/view/frontend/requirejs-config.js | 30 + .../view/frontend/templates/form/cc.phtml | 4 +- .../Payment/view/frontend/web/cc-type.js | 1 + .../Adminhtml/Customer/Edit/Tab/Agreement.php | 34 +- app/code/Magento/Paypal/Model/Api/Nvp.php | 2 +- .../Model/Billing/AbstractAgreement.php | 4 +- .../Paypal/Model/Billing/Agreement.php | 8 +- app/code/Magento/Paypal/Model/Cert.php | 2 +- .../Magento/Paypal/Model/Express/Checkout.php | 8 +- .../Paypal/Model/Report/Settlement.php | 4 +- .../Resource/Billing/Agreement/Collection.php | 4 +- .../Model/System/Config/Backend/Cert.php | 4 +- .../Model/System/Config/Backend/Cron.php | 4 +- app/code/Magento/Paypal/composer.json | 31 +- app/code/Magento/Paypal/etc/module.xml | 3 +- .../view/adminhtml/layout/customer_form.xml | 32 + .../Paypal/view/frontend/requirejs-config.js | 31 + .../frontend/templates/partner/logo.phtml | 16 +- .../templates/payflowadvanced/info.phtml | 6 +- .../frontend/templates/payment/redirect.phtml | 6 +- .../Paypal/view/frontend/web/js/opcheckout.js | 10 +- .../Paypal/view/frontend/web/order-review.js | 3 +- .../Persistent/Model/Observer/Session.php | 2 +- .../Persistent/Model/Resource/Session.php | 9 + app/code/Magento/Persistent/Model/Session.php | 19 +- app/code/Magento/Persistent/composer.json | 16 +- app/code/Magento/Persistent/etc/module.xml | 2 +- ...{install-1.0.0.0.php => install-2.0.0.php} | 0 app/code/Magento/ProductAlert/Model/Email.php | 16 +- .../Magento/ProductAlert/Model/Observer.php | 14 +- app/code/Magento/ProductAlert/composer.json | 12 +- app/code/Magento/ProductAlert/etc/module.xml | 2 +- .../Customer/Edit/Tab/RecurringPayment.php | 32 +- .../RecurringPayment/Block/Payment/Grid.php | 2 + .../Block/Payment/Related/Orders/Grid.php | 2 + .../Block/Payment/View/Address.php | 2 + .../Block/Payment/View/Data.php | 2 + .../Block/Payment/View/Fees.php | 2 + .../Block/Payment/View/Item.php | 2 + .../Block/Payment/View/Reference.php | 2 + .../Block/Payment/View/Schedule.php | 2 + .../Model/RecurringPayment.php | 2 +- .../Magento/RecurringPayment/composer.json | 27 +- .../Magento/RecurringPayment/etc/module.xml | 3 +- .../view/adminhtml/layout/customer_form.xml | 32 + .../product/view/payment/options.phtml | 10 +- .../Reports/Controller/Adminhtml/Index.php | 9 +- app/code/Magento/Reports/Model/Event.php | 4 +- .../Model/Product/Index/AbstractIndex.php | 4 +- .../Model/Resource/Product/Collection.php | 3 + .../Index/Collection/AbstractCollection.php | 3 + .../Resource/Product/Lowstock/Collection.php | 3 + .../Magento/Reports/Model/Resource/Setup.php | 2 +- app/code/Magento/Reports/composer.json | 36 +- ...all-1.6.0.0.php => data-install-2.0.0.php} | 31 +- .../Magento/Reports/etc/adminhtml/menu.xml | 2 +- app/code/Magento/Reports/etc/module.xml | 2 +- .../sql/reports_setup/install-1.6.0.0.php | 508 -- .../sql/reports_setup/install-2.0.0.php | 873 ++++ .../upgrade-1.6.0.0-1.6.0.0.1.php | 128 - .../upgrade-1.6.0.0.1-1.6.0.0.2.php | 44 - .../view/adminhtml/templates/grid.phtml | 2 +- .../Reports/view/frontend/requirejs-config.js | 30 + .../view/frontend/web/js/recently-viewed.js | 3 +- app/code/Magento/RequireJs/README.md | 12 + app/code/Magento/RequireJs/composer.json | 4 +- app/code/Magento/RequireJs/etc/module.xml | 2 +- .../Review/Block/Adminhtml/Edit/Form.php | 12 +- .../Magento/Review/Block/Adminhtml/Main.php | 25 +- .../Review/Block/Adminhtml/ReviewTab.php | 90 + .../Review/Block/Customer/ListCustomer.php | 16 +- .../Magento/Review/Block/Product/View.php | 6 +- .../Resource/Review/Product/Collection.php | 3 + app/code/Magento/Review/Model/Review.php | 14 +- app/code/Magento/Review/composer.json | 23 +- ...all-1.6.0.0.php => data-install-2.0.0.php} | 38 +- app/code/Magento/Review/etc/module.xml | 3 +- .../sql/review_setup/install-1.6.0.0.php | 713 --- .../Review/sql/review_setup/install-2.0.0.php | 773 +++ .../view/adminhtml/layout/customer_form.xml | 32 + .../Review/view/adminhtml/requirejs-config.js | 28 + .../adminhtml/templates/rating/detailed.phtml | 2 - .../frontend/templates/customer/list.phtml | 2 +- .../Review/view/frontend/templates/form.phtml | 4 +- .../Rss/Model/System/Config/Backend/Links.php | 2 +- app/code/Magento/Rss/composer.json | 10 +- app/code/Magento/Rss/etc/module.xml | 2 +- app/code/Magento/Rule/Model/AbstractModel.php | 4 +- .../Model/Condition/AbstractCondition.php | 2 +- .../Condition/Product/AbstractProduct.php | 17 +- app/code/Magento/Rule/composer.json | 12 +- app/code/Magento/Rule/etc/module.xml | 2 +- .../Magento/Rule/view/adminhtml/web/rules.js | 567 ++- .../CreditmemoCommentRepositoryInterface.php | 60 + .../Api/CreditmemoItemRepositoryInterface.php | 60 + .../CreditmemoManagementInterface.php} | 29 +- .../Api/CreditmemoRepositoryInterface.php | 60 + .../Data/CreditmemoCommentInterface.php} | 41 +- ...CreditmemoCommentSearchResultInterface.php | 37 + .../Data/CreditmemoInterface.php} | 270 +- .../Data/CreditmemoItemInterface.php} | 305 +- .../CreditmemoItemSearchResultInterface.php | 37 + .../Data/CreditmemoSearchResultInterface.php | 37 + .../Api/Data/InvoiceCommentInterface.php | 82 + .../InvoiceCommentSearchResultInterface.php | 38 + .../Data/InvoiceInterface.php} | 246 +- .../Data/InvoiceItemInterface.php} | 131 +- .../Data/InvoiceItemSearchResultInterface.php | 38 + .../Api/Data/InvoiceSearchResultInterface.php | 38 + .../Data/OrderAddressInterface.php} | 142 +- .../OrderAddressSearchResultInterface.php | 38 + .../Order.php => Api/Data/OrderInterface.php} | 722 +-- .../Data/OrderItemInterface.php} | 583 +-- .../Data/OrderItemSearchResultInterface.php | 38 + .../Data/OrderPaymentInterface.php} | 281 +- .../OrderPaymentSearchResultInterface.php | 38 + .../Api/Data/OrderSearchResultInterface.php | 38 + .../Data/OrderStatusHistoryInterface.php} | 51 +- ...rderStatusHistorySearchResultInterface.php | 38 + .../Api/Data/ShipmentCommentInterface.php | 82 + .../ShipmentCommentSearchResultInterface.php | 37 + .../Data/ShipmentInterface.php} | 110 +- .../Data/ShipmentItemInterface.php} | 71 +- .../ShipmentItemSearchResultInterface.php | 38 + .../Api/Data/ShipmentPackageInterface.php | 32 + .../Data/ShipmentSearchResultInterface.php | 40 + .../Data/ShipmentTrackInterface.php} | 67 +- .../ShipmentTrackSearchResultInterface.php | 37 + .../Data/TransactionInterface.php} | 92 +- .../Data/TransactionSearchResultInterface.php | 38 + .../InvoiceCommentRepositoryInterface.php} | 47 +- .../Api/InvoiceItemRepositoryInterface.php | 60 + .../InvoiceManagementInterface.php} | 40 +- .../InvoiceRepositoryInterface.php} | 41 +- .../Api/OrderAddressRepositoryInterface.php | 60 + .../Api/OrderItemRepositoryInterface.php | 60 + .../OrderManagementInterface.php} | 52 +- .../Api/OrderPaymentRepositoryInterface.php | 60 + .../OrderRepositoryInterface.php} | 47 +- .../OrderStatusHistoryRepositoryInterface.php | 60 + .../ShipmentCommentRepositoryInterface.php} | 47 +- .../Api/ShipmentItemRepositoryInterface.php | 61 + .../Sales/Api/ShipmentManagementInterface.php | 53 + .../Sales/Api/ShipmentRepositoryInterface.php | 61 + .../ShipmentTrackRepositoryInterface.php} | 43 +- .../Api/TransactionRepositoryInterface.php | 60 + .../Block/Adminhtml/CustomerOrdersTab.php | 90 + .../Block/Adminhtml/Order/Address/Form.php | 3 + .../Order/Create/Form/AbstractForm.php | 16 +- .../Adminhtml/Order/Create/Form/Account.php | 23 +- .../Adminhtml/Order/Create/Form/Address.php | 12 +- app/code/Magento/Sales/Block/Guest/Link.php | 2 + app/code/Magento/Sales/Block/Order/Link.php | 2 + .../Magento/Sales/Model/AbstractModel.php | 8 +- .../Magento/Sales/Model/AdminOrder/Create.php | 26 +- .../Model/Observer/Backend/CustomerQuote.php | 2 +- .../Frontend/Quote/Address/CollectTotals.php | 22 +- app/code/Magento/Sales/Model/Order.php | 1683 +++++- .../Magento/Sales/Model/Order/Address.php | 289 +- .../Magento/Sales/Model/Order/Creditmemo.php | 657 ++- .../Sales/Model/Order/Creditmemo/Comment.php | 76 +- .../Sales/Model/Order/Creditmemo/Item.php | 363 +- .../Magento/Sales/Model/Order/Invoice.php | 592 ++- .../Sales/Model/Order/Invoice/Comment.php | 75 +- .../Sales/Model/Order/Invoice/Item.php | 265 +- app/code/Magento/Sales/Model/Order/Item.php | 1047 +++- .../Magento/Sales/Model/Order/Payment.php | 669 ++- .../Sales/Model/Order/Payment/Transaction.php | 156 +- .../Magento/Sales/Model/Order/Shipment.php | 288 +- .../Sales/Model/Order/Shipment/Comment.php | 75 +- .../Sales/Model/Order/Shipment/Item.php | 133 +- .../Sales/Model/Order/Shipment/Track.php | 145 +- .../Sales/Model/Order/Status/History.php | 113 +- .../Magento/Sales/Model/OrderConverter.php | 171 - app/code/Magento/Sales/Model/Quote.php | 49 +- .../Magento/Sales/Model/Quote/Address.php | 11 +- .../Sales/Model/Quote/Address/Item.php | 4 +- .../Sales/Model/Quote/Address/Rate.php | 4 +- app/code/Magento/Sales/Model/Quote/Item.php | 37 +- .../Sales/Model/Quote/Item/AbstractItem.php | 27 +- .../Magento/Sales/Model/Quote/Item/Option.php | 4 +- .../Magento/Sales/Model/Quote/Payment.php | 24 +- .../Collection/AbstractCollection.php | 20 + .../Magento/Sales/Model/Resource/Order.php | 34 +- .../Sales/Model/Resource/Order/Address.php | 17 +- .../Sales/Model/Resource/Order/Collection.php | 25 +- .../Sales/Model/Resource/Order/Creditmemo.php | 44 +- .../Resource/Order/Creditmemo/Collection.php | 5 +- .../Resource/Order/Creditmemo/Comment.php | 11 +- .../Order/Creditmemo/Comment/Collection.php | 5 +- .../Model/Resource/Order/Creditmemo/Item.php | 18 +- .../Model/Resource/Order/Handler/Address.php | 6 +- .../Sales/Model/Resource/Order/Invoice.php | 48 +- .../Resource/Order/Invoice/Collection.php | 5 +- .../Model/Resource/Order/Invoice/Comment.php | 13 +- .../Order/Invoice/Comment/Collection.php | 5 +- .../Model/Resource/Order/Invoice/Item.php | 31 + .../Sales/Model/Resource/Order/Item.php | 26 + .../Sales/Model/Resource/Order/Payment.php | 16 + .../Resource/Order/Payment/Collection.php | 5 +- .../Resource/Order/Payment/Transaction.php | 25 +- .../Order/Payment/Transaction/Collection.php | 5 +- .../Order}/Plugin/Authorization.php | 25 +- .../Sales/Model/Resource/Order/Shipment.php | 56 +- .../Resource/Order/Shipment/Collection.php | 5 +- .../Model/Resource/Order/Shipment/Comment.php | 10 +- .../Order/Shipment/Comment/Collection.php | 5 +- .../Model/Resource/Order/Shipment/Item.php | 21 +- .../Model/Resource/Order/Shipment/Track.php | 10 +- .../Order/Shipment/Track/Collection.php | 5 +- .../Model/Resource/Order/Status/History.php | 4 +- .../Order/Status/History/Collection.php | 6 +- .../Magento/Sales/Model/Resource/Quote.php | 10 + .../Sales/Model/Resource/Quote/Item.php | 16 + .../Sales/Model/Service/CreditmemoService.php | 113 + .../Sales/Model/Service/InvoiceService.php | 138 + .../Sales/Model/Service/OrderService.php | 166 + .../Sales/Model/Service/ShipmentService.php | 127 + .../CreditmemoCommentResourceInterface.php | 56 + .../Spi/CreditmemoItemResourceInterface.php | 56 + .../Spi/CreditmemoResourceInterface.php} | 41 +- .../Spi/InvoiceCommentResourceInterface.php | 56 + .../Spi/InvoiceItemResourceInterface.php | 56 + .../Model/Spi/InvoiceResourceInterface.php | 56 + .../Spi/OrderAddressResourceInterface.php | 56 + .../Model/Spi/OrderItemResourceInterface.php | 56 + .../Spi/OrderPaymentResourceInterface.php | 56 + .../Model/Spi/OrderResourceInterface.php | 56 + .../OrderStatusHistoryResourceInterface.php | 56 + .../Spi/ShipmentCommentResourceInterface.php | 56 + .../Spi/ShipmentItemResourceInterface.php | 56 + .../Model/Spi/ShipmentResourceInterface.php | 56 + .../Spi/ShipmentTrackResourceInterface.php | 56 + .../Spi/TransactionResourceInterface.php | 56 + .../V1/Action/CreditmemoAddComment.php | 62 - .../V1/Action/CreditmemoCommentsList.php | 104 - .../Service/V1/Action/CreditmemoCreate.php | 77 - .../Service/V1/Action/CreditmemoEmail.php | 67 - .../Sales/Service/V1/Action/CreditmemoGet.php | 67 - .../Service/V1/Action/CreditmemoList.php | 84 - .../Service/V1/Action/InvoiceAddComment.php | 62 - .../Service/V1/Action/InvoiceCommentsList.php | 104 - .../Sales/Service/V1/Action/InvoiceCreate.php | 75 - .../Sales/Service/V1/Action/InvoiceGet.php | 67 - .../Sales/Service/V1/Action/InvoiceList.php | 83 - .../Service/V1/Action/OrderCommentsList.php | 104 - .../Sales/Service/V1/Action/OrderCreate.php | 71 - .../Sales/Service/V1/Action/OrderList.php | 83 - .../V1/Action/OrderStatusHistoryAdd.php | 72 - .../Service/V1/Action/ShipmentAddTrack.php | 62 - .../V1/Action/ShipmentCommentsList.php | 104 - .../Service/V1/Action/ShipmentCreate.php | 78 - .../Sales/Service/V1/Action/ShipmentGet.php | 67 - .../Sales/Service/V1/Action/ShipmentList.php | 83 - .../Service/V1/Action/ShipmentRemoveTrack.php | 61 - .../Sales/Service/V1/CreditmemoRead.php | 93 - .../Sales/Service/V1/CreditmemoWrite.php | 114 - .../Service/V1/Data/CreditmemoConverter.php | 69 - .../Service/V1/Data/CreditmemoMapper.php | 78 - .../Service/V1/Data/InvoiceConverter.php | 63 - .../Sales/Service/V1/Data/InvoiceMapper.php | 76 - .../Sales/Service/V1/Data/OrderMapper.php | 142 - .../Service/V1/Data/ShipmentConverter.php | 66 - .../Sales/Service/V1/Data/ShipmentMapper.php | 89 - .../Service/V1/Data/TransactionBuilder.php | 135 - .../Service/V1/Data/TransactionMapper.php | 137 - .../Magento/Sales/Service/V1/InvoiceRead.php | 98 - .../Magento/Sales/Service/V1/InvoiceWrite.php | 132 - .../Magento/Sales/Service/V1/OrderRead.php | 112 - .../Magento/Sales/Service/V1/OrderWrite.php | 173 - .../Magento/Sales/Service/V1/ShipmentRead.php | 112 - .../Sales/Service/V1/ShipmentWrite.php | 133 - .../Sales/Service/V1/TransactionRead.php | 85 - app/code/Magento/Sales/composer.json | 45 +- app/code/Magento/Sales/etc/di.xml | 77 +- app/code/Magento/Sales/etc/module.xml | 3 +- app/code/Magento/Sales/etc/webapi.xml | 82 +- app/code/Magento/Sales/etc/webapi_rest/di.xml | 4 +- app/code/Magento/Sales/etc/webapi_soap/di.xml | 4 +- .../view/adminhtml/layout/customer_form.xml | 32 + .../Sales/view/adminhtml/requirejs-config.js | 30 + .../templates/order/create/items/grid.phtml | 2 +- .../order/create/items/price/total.phtml | 2 +- .../order/create/shipping/method/form.phtml | 3 + .../adminhtml/web/order/create/scripts.js | 46 +- .../view/adminhtml/web/order/edit/message.js | 3 +- .../Sales/view/frontend/requirejs-config.js | 31 + .../creditmemo/items/renderer/default.phtml | 2 +- .../frontend/templates/order/totals.phtml | 6 +- .../Sales/view/frontend/web/gift-message.js | 6 +- .../Sales/view/frontend/web/orders-returns.js | 1 + .../SalesRule/Model/Quote/Discount.php | 72 +- app/code/Magento/SalesRule/Model/Rule.php | 4 +- app/code/Magento/SalesRule/composer.json | 34 +- .../salesrule_setup/data-install-2.0.0.php | 2 +- app/code/Magento/SalesRule/etc/module.xml | 2 +- .../templates/promo/salesrulejs.phtml | 18 +- .../Block/Adminhtml/Reports}/Search.php | 5 +- .../Search/Block/Adminhtml/Term/Edit.php | 3 +- .../Adminhtml/Term}/ExportSearchCsv.php | 6 +- .../Adminhtml/Term}/ExportSearchExcel.php | 6 +- .../Controller/Adminhtml/Term/Report.php | 68 + .../Controller/Term/Index.php} | 4 +- app/code/Magento/Search/Helper/Data.php | 44 +- app/code/Magento/Search/Model/Query.php | 16 - app/code/Magento/Search/composer.json | 9 +- .../Magento/Search/etc/adminhtml/menu.xml | 18 +- app/code/Magento/Search/etc/module.xml | 3 +- .../sql/search_setup/install-1.6.0.0.php | 122 - .../Search/sql/search_setup/install-2.0.0.php | 135 + .../adminhtml/layout/search_term_block.xml} | 2 +- .../layout/search_term_exportsearchcsv.xml} | 0 .../layout/search_term_exportsearchexcel.xml} | 0 .../adminhtml/layout/search_term_report.xml} | 2 +- .../layout/search_term_report_block.xml | 115 + .../Search/view/frontend/requirejs-config.js | 30 + .../view/frontend/templates/term.phtml | 0 .../Search/view/frontend/web/form-mini.js | 3 +- app/code/Magento/Sendfriend/composer.json | 14 +- app/code/Magento/Sendfriend/etc/module.xml | 2 +- .../Magento/Shipping/Model/Order/Track.php | 3 + .../Shipping/Model/Shipping/Labels.php | 6 +- app/code/Magento/Shipping/composer.json | 26 +- app/code/Magento/Shipping/etc/module.xml | 2 +- .../Sitemap/Model/Config/Backend/Priority.php | 2 +- app/code/Magento/Sitemap/Model/Sitemap.php | 4 +- app/code/Magento/Sitemap/composer.json | 18 +- app/code/Magento/Sitemap/etc/module.xml | 2 +- app/code/Magento/Store/Model/Group.php | 4 +- app/code/Magento/Store/Model/Store.php | 8 +- app/code/Magento/Store/Model/Website.php | 8 +- .../Ui/DataProvider/Options.php} | 8 +- .../Ui/DataProvider/Row.php} | 6 +- app/code/Magento/Store/Ui/DataType/Store.php | 2 +- app/code/Magento/Store/composer.json | 10 +- .../etc/data_source/website.xml} | 13 +- app/code/Magento/Store/etc/module.xml | 2 +- .../Store/view/base/layout/ui_components.xml | 4 +- .../Store/view/base/requirejs-config.js | 2 +- .../filter/{store.html => filter_store.html} | 4 +- .../base/web/templates/filter/store/item.html | 2 +- .../frontend/templates/switch/stores.phtml | 2 +- .../Data/AppliedTaxInterface.php} | 26 +- .../Data/AppliedTaxRateInterface.php} | 19 +- .../OrderTaxDetailsAppliedTaxInterface.php} | 31 +- .../Data/OrderTaxDetailsInterface.php} | 24 +- .../Data/OrderTaxDetailsItemInterface.php} | 27 +- .../Data/QuoteDetailsInterface.php} | 38 +- .../Data/QuoteDetailsItemInterface.php} | 61 +- .../Tax/Api/Data/TaxClassDataBuilder.php | 106 + .../Data/TaxClassInterface.php} | 23 +- .../Data/TaxClassKeyInterface.php} | 19 +- .../Data/TaxClassSearchResultsInterface.php | 35 + .../Data/TaxDetailsInterface.php} | 33 +- .../Data/TaxDetailsItemInterface.php} | 71 +- .../Tax/Api/Data/TaxRateDataBuilder.php | 184 + .../Data/TaxRateInterface.php} | 84 +- .../Data/TaxRateSearchResultsInterface.php | 38 + .../Tax/Api/Data/TaxRateTitleDataBuilder.php | 96 + .../Data/TaxRateTitleInterface.php} | 18 +- .../Tax/Api/Data/TaxRuleDataBuilder.php | 156 + .../Magento/Tax/Api/Data/TaxRuleInterface.php | 86 + .../Data/TaxRuleSearchResultsInterface.php | 35 + .../OrderTaxManagementInterface.php} | 7 +- .../TaxCalculationInterface.php} | 10 +- .../Tax/Api/TaxClassManagementInterface.php | 45 + .../TaxClassRepositoryInterface.php} | 73 +- .../Tax/Api/TaxRateManagementInterface.php | 39 + .../TaxRateRepositoryInterface.php} | 46 +- .../TaxRuleRepositoryInterface.php} | 51 +- .../Magento/Tax/Block/Adminhtml/Rate/Form.php | 35 +- .../Tax/Block/Adminhtml/Rate/Title.php | 12 +- .../Tax/Block/Adminhtml/Rule/Edit/Form.php | 96 +- .../Magento/Tax/Controller/Adminhtml/Rate.php | 47 +- .../Controller/Adminhtml/Rate/AjaxDelete.php | 2 +- .../Controller/Adminhtml/Rate/AjaxSave.php | 9 +- .../Tax/Controller/Adminhtml/Rate/Delete.php | 2 +- .../Tax/Controller/Adminhtml/Rate/Edit.php | 2 +- .../Tax/Controller/Adminhtml/Rate/Save.php | 8 +- .../Magento/Tax/Controller/Adminhtml/Rule.php | 16 +- .../Tax/Controller/Adminhtml/Rule/Delete.php | 2 +- .../Tax/Controller/Adminhtml/Rule/Edit.php | 2 +- .../Tax/Controller/Adminhtml/Rule/Save.php | 6 +- .../Magento/Tax/Controller/Adminhtml/Tax.php | 20 +- .../Controller/Adminhtml/Tax/AjaxDelete.php | 2 +- .../Tax/Controller/Adminhtml/Tax/AjaxSave.php | 9 +- .../Adminhtml/Tax/IgnoreTaxNotification.php | 27 +- app/code/Magento/Tax/Helper/Data.php | 50 +- app/code/Magento/Tax/Model/Calculation.php | 10 +- .../AbstractAggregateCalculator.php | 13 +- .../Model/Calculation/AbstractCalculator.php | 82 +- .../Magento/Tax/Model/Calculation/Rate.php | 135 +- .../Tax/Model/Calculation/Rate/Converter.php | 156 +- .../Tax/Model/Calculation/Rate/Title.php | 21 +- .../Calculation/RateRepository.php} | 156 +- .../Model/Calculation/RowBaseCalculator.php | 2 - .../Magento/Tax/Model/Calculation/Rule.php | 141 +- .../Tax/Model/Calculation/Rule/Validator.php | 168 + .../Model/Calculation/TaxRuleConverter.php | 132 - .../Model/Calculation/TotalBaseCalculator.php | 2 - .../Model/Calculation/UnitBaseCalculator.php | 13 +- app/code/Magento/Tax/Model/ClassModel.php | 42 +- .../Magento/Tax/Model/ClassModelRegistry.php | 4 +- .../Magento/Tax/Model/Config/Notification.php | 4 +- .../Tax/Model/Config/Price/IncludePrice.php | 4 +- .../Magento/Tax/Model/Config/TaxClass.php | 85 + app/code/Magento/Tax/Model/Converter.php | 10 +- app/code/Magento/Tax/Model/Rate/Source.php | 16 +- .../Magento/Tax/Model/Sales/Order/Details.php | 49 + .../Magento/Tax/Model/Sales/Order/Tax.php | 49 +- .../Tax/Model/Sales/Order/Tax/Item.php | 41 +- .../Sales/Order/TaxManagement.php} | 70 +- .../Tax/Model/Sales/Quote/ItemDetails.php | 122 + .../Tax/Model/Sales/Quote/QuoteDetails.php | 81 + .../Sales/Total/Quote/CommonTaxCollector.php | 153 +- .../Tax/Model/Sales/Total/Quote/Subtotal.php | 1 - .../Tax/Model/Sales/Total/Quote/Tax.php | 49 +- .../TaxCalculation.php} | 155 +- .../Model/TaxClass/Key.php} | 30 +- .../Magento/Tax/Model/TaxClass/Management.php | 97 + .../TaxClass/Repository.php} | 168 +- .../Tax/Model/TaxClass/Source/Customer.php | 27 +- .../Tax/Model/TaxClass/Source/Product.php | 28 +- .../Tax/Model/TaxDetails/AppliedTax.php | 65 + .../Model/TaxDetails/AppliedTaxRate.php} | 32 +- .../Tax/Model/TaxDetails/ItemDetails.php | 137 + .../Tax/Model/TaxDetails/TaxDetails.php | 73 + .../TaxRateCollection.php | 42 +- .../Magento/Tax/Model/TaxRateManagement.php | 109 + .../TaxRuleCollection.php | 29 +- .../Magento/Tax/Model/TaxRuleRepository.php | 243 + .../Pricing/Price/Plugin/AttributePrice.php | 14 +- .../Magento/Tax/Pricing/Render/Adjustment.php | 4 +- .../OrderTaxDetails/AppliedTaxBuilder.php | 87 - .../V1/Data/OrderTaxDetails/ItemBuilder.php | 126 - .../V1/Data/OrderTaxDetailsBuilder.php | 145 - .../V1/Data/QuoteDetails/ItemBuilder.php | 205 - .../Service/V1/Data/QuoteDetailsBuilder.php | 206 - .../V1/Data/TaxClassSearchResultsBuilder.php | 75 - .../V1/Data/TaxDetails/AppliedTaxBuilder.php | 129 - .../V1/Data/TaxDetails/ItemBuilder.php | 245 - .../Tax/Service/V1/Data/TaxDetailsBuilder.php | 169 - .../Tax/Service/V1/Data/TaxRateBuilder.php | 198 - .../V1/Data/TaxRateSearchResultsBuilder.php | 75 - .../Magento/Tax/Service/V1/Data/TaxRule.php | 133 - .../Tax/Service/V1/Data/TaxRuleBuilder.php | 149 - .../V1/Data/TaxRuleSearchResultsBuilder.php | 75 - .../Magento/Tax/Service/V1/TaxRuleService.php | 449 -- app/code/Magento/Tax/composer.json | 28 +- app/code/Magento/Tax/etc/adminhtml/system.xml | 1 + app/code/Magento/Tax/etc/config.xml | 4 +- app/code/Magento/Tax/etc/di.xml | 34 +- app/code/Magento/Tax/etc/module.xml | 2 +- app/code/Magento/Tax/etc/webapi.xml | 32 +- .../view/adminhtml/layout/tax_rate_block.xml | 2 +- .../view/adminhtml/layout/tax_rule_block.xml | 2 +- .../order/create/items/price/total.phtml | 4 +- .../templates/checkout/grandtotal.phtml | 18 +- .../templates/checkout/shipping.phtml | 24 +- .../templates/checkout/subtotal.phtml | 18 +- .../frontend/templates/checkout/tax.phtml | 14 +- .../view/frontend/templates/order/tax.phtml | 6 +- .../Magento/TaxImportExport/composer.json | 12 +- .../Magento/TaxImportExport/etc/module.xml | 2 +- app/code/Magento/Theme/composer.json | 17 +- app/code/Magento/Theme/etc/module.xml | 3 +- .../Theme/view/base/page_layout/empty.xml | 2 +- .../Theme/view/base/templates/root.phtml | 4 +- .../Theme/view/frontend/layout/default.xml | 1 + .../Theme/view/frontend/requirejs-config.js | 67 + .../frontend/templates/js/components.phtml | 15 - .../frontend/templates/js/require_js.phtml | 6 +- .../Theme/view/frontend/web/js/notices.js | 1 + .../Theme/view/frontend/web/js/row-builder.js | 3 +- app/code/Magento/Translation/composer.json | 10 +- .../data-upgrade-1.0.0.0-1.0.0.1.php | 2 +- app/code/Magento/Translation/etc/module.xml | 2 +- .../Ui/{ => Component}/AbstractView.php | 202 +- .../Ui/Component/Container/Content.php | 47 + .../Ui/{ => Component}/Control/Action.php | 4 +- .../Ui/{ => Component}/Control/ActionPool.php | 54 +- .../Control/ActionPoolInterface.php | 2 +- .../Ui/{ => Component}/Control/Button.php | 13 +- .../Control/ButtonProviderFactory.php | 66 + .../Control/ButtonProviderInterface.php} | 10 +- .../Ui/{ => Component}/Control/Container.php | 12 +- .../Control/ControlInterface.php | 2 +- .../Ui/{ => Component}/Control/Item.php | 2 +- .../Ui/{ => Component}/Control/Link.php | 4 +- .../Component/ElementRenderer.php} | 39 +- .../Ui/Component/ElementRendererBuilder.php | 69 + .../Ui/Component/ElementRendererInterface.php | 37 + .../Filter/FilterAbstract.php} | 52 +- .../Filter/FilterInterface.php | 4 +- .../Ui/{ => Component}/Filter/FilterPool.php | 28 +- .../Ui/{ => Component}/Filter/Type/Date.php | 22 +- .../Ui/{ => Component}/Filter/Type/Input.php | 6 +- .../Ui/{ => Component}/Filter/Type/Range.php | 6 +- .../Ui/{ => Component}/Filter/Type/Select.php | 6 +- .../Ui/Component/Filter/Type/Store.php | 34 + .../View.php => Component/FilterPool.php} | 161 +- app/code/Magento/Ui/Component/Form.php | 241 + .../Magento/Ui/Component/Form/Collection.php | 35 + .../Form/Element}/AbstractFormElement.php | 5 +- .../Form/Element}/Checkbox.php | 2 +- .../Element}/DataType/AbstractDataType.php | 4 +- .../Form/Element}/DataType/Boolean.php | 2 +- .../Element}/DataType/DataTypeInterface.php | 2 +- .../Form/Element}/DataType/Date.php | 2 +- .../Form/Element/DataType/Email.php} | 8 +- .../Form/Element}/DataType/Media.php | 2 +- .../Form/Element}/DataType/Number.php | 2 +- .../Form/Element}/DataType/Password.php | 2 +- .../Component/Form/Element/DataType/Price.php | 32 + .../Form/Element}/DataType/Text.php | 2 +- .../Form/Element}/ElementInterface.php | 2 +- .../Form/Element}/Input.php | 10 +- .../Ui/Component/Form/Element/Multiline.php | 46 + .../Form/Element}/Radio.php | 2 +- .../Form/Element}/Range.php | 2 +- .../Form/Element/Select.php} | 18 +- .../Form/Element}/Textarea.php | 2 +- .../Magento/Ui/{ => Component}/Form/Field.php | 4 +- .../Magento/Ui/Component/Form/Fieldset.php | 79 + .../Ui/Component/Form/Fieldset/Factory.php | 64 + .../Ui/Component/Layout/AbstractStructure.php | 577 +++ .../Magento/Ui/Component/Layout/Group.php | 40 + app/code/Magento/Ui/Component/Layout/Tabs.php | 36 + .../Magento/Ui/Component/Layout/Tabs/Nav.php | 36 + .../Magento/Ui/Component/Layout/Tabs/Tab.php | 45 + .../Ui/Component/Layout/Tabs/TabInterface.php | 90 + .../Ui/Component/Layout/Tabs/TabWrapper.php | 119 + .../View.php => Component/Listing.php} | 90 +- .../Listing}/OptionsFactory.php | 4 +- .../Listing}/OptionsInterface.php | 2 +- .../Listing}/RowInterface.php | 2 +- .../Listing}/RowPool.php | 4 +- .../View.php => Component/MassAction.php} | 26 +- .../{Paging/View.php => Component/Paging.php} | 32 +- .../Ui/Component/RenderLayoutInterface.php | 34 + .../Select.php => Component/Search.php} | 6 +- .../View.php => Component/Sorting.php} | 29 +- .../{Builders => Builder}/ConfigJson.php | 2 +- .../ConfigStorageJson.php | 29 +- app/code/Magento/Ui/ContentType/Json.php | 2 +- .../Ui/{ => Context}/Configuration.php | 2 +- .../Ui/{ => Context}/ConfigurationStorage.php | 160 +- app/code/Magento/Ui/Context/DataProvider.php | 4 +- .../{Listing/Ajax.php => AbstractAction.php} | 19 +- .../Ui/Controller/Adminhtml/Form/Fieldset.php | 59 + .../Ui/Controller/Adminhtml/Form/Save.php | 51 + .../Ui/Controller/Adminhtml/Form/Validate.php | 46 + .../Ui/Controller/Adminhtml/Index/Render.php | 45 + .../Ui/Controller/UiActionInterface.php | 16 +- .../Ui/DataProvider/Config/Converter.php | 262 + .../DataProvider/Config/Data.php} | 31 +- .../Ui/DataProvider/Config/FileResolver.php | 71 + .../Magento/Ui/DataProvider/Config/Reader.php | 73 + .../DataProvider/Config/SchemaLocator.php} | 41 +- .../DataProviderCollectionInterface.php | 47 + .../DataProviderEntityInterface.php | 34 + .../DataProvider/Factory.php} | 32 +- app/code/Magento/Ui/DataProvider/Manager.php | 170 + app/code/Magento/Ui/DataProvider/Metadata.php | 339 ++ app/code/Magento/Ui/README.md | 12 + app/code/Magento/Ui/composer.json | 9 +- app/code/Magento/Ui/etc/data_source.xsd | 167 + app/code/Magento/Ui/etc/di.xml | 24 +- app/code/Magento/Ui/etc/module.xml | 3 +- .../Ui/view/base/layout/ui_components.xml | 199 +- .../Magento/Ui/view/base/requirejs-config.js | 7 +- .../content/default.phtml} | 5 - .../templates/control/button/default.phtml | 2 +- .../data_type/password/default.phtml | 30 - .../templates/filter/type/date/content.phtml | 52 - .../templates/filter/type/input/content.phtml | 37 - .../templates/filter/type/range/content.phtml | 52 - .../templates/filter/type/select/label.phtml | 30 - .../base/templates/filter_pool/active.phtml | 4 +- .../base/templates/filter_pool/default.phtml | 53 +- .../Ui/view/base/templates/form/default.phtml | 36 + .../templates/form/fieldset/default.phtml | 51 + .../form_element/checkbox/content.phtml | 30 - .../form_element/checkbox/label.phtml | 30 - .../form_element/input/content.phtml | 29 - .../templates/form_element/input/label.phtml | 30 - .../form_element/radio/content.phtml | 28 - .../templates/form_element/radio/label.phtml | 30 - .../templates/form_element/range/label.phtml | 30 - .../form_element/select/content.phtml | 51 - .../templates/form_element/select/label.phtml | 30 - .../form_element/textarea/label.phtml | 30 - .../view/base/templates/label/default.phtml | 4 +- .../group/default.phtml} | 22 +- .../date => layout/tabs}/default.phtml | 8 +- .../templates/layout/tabs/nav/default.phtml | 33 + .../templates/listing/horizontal_grid.phtml | 75 +- .../listingcontainer/massaction/default.phtml | 6 +- .../massaction/page_actions.phtml | 6 +- .../view/base/templates/paging/default.phtml | 44 +- .../view/base/templates/sorting/default.phtml | 6 +- .../Magento/Ui/view/base/web/js/core/app.js | 66 + .../web/js/core/renderer/components/layout.js | 238 + .../web/js/core/renderer/components/types.js | 72 + .../base/web/js/core/renderer/renderer.js} | 35 +- app/code/Magento/Ui/view/base/web/js/form.js | 119 + .../Ui/view/base/web/js/form/adapter.js | 56 + .../Ui/view/base/web/js/form/client.js | 102 + .../Ui/view/base/web/js/form/component.js | 489 ++ .../view/base/web/js/form/components/area.js | 113 + .../web/js/form/components/collapsible.js | 83 + .../base/web/js/form/components/collection.js | 213 + .../web/js/form/components/collection/item.js | 198 + .../base/web/js/form/components/fieldset.js | 39 +- .../view/base/web/js/form/components/group.js | 144 + .../view/base/web/js/form/components/html.js | 173 + .../view/base/web/js/form/components/tab.js | 82 + .../base/web/js/form/components/tab_group.js | 123 + .../view/base/web/js/form/element/abstract.js | 286 ++ .../view/base/web/js/form/element/boolean.js | 59 + .../base/web/js/form/element/multiselect.js | 60 + .../view/base/web/js/form/element/select.js | 245 + .../view/base/web/js/form/element/textarea.js | 38 +- .../Ui/view/base/web/js/form/provider.js | 93 + .../Ui/view/base/web/js/form/storages.js | 37 + .../Ui/view/base/web/js/lib/component.js | 16 +- .../{listing/utils => lib}/data_provider.js | 4 +- .../view/base/web/js/lib/deferred_events.js | 96 + .../Magento/Ui/view/base/web/js/lib/events.js | 77 +- .../Magento/Ui/view/base/web/js/lib/i18n.js | 30 + .../Ui/view/base/web/js/lib/ko/bind/class.js | 71 + .../base/web/js/lib/ko/bind/datepicker.js | 28 +- .../view/base/web/js/lib/ko/bind/keyboard.js | 43 +- .../view/base/web/js/lib/ko/bind/optgroup.js | 221 + .../Ui/view/base/web/js/lib/ko/bind/scope.js | 2 +- .../js/lib/ko/extender/observable_array.js | 113 + .../Ui/view/base/web/js/lib/ko/initialize.js | 9 +- .../Ui/view/base/web/js/lib/ko/scope.js | 47 +- .../Magento/Ui/view/base/web/js/lib/loader.js | 81 +- .../web/js/{listing/utils => lib}/provider.js | 3 +- .../view/base/web/js/lib/registry/events.js | 126 +- .../view/base/web/js/lib/registry/registry.js | 105 +- .../view/base/web/js/lib/registry/storage.js | 32 +- .../view/base/web/js/lib/renderer/renderer.js | 64 +- .../{listing/utils => lib}/request_builder.js | 0 .../web/js/{listing/utils => lib}/rest.js | 0 .../Ui/view/base/web/js/lib/spinner.js | 7 +- .../Ui/view/base/web/js/lib/storage/dump.js | 28 + .../Ui/view/base/web/js/lib/storage/index.js | 7 +- .../view/base/web/js/lib/storage/storage.js | 18 +- .../Magento/Ui/view/base/web/js/lib/utils.js | 5 +- .../view/base/web/js/lib/validation/rules.js | 803 +++ .../view/base/web/js/lib/validation/utils.js | 90 + .../base/web/js/lib/validation/validator.js | 77 + .../Ui/view/base/web/js/listing/filter.js | 12 +- .../base/web/js/listing/filter/abstract.js | 10 +- .../base/web/js/listing/filter/filters.js | 11 +- .../Ui/view/base/web/js/listing/grid.js | 2 +- .../Ui/view/base/web/js/listing/massaction.js | 2 +- .../Ui/view/base/web/js/listing/sorting.js | 11 +- .../Ui/view/base/web/templates/area.html | 32 + .../view/base/web/templates/collection.html | 27 + .../base/web/templates/content/content.html | 31 + .../templates/fieldset/fieldset.html} | 32 +- .../Ui/view/base/web/templates/filter.html | 4 +- .../web/templates/filter/filter_date.html | 2 +- .../web/templates/filter/filter_input.html | 2 +- .../web/templates/filter/filter_range.html | 2 +- .../web/templates/filter/filter_select.html | 2 +- .../base/web/templates/form/collection.html | 29 + .../templates/form/components/collection.html | 63 + .../form/components/collection/item.html | 28 + .../form/components/collection/preview.html | 61 + .../web/templates/form/element/checkbox.html | 27 +- .../base/web/templates/form/element/date.html | 34 + .../web/templates/form/element/email.html | 34 + .../form/element/helper/tooltip.html | 31 + .../web/templates/form/element/input.html | 34 + .../web/templates/form/element/media.html | 34 + .../templates/form/element/multiselect.html | 40 + .../web/templates/form/element/price.html | 28 + .../web/templates/form/element/select.html | 39 + .../web/templates/form/element/textarea.html | 36 + .../view/base/web/templates/group/field.html | 66 + .../view/base/web/templates/group/group.html | 65 + .../view/base/web/templates/listing/grid.html | 2 +- .../templates/listing/grid/cell/actions.html | 4 +- .../listing/grid/extender/sortable.html | 4 +- .../content.phtml => web/templates/tab.html} | 33 +- app/code/Magento/Ups/composer.json | 18 +- app/code/Magento/Ups/etc/module.xml | 2 +- app/code/Magento/UrlRewrite/composer.json | 18 +- app/code/Magento/UrlRewrite/etc/module.xml | 2 +- .../sql/urlrewrite_setup/install-1.0.0.0.php | 114 - .../sql/urlrewrite_setup/install-2.0.0.php | 125 + app/code/Magento/User/Model/User.php | 8 +- app/code/Magento/User/composer.json | 15 +- app/code/Magento/User/etc/di.xml | 2 +- app/code/Magento/User/etc/module.xml | 3 +- .../layout/adminhtml_auth_forgotpassword.xml | 1 + .../User/view/adminhtml/requirejs-config.js | 30 + .../templates/admin/forgotpassword.phtml | 11 +- .../admin/resetforgottenpassword.phtml | 10 - .../User/view/adminhtml/web/js/roles-tree.js | 3 +- app/code/Magento/Usps/composer.json | 18 +- .../data/usps_setup/data-install-2.0.0.php | 2 +- app/code/Magento/Usps/etc/module.xml | 2 +- app/code/Magento/Webapi/composer.json | 16 +- app/code/Magento/Webapi/etc/module.xml | 2 +- app/code/Magento/Weee/Pricing/Adjustment.php | 13 +- app/code/Magento/Weee/composer.json | 24 +- app/code/Magento/Weee/etc/module.xml | 2 +- .../view/adminhtml/requirejs-config.js} | 16 +- .../order/create/items/price/total.phtml | 8 +- .../view/adminhtml/web/js/fpt-attribute.js | 4 +- .../Weee/view/frontend/requirejs-config.js | 28 + .../Widget/Model/Config/FileResolver.php | 6 - .../Widget/Model/NamespaceResolver.php | 3 +- .../Magento/Widget/Model/Widget/Instance.php | 12 +- app/code/Magento/Widget/composer.json | 14 +- .../data-upgrade-1.6.0.0-1.6.0.1.php | 2 +- app/code/Magento/Widget/etc/module.xml | 2 +- .../Wishlist/Block/Adminhtml/WishlistTab.php | 90 + app/code/Magento/Wishlist/Block/Link.php | 5 + .../Magento/Wishlist/Block/Rss/EmailLink.php | 6 +- .../Magento/Wishlist/Block/Share/Wishlist.php | 4 +- app/code/Magento/Wishlist/Helper/Data.php | 10 +- app/code/Magento/Wishlist/Helper/Rss.php | 10 +- app/code/Magento/Wishlist/Model/Item.php | 35 +- .../Magento/Wishlist/Model/Item/Option.php | 4 +- .../Magento/Wishlist/Model/Resource/Item.php | 16 + .../Wishlist/Model/Resource/Wishlist.php | 9 + app/code/Magento/Wishlist/Model/Wishlist.php | 19 +- app/code/Magento/Wishlist/composer.json | 33 +- app/code/Magento/Wishlist/etc/module.xml | 3 +- .../wishlist_index_configure_type_bundle.xml | 2 +- ...list_index_configure_type_downloadable.xml | 2 +- .../frontend/layout/wishlist_index_index.xml | 31 +- .../view/frontend/requirejs-config.js | 32 + .../templates/item/column/actions.phtml | 2 +- .../frontend/templates/item/column/cart.phtml | 2 +- .../view/frontend/web/js/add-to-wishlist.js | 6 +- .../Wishlist/view/frontend/web/js/search.js | 1 + .../Wishlist/view/frontend/web/wishlist.js | 4 +- .../web/css/source/module.less | 7 +- .../Magento_Theme/web/css/source/module.less | 58 +- .../web/css/source/formelements.less | 602 +++ .../Magento_Ui/web/css/source/module.less | 262 +- .../Magento_Ui/web/images/choice_bkg.png | Bin 0 -> 3050 bytes .../adminhtml/Magento/backend/composer.json | 4 +- .../adminhtml/Magento/backend/theme.xml | 2 +- .../Magento/backend/web/bootstrap.js | 33 - .../Magento/backend/web/css/admin.less | 44 +- .../Magento/backend/web/css/pages.less | 6 - .../backend/web/css/source/abstract.less | 2 +- .../backend/web/css/source/navigation.less | 6 +- .../Magento/backend/web/css/source/table.less | 2 - .../Magento/backend/web/css/source/theme.less | 4 + .../adminhtml/Magento/backend/web/js/theme.js | 40 +- .../backend/web/less/clearless/helpers.less | 110 +- .../backend/web/less/clearless/resets.less | 11 +- .../web/less/clearless/typography.less | 1 - .../Magento/backend/web/less/lib/buttons.less | 6 +- .../Magento/backend/web/less/styles/base.less | 1 + .../backend/web/less/styles/debug.less | 6 - .../backend/web/less/styles/header.less | 15 +- .../backend/web/less/styles/pages.less | 7 - .../Magento_Bundle/web/css/source/module.less | 12 +- .../web/css/source/listings.less | 20 +- .../web/css/source/module.less | 83 +- .../web/css/source/toolbar.less | 1 - .../web/css/source/widgets.less | 20 +- .../web/css/source/module.less | 6 + .../Magento_Checkout/web/css/source/cart.less | 26 +- .../web/css/source/minicart.less | 10 +- .../web/css/source/module.less | 64 +- .../Magento_Cms/web/css/source/widgets.less | 20 +- .../web/css/source/module.less | 84 +- .../web/css/source/module.less | 4 +- .../web/css/source/module.less | 71 +- .../Magento_Paypal/web/css/source/module.less | 31 +- .../web/css/source/module.less | 10 +- .../Magento_Sales/web/css/source/module.less | 80 +- .../css/source/collapsible_navigation.less | 8 +- .../Magento_Theme/web/css/source/module.less | 32 +- .../web/css/source/module.less | 39 +- .../frontend/Magento/blank/composer.json | 4 +- .../frontend/Magento/blank/etc/view.xml | 24 +- app/design/frontend/Magento/blank/theme.xml | 2 +- .../frontend/Magento/blank/web/css/print.less | 13 +- .../blank/web/css/source/abstract.less | 246 +- .../Magento/blank/web/css/source/forms.less | 39 +- .../Magento/blank/web/css/source/layout.less | 38 +- .../blank/web/css/source/navigation.less | 4 +- .../Magento/blank/web/css/source/rating.less | 7 - .../Magento/blank/web/css/source/tables.less | 55 +- .../Magento/blank/web/css/styles.less | 1 - .../Magento/blank/web/js/navigation-menu.js | 3 + .../frontend/Magento/blank/web/js/theme.js | 24 +- .../Magento_Bundle/web/css/source/module.less | 245 + .../layout/catalog_product_view.xml | 30 + .../luma/Magento_Catalog/layout/default.xml | 34 + .../web/css/source/listings.less | 337 ++ .../web/css/source/module.less | 944 ++++ .../web/css/source/toolbar.less | 203 + .../web/css/source/module.less | 219 + .../layout/checkout_cart_index.xml | 36 + .../Magento_Checkout/web/css/source/cart.less | 718 +++ .../web/css/source/minicart.less | 258 + .../web/css/source/module.less | 652 +++ .../web/css/source/module.less | 3 + .../luma/Magento_Customer/layout/default.xml | 36 + .../web/css/source/module.less | 372 ++ .../web/css/source/module.less | 178 + .../web/css/source/module.less | 209 + .../templates/layer/state.phtml | 64 + .../templates/layer/view.phtml | 69 + .../web/css/source/module.less | 470 ++ .../web/css/source/module.less | 86 + .../Magento_Paypal/web/css/source/module.less | 190 + .../web/css/source/module.less | 145 + .../Magento_Review/web/css/source/module.less | 453 ++ .../Magento_Sales/web/css/source/module.less | 561 ++ .../web/css/source/module.less | 55 + .../luma/Magento_Theme/layout/default.xml | 46 + .../css/source/collapsible_navigation.less | 106 + .../Magento_Theme/web/css/source/module.less | 570 +++ .../web/css/source/module.less | 341 ++ .../Magento/{plushe => luma}/composer.json | 10 +- app/design/frontend/Magento/luma/etc/view.xml | 215 + .../frontend/Magento/luma/i18n/en_US.csv | 23 + .../frontend/Magento/luma/media/preview.jpg | Bin 0 -> 103941 bytes .../Magento/{plushe => luma}/theme.xml | 4 +- .../Magento/luma/web/css/source/abstract.less | 1322 +++++ .../luma/web/css/source/actions-toolbar.less | 73 + .../luma/web/css/source/breadcrumbs.less | 36 + .../Magento/luma/web/css/source/buttons.less | 49 + .../Magento/luma/web/css/source/forms.less | 161 + .../luma/web/css/source/lib/variables.less | 1483 ++++++ .../Magento/luma/web/css/source/pages.less | 66 + .../Magento/luma/web/css/source/popups.less | 76 + .../Magento/luma/web/css/source/sections.less | 77 + .../Magento/luma/web/css/source/tables.less | 112 + .../Magento/luma/web/fonts/Luma-Icons.eot | Bin 0 -> 6132 bytes .../Magento/luma/web/fonts/Luma-Icons.svg | 52 + .../Magento/luma/web/fonts/Luma-Icons.ttf | Bin 0 -> 5956 bytes .../Magento/luma/web/fonts/Luma-Icons.woff | Bin 0 -> 5516 bytes .../Magento/luma/web/fonts/selection.json | 894 ++++ .../frontend/Magento/luma/web/images/logo.png | Bin 0 -> 5884 bytes .../Magento/luma/web/images/select-bg.svg | 13 + .../frontend/Magento/plushe/media/preview.jpg | Bin 12683 -> 0 bytes app/etc/di.xml | 53 +- app/etc/local.xml.template | 72 - app/i18n/magento/de_de/composer.json | 4 +- app/i18n/magento/en_us/composer.json | 4 +- app/i18n/magento/es_es/composer.json | 4 +- app/i18n/magento/fr_fr/composer.json | 4 +- app/i18n/magento/nl_nl/composer.json | 4 +- app/i18n/magento/pt_br/composer.json | 4 +- app/i18n/magento/zh_cn/composer.json | 4 +- composer.json | 4 +- dev/shell/user_config_data.php | 61 + dev/tests/functional/bootstrap.php | 4 +- .../lib/Mtf/App/State/AbstractState.php | 23 +- ...rchElement.php => GlobalsearchElement.php} | 115 +- .../lib/Mtf/ObjectManagerFactory.php | 19 +- .../Backend/Test/Block/Page/Header.php | 30 +- .../Backend/Test/TestCase/UserTest.php | 57 - .../Test/Block/Catalog/Product/View.php | 18 +- .../Catalog/Test/Block/Product/Price.php | 2 +- .../Test/Fixture/CatalogProductSimple.php | 25 + .../Test/Fixture/CatalogProductSimple.xml | 13 + .../Test/Fixture/CatalogProductSimple/Fpt.php | 105 + .../Handler/CatalogProductSimple/Curl.php | 51 + .../Test/Repository/CatalogAttributeSet.php | 8 + .../Repository/CatalogProductAttribute.php | 5 + .../Test/Repository/CatalogProductSimple.php | 48 +- .../app/Magento/Checkout/Test/Block/Cart.php | 2 +- .../Checkout/Test/Block/Cart/CartItem.php | 2 +- .../app/Magento/Cms/Test/Page/CmsIndex.xml | 2 +- .../app/Magento/Cms/Test/Page/CmsPage.xml | 2 +- .../ConfigurableAttributesData.php | 14 +- .../ConfigurableProductInjectable/Curl.php | 25 +- .../test.csv | 2 +- .../Block/Adminhtml/Edit/CustomerForm.xml | 2 +- .../TestCase/BackendCustomerCreateTest.php | 1 + .../TestStep/LoginCustomerOnFrontendStep.php | 19 +- .../Catalog/Product/View/Type/Grouped.php | 2 +- .../Test/Block/Adminhtml/Rule/Edit/Form.php | 146 +- .../Test/TestCase/CreateTaxRateEntityTest.php | 16 +- .../Test/TestCase/CreateTaxRuleEntityTest.php | 28 +- .../testCreateTaxRule.csv | 10 +- .../Test/TestCase/DeleteTaxRateEntityTest.php | 15 +- .../Tax/Test/TestCase/TaxCalculationTest.php | 46 +- .../Test/TestCase/UpdateTaxRateEntityTest.php | 15 +- .../Test/TestCase/UpdateTaxRuleEntityTest.php | 35 +- .../testUpdateTaxRule.csv | 10 +- .../app/Magento/Theme/Test/Block/Links.php | 32 +- .../app/Magento/User/Test/Repository/User.php | 3 +- .../app/Magento/Weee/Test/Block/Cart.php | 63 + .../Magento/Weee/Test/Block/Cart/CartItem.php | 74 + .../Weee/Test/Block/Cart/CartItem/Fpt.php | 93 + .../Magento/Weee/Test/Block/Cart/Totals.php | 34 +- .../Weee/Test/Block/Cart/Totals/Fpt.php | 64 + .../Magento/Weee/Test/Block/Product/Fpt.php | 68 + .../Weee/Test/Block/Product/ListProduct.php | 57 + .../Magento/Weee/Test/Block/Product/View.php | 34 +- .../Weee/Test/Constraint/AssertFptApplied.php | 215 + .../Page/Category/CatalogCategoryView.xml} | 15 +- .../Magento/Weee/Test/Page/CheckoutCart.xml | 39 + .../Test/Page/Product/CatalogProductView.xml} | 14 +- .../Test/TestCase/CreateTaxWithFptTest.php | 154 + .../TestCase/CreateTaxWithFptTest/test.csv | 12 + .../app/Magento/Weee/Test/etc/constraint.xml | 30 + .../TestFramework/App/Arguments/Proxy.php | 116 - .../Magento/TestFramework/Application.php | 95 +- .../Magento/TestFramework/Helper/Config.php | 9 +- .../TestFramework/Indexer/TestCase.php | 1 - .../TestFramework/ObjectManagerFactory.php | 39 +- dev/tests/integration/framework/bootstrap.php | 20 +- .../Magento/Test/App/Arguments/ProxyTest.php | 78 - .../Magento/Test/ApplicationTest.php | 3 +- dev/tests/integration/phpunit.xml.dist | 2 - .../Bundle/Model/Product/PriceTest.php | 58 + .../BundleProductSaveProcessorTest.php | 5 - .../_files/product_with_tier_pricing.php | 78 + .../Block/Adminhtml/Product/Edit/JsTest.php | 9 +- .../Magento/Catalog/Block/Product/NewTest.php | 11 +- .../Controller/Adminhtml/CategoryTest.php | 6 +- .../Adminhtml/Product/AttributeTest.php | 152 + .../Magento/Catalog/Helper/DataTest.php | 2 +- .../Indexer/Product/Flat/Action/RowsTest.php | 1 - .../Model/Layer/Filter/AttributeTest.php | 9 +- .../Model/Layer/Filter/CategoryTest.php | 15 - .../Layer/Filter/DataProvider/PriceTest.php | 97 + .../Model/Layer/Filter/DecimalTest.php | 92 +- .../Catalog/Model/Layer/Filter/ItemTest.php | 129 - .../Filter/Price/AlgorithmAdvancedTest.php | 85 +- .../Layer/Filter/Price/AlgorithmBaseTest.php | 63 +- .../Price/_files/_algorithm_base_data.php | 128 +- .../Catalog/Model/Layer/Filter/PriceTest.php | 54 +- .../Option/Type/File/ValidatorFileTest.php | 254 + .../Option/Type/File/ValidatorInfoTest.php | 189 + .../Model/Resource/Product/CollectionTest.php | 14 +- .../Model/Resource/_files/product_simple.php | 6 +- .../V1/Category/MetadataServiceTest.php | 63 - .../V1/Product/MetadataServiceTest.php | 2 +- .../attribute_set_with_image_attribute.php | 2 +- ...bute_set_with_image_attribute_rollback.php | 2 +- .../Magento/Catalog/_files/categories.php | 1 - .../Catalog/_files/category_attribute.php | 12 +- .../_files/category_attribute_rollback.php | 26 +- .../Catalog/_files/empty_attribute_group.php | 23 +- .../_files/empty_attribute_group_rollback.php | 36 + .../Catalog/_files/etc/data_object.xml | 6 +- .../Catalog/_files/product_group_prices.php | 4 +- .../Magento/Catalog/_files/product_simple.php | 6 +- .../_files/products_related_multiple.php | 97 + .../products_related_multiple_rollback.php | 53 + .../Magento/Catalog/_files/validate_image.php | 26 +- .../Catalog/_files/validate_image_info.php | 27 +- .../_files/validate_image_info_rollback.php | 37 + .../_files/validate_image_rollback.php | 37 + .../_files/attribute_system_popup.php | 12 +- .../Model/Indexer/BatchIndexTest.php | 124 + .../Magento/CatalogRule/_files/two_rules.php | 75 + .../Block/Advanced/ResultTest.php | 7 +- .../Magento/CatalogSearch/Helper/DataTest.php | 19 - .../Model/Indexer/FulltextTest.php | 4 +- .../Model/Layer/Filter/AttributeTest.php | 112 + .../Model/Layer/Filter/CategoryTest.php | 128 + .../Model/Layer/Filter/DecimalTest.php | 108 + .../Model/Layer/Filter/PriceTest.php | 111 + .../Checkout/Block/Onepage/BillingTest.php | 4 +- .../Magento/Contact/Controller/IndexTest.php | 42 - .../Magento/Core/Model/DesignTest.php | 2 +- .../Core/Model/Resource/Layout/UpdateTest.php | 1 + .../Magento/Core/_files/design_change.php | 2 +- .../Customer/Api/AddressRepositoryTest.php | 28 +- .../Block/Account/Dashboard/AddressTest.php | 37 +- .../Customer/Block/Account/DashboardTest.php | 22 +- .../Customer/Block/Address/BookTest.php | 19 +- .../Customer/Block/Address/EditTest.php | 2 +- .../Edit/Renderer/Attribute/GroupTest.php | 5 +- .../Block/Adminhtml/Edit/Tab/AccountTest.php | 41 +- .../Adminhtml/Edit/Tab/AddressesTest.php | 58 +- .../Block/Adminhtml/Edit/Tab/CartsTest.php | 16 +- .../Adminhtml/Edit/Tab/NewsletterTest.php | 2 +- .../Adminhtml/Edit/Tab/View/AccordionTest.php | 114 - .../Edit/Tab/View/PersonalInfoTest.php | 58 +- .../Block/Adminhtml/Edit/Tab/ViewTest.php | 42 +- .../Block/Adminhtml/Edit/TabsTest.php | 151 - .../Block/Adminhtml/Group/Edit/FormTest.php | 25 +- .../Block/Adminhtml/Group/EditTest.php | 29 +- .../Customer/Block/Widget/GenderTest.php | 2 +- .../Customer/Block/Widget/NameTest.php | 8 +- .../Customer/Controller/AccountTest.php | 24 +- .../Customer/Controller/AddressTest.php | 14 +- .../Controller/Adminhtml/GroupTest.php | 74 +- .../Controller/Adminhtml/IndexTest.php | 299 +- .../Magento/Customer/Helper/ViewTest.php | 29 +- .../Customer/Model/AccountManagementTest.php | 51 +- .../AddressMetadataTest.php} | 27 +- .../CustomerMetadataTest.php} | 48 +- .../Magento/Customer/Model/CustomerTest.php | 4 +- .../V1 => Model}/FileResolverStub.php | 4 +- .../Customer/Model/GroupManagementTest.php | 23 +- .../Customer/Model/GroupRegistryTest.php | 10 +- .../Model/Resource/AddressRepositoryTest.php | 308 +- .../Model/Resource/CustomerRepositoryTest.php | 185 +- .../Model/Resource/GroupRepositoryTest.php | 26 +- .../Magento/Customer/Model/VisitorTest.php | 8 +- .../Service/V1/CustomerAccountServiceTest.php | 40 +- .../V1/Data/CustomerDetailsBuilderTest.php | 1 + ..._user_defined_address_custom_attribute.php | 4 +- ...ined_address_custom_attribute_rollback.php | 12 +- ...ttribute_user_defined_custom_attribute.php | 4 +- .../Customer/_files/customer_group.php | 14 +- .../Customer/_files/etc/data_object.xml | 4 +- .../Magento/Directory/Model/ObserverTest.php | 12 +- .../Eav/_files/empty_attribute_set.php | 25 +- .../_files/empty_attribute_set_rollback.php | 10 +- .../Magento/Email/Model/TemplateTest.php | 8 +- .../Framework/Api/Config/ReaderTest.php | 14 +- .../Api/Config/_files/config_one.xml | 10 +- .../Api/Config/_files/config_two.xml | 6 +- .../Magento/Framework/App/AreaTest.php | 2 +- .../App/Resource/ConnectionFactoryTest.php | 58 + .../Framework/Code/_files/ClassToFind.php | 27 + .../Framework/DB/Adapter/InterfaceTest.php | 8 +- .../Model/Resource/Db/ProfilerTest.php | 8 +- .../Type/Db/ConnectionFactoryTest.php} | 40 +- .../Model/Resource/Type/Db/Pdo/MysqlTest.php | 57 + .../{SetupTest.php => DataSetupTest.php} | 14 +- .../Object/Copy/Config/ReaderTest.php | 99 +- .../{Magento/Test/etc => }/fieldset.xml | 2 +- .../ObjectManager/_files/config_merged.xml | 30 - .../ObjectManager/_files/config_one.xml | 26 - .../ObjectManager/_files/config_two.xml | 19 - .../Search/Adapter/Mysql/AdapterTest.php | 32 +- .../Framework/Search/_files/products.php | 30 +- .../Framework/Search/_files/requests.xml | 2 +- .../Magento/Framework/Session/ConfigTest.php | 16 +- .../_files/_inline_page_expected.html | 10 +- .../View/Element/AbstractBlockTest.php | 2 +- .../Magento/Framework/View/LayoutTest.php | 2 +- .../Model/Attribute/TaxTest.php | 18 +- .../Model/_files/flag_expired.php | 1 + .../Service/V1/CustomerTokenServiceTest.php | 12 +- .../Newsletter/Model/Plugin/PluginTest.php | 12 +- .../Magento/Newsletter/Model/TemplateTest.php | 4 +- .../Persistent/Model/Observer/SessionTest.php | 2 +- .../Magento/ProductAlert/Model/EmailTest.php | 45 +- .../ProductAlert/Model/ObserverTest.php | 25 +- .../Report/Product/Viewed/CollectionTest.php | 125 +- .../Review/Block/Adminhtml/MainTest.php | 13 +- .../Order/Create/Form/AbstractTest.php | 3 +- .../Adminhtml/Order/CreditmemoTest.php | 2 +- .../Magento/Sales/Model/Order/AddressTest.php | 12 +- .../Magento/Sales/Model/Quote/AddressTest.php | 2 +- .../Magento/Sales/Model/QuoteTest.php | 53 +- .../Magento/Sales/Model/Service/QuoteTest.php | 8 +- .../Sales/_files/creditmemo_with_list.php | 17 +- .../Model/Resource/Report/CollectionTest.php | 30 +- .../SalesRule/_files/order_with_coupon.php | 2 +- .../Block/Adminhtml/Rule/Edit/FormTest.php | 110 - .../Tax/Controller/Adminhtml/TaxTest.php | 13 +- .../Model/Calculation/Rate/ConverterTest.php | 205 - .../Calculation/RateRepositoryTest.php} | 329 +- .../Tax/Model/Resource/CalculationTest.php | 12 +- .../Tax/Model/Sales/Total/Quote/SetupUtil.php | 30 +- .../TaxCalculationTest.php} | 76 +- .../Tax/Model/TaxClass/ManagementTest.php | 100 + .../TaxClass/RepositoryTest.php} | 158 +- .../Model/TaxClass/Source/CustomerTest.php | 6 +- .../Tax/Model/TaxClass/Source/ProductTest.php | 6 +- .../TaxRateCollectionTest.php | 6 +- .../Tax/Model/TaxRateManagementTest.php | 131 + .../TaxRuleCollectionTest.php | 13 +- .../V1 => Model}/TaxRuleFixtureFactory.php | 42 +- .../Tax/Model/TaxRuleRepositoryTest.php | 451 ++ .../Price/Plugin/AttributePriceTest.php | 5 +- .../V1/Data/QuoteDetails/ItemBuilderTest.php | 215 - .../V1/Data/QuoteDetailsBuilderTest.php | 189 - .../Data/TaxDetails/AppliedTaxBuilderTest.php | 246 - .../V1/Data/TaxDetails/ItemBuilderTest.php | 231 - .../Service/V1/Data/TaxDetailsBuilderTest.php | 158 - .../Service/V1/Data/TaxRateBuilderTest.php | 168 - .../Data/TaxRateSearchResultsBuilderTest.php | 194 - .../Service/V1/Data/TaxRuleBuilderTest.php | 221 - .../Data/TaxRuleSearchResultsBuilderTest.php | 287 -- .../Tax/Service/V1/TaxRuleServiceTest.php | 552 -- ...excluding_tax_apply_tax_after_discount.php | 8 +- ..._apply_tax_after_discount_discount_tax.php | 8 +- ...i_tax_rule_total_calculate_subtotal_no.php | 10 +- ..._tax_rule_total_calculate_subtotal_yes.php | 10 +- ...ule_two_row_calculate_subtotal_yes_row.php | 10 +- ...e_two_row_calculate_subtotal_yes_total.php | 10 +- ...ti_tax_rule_unit_calculate_subtotal_no.php | 10 +- ...i_tax_rule_unit_calculate_subtotal_yes.php | 10 +- .../Magento/Tax/_files/tax_classes.php | 6 +- .../Magento/Test/Integrity/LayoutTest.php | 8 +- .../Integrity/Modular/AclConfigFilesTest.php | 2 +- .../Modular/BlockInstantiationTest.php | 4 +- .../Modular/CrontabConfigFilesTest.php | 2 +- .../Modular/EventConfigFilesTest.php | 2 +- .../Integrity/Modular/LayoutFilesTest.php | 2 +- .../Catalog/AttributeConfigFilesTest.php | 2 +- .../Customer/AddressFormatsFilesTest.php | 2 +- .../Email/EmailTemplateConfigFilesTest.php | 2 +- .../Magento/Sales/PdfConfigFilesTest.php | 2 +- .../Modular/MviewConfigFilesTest.php | 2 +- .../Modular/ResourcesConfigFilesTest.php | 6 +- .../Modular/SalesConfigFilesTest.php | 2 +- .../Integrity/Modular/TemplateFilesTest.php | 4 +- .../Test/Integrity/StaticFilesTest.php | 8 +- .../{Code => }/Dictionary/GeneratorTest.php | 6 +- .../_files/expected/with_context.csv | 0 .../_files/expected/without_context.csv | 0 .../Magento/FirstModule/Helper/Helper.php | 0 .../code/Magento/FirstModule/Model/Model.php | 0 .../FirstModule/view/frontend/default.xml | 0 .../Magento/FirstModule/view/frontend/file.js | 0 .../FirstModule/view/frontend/template.phtml | 0 .../code/Magento/SecondModule/Model/Model.php | 0 .../adminhtml/default/backend/default.xml | 0 .../adminhtml/default/backend/template.phtml | 0 .../_files/source/lib/web/mage/file.js | 0 .../_files/source/lib/web/varien/file.js | 0 .../_files/source/not_magento_dir/Model.php | 0 .../_files/source/not_magento_dir/file.js | 0 .../source/not_magento_dir/template.phtml | 0 .../I18n/{Code => }/Pack/GeneratorTest.php | 6 +- .../code/Magento/FirstModule/i18n/de_DE.csv | 0 .../code/Magento/SecondModule/i18n/de_DE.csv | 0 .../design/adminhtml/default/i18n/de_DE.csv | 0 .../_files/expected/lib/web/i18n/de_DE.csv | 0 .../I18n/{Code => }/Pack/_files/source.csv | 0 .../testsuite/Magento/Weee/Model/TaxTest.php | 19 +- .../Magento/Widget/Model/Config/DataTest.php | 80 +- .../Widget/Model/Config/FileResolverTest.php | 88 - .../Widget/Model/Config/ReaderTest.php | 116 +- ...irst.xml => catalog_new_products_list.xml} | 0 .../design/frontend/Test/etc/widget.xml | 52 - .../etc/widget.xml => orders_and_returns.xml} | 2 +- ....xml => orders_and_returns_customized.xml} | 0 .../Widget/Model/Widget/InstanceTest.php | 2 +- .../Magento/Wishlist/Controller/IndexTest.php | 14 - dev/tests/js/jsTestDriver.php.dist | 1 - dev/tests/js/jsTestDriverOrder.php | 2 +- dev/tests/js/testsuite/mage/mage-test.js | 139 +- .../TestFramework/Dependency/LayoutRule.php | 2 +- .../TestFramework/Dependency/PhpRule.php | 4 +- .../Inspection/JsHint/Command.php | 8 +- .../Integrity/AbstractConfig.php | 18 +- .../TestFramework/Utility/ChangedFiles.php | 4 +- dev/tests/static/framework/bootstrap.php | 2 +- .../App/Language/CircularDependencyTest.php | 2 +- .../Integrity/App/Language/PackageTest.php | 2 +- .../App/Language/TranslationFiles.php | 2 +- .../App/Language/TranslationFilesTest.php | 38 +- .../Test/Integrity/CircularDependencyTest.php | 2 +- .../Magento/Test/Integrity/ClassesTest.php | 54 +- .../Magento/Test/Integrity/ConfigTest.php | 4 +- .../Magento/Test/Integrity/DependencyTest.php | 26 +- .../Test/Integrity/Di/CompilerTest.php | 31 +- .../Test/Integrity/Layout/BlocksTest.php | 8 +- .../Test/Integrity/Layout/HandlesTest.php | 12 +- .../Integrity/Layout/ThemeHandlesTest.php | 6 +- .../Test/Integrity/Library/DependencyTest.php | 4 +- .../Magento/Backend/SystemConfigTest.php | 6 +- .../Model/Fieldset/FieldsetConfigTest.php | 14 +- .../Payment/Config/ReferentialTest.php | 4 +- .../Magento/Widget/WidgetConfigTest.php | 16 +- .../Integrity/Phrase/AbstractTestCase.php | 6 +- .../Test/Integrity/Phrase/ArgumentsTest.php | 11 +- .../Magento/Test/Integrity/Phrase/JsTest.php | 20 +- .../Integrity/Phrase/Legacy/SignatureTest.php | 10 +- .../Magento/Test/Integrity/Xml/SchemaTest.php | 4 +- .../Integrity/_files/blacklist/namespace.txt | 8 +- .../Magento/Test/Js/LiveCodeTest.php | 4 +- .../Magento/Test/Js/_files/whitelist/core.txt | 1 - .../Magento/Test/Legacy/ClassesTest.php | 28 +- .../Magento/Test/Legacy/ConfigTest.php | 4 +- .../Magento/Test/Legacy/EmailTemplateTest.php | 4 +- .../Magento/Test/Legacy/LayoutTest.php | 8 +- .../Test/Legacy/LibraryLocationTest.php | 2 +- .../Magento/Test/Legacy/LicenseTest.php | 4 +- .../Magento/Core/Block/AbstractBlockTest.php | 8 +- .../Framework/Module/ModuleXMLTest.php | 6 +- .../Framework/ObjectManager/DiConfigTest.php | 4 +- .../Test/Legacy/Magento/Widget/XmlTest.php | 8 +- .../Magento/Test/Legacy/ObsoleteAclTest.php | 4 +- .../Magento/Test/Legacy/ObsoleteCodeTest.php | 30 +- .../Magento/Test/Legacy/ObsoleteMenuTest.php | 4 +- .../ObsoleteSystemConfigurationTest.php | 2 +- .../Test/Legacy/ObsoleteThemeLocalXmlTest.php | 2 +- .../Magento/Test/Legacy/PhtmlTemplateTest.php | 4 +- .../Magento/Test/Legacy/TableTest.php | 4 +- .../Magento/Test/Legacy/WordsTest.php | 6 +- .../Test/Legacy/_files/obsolete_classes.php | 55 +- .../Test/Legacy/_files/obsolete_constants.php | 12 + .../Test/Legacy/_files/obsolete_methods.php | 34 +- .../Legacy/_files/obsolete_namespaces.php | 1 + .../Test/Legacy/_files/obsolete_paths.php | 1 + .../Legacy/_files/obsolete_properties.php | 19 + .../Test/Php/Exemplar/CodeMessTest.php | 2 +- .../Test/Php/Exemplar/CodeStyleTest.php | 2 +- .../Magento/Test/Php/LiveCodeTest.php | 2 +- .../Php/_files/phpcpd/blacklist/common.txt | 13 + .../Test/Php/_files/whitelist/common.txt | 1 - dev/tests/unit/filename | 0 dev/tests/unit/filename.csv | 0 dev/tests/unit/filename.invalid_type | 0 .../AdminNotification/Model/FeedTest.php | 16 +- .../Media/Synchronization/SuccessTest.php | 2 +- .../App/Area/FrontNameResolverTest.php | 7 +- .../Magento/Backend/App/UserConfigTest.php | 45 + .../Model/Config/Backend/BaseurlTest.php | 2 +- .../Config/Backend/Cookie/DomainTest.php | 4 +- .../Config/Backend/Cookie/LifetimeTest.php | 11 +- .../Model/Config/Backend/Cookie/PathTest.php | 6 +- .../Model/Config/Backend/EncryptedTest.php | 4 +- .../Model/Config/Backend/SecureTest.php | 2 +- .../Source/Storage/Media/DatabaseTest.php | 15 +- .../Backend/Model/Config/StructureTest.php | 53 + .../Magento/Backend/Model/ConfigTest.php | 54 + .../Magento/Backend/Model/Menu/ItemTest.php | 36 +- .../Backend/Model/Session/QuoteTest.php | 47 +- .../Catalog/Product/View/Type/BundleTest.php | 2 +- .../Bundle/Model/Plugin/BundleOptionsTest.php | 204 + .../Bundle/Model/Plugin/ProductTest.php | 90 + .../Attribute/Source/Price/ViewTest.php | 29 +- .../Bundle/Model/Product/PriceTest.php | 8 + .../Magento/Bundle/Model/Product/TypeTest.php | 309 +- .../Pricing/Adjustment/CalculatorTest.php | 107 + .../Pricing/Price/BundleRegularPriceTest.php | 155 + .../Price/BundleSelectionPriceTest.php | 156 +- .../Bundle/Pricing/Price/FinalPriceTest.php | 16 +- .../Bundle/Pricing/Price/GroupPriceTest.php | 10 + .../Bundle/Pricing/Price/SpecialPriceTest.php | 13 +- .../Bundle/Pricing/Price/TierPriceTest.php | 35 +- .../Adminhtml/Category/Edit/FormTest.php | 169 + .../Adminhtml/Product/Options/AjaxTest.php | 2 +- .../Catalog/Block/Product/ListProductTest.php | 10 +- .../Adminhtml/Category/SaveTest.php | 608 +++ .../Adminhtml/Product/BuilderTest.php | 280 +- .../Helper/Product/Flat/IndexerTest.php | 2 +- .../Category/Attribute/Backend/SortbyTest.php | 31 +- .../Category/AttributeRepositoryTest.php | 138 + .../V1/Data => Model}/Category/TreeTest.php | 99 +- .../Model/CategoryLinkManagementTest.php | 96 + .../Model/CategoryLinkRepositoryTest.php | 269 + .../Catalog/Model/CategoryManagementTest.php | 192 + .../Catalog/Model/CategoryRepositoryTest.php | 295 ++ .../Magento/Catalog/Model/CategoryTest.php | 316 +- .../Price/Plugin/CustomerGroupTest.php | 14 +- .../Category/FilterableAttributeListTest.php | 17 +- .../Model/Layer/Filter/AttributeTest.php | 305 ++ .../Model/Layer/Filter/CategoryTest.php | 345 ++ .../Filter/DataProvider/CategoryTest.php | 135 + .../Layer/Filter/DataProvider/DecimalTest.php | 105 + .../Layer/Filter/DataProvider/PriceTest.php | 243 + .../Model/Layer/Filter/DecimalTest.php | 23 +- .../Layer/Filter/Item/DataBuilderTest.php} | 39 +- .../Catalog/Model/Layer/Filter/PriceTest.php | 269 + .../Search/FilterableAttributeListTest.php | 15 +- .../Backend/Groupprice/AbstractTest.php | 4 +- .../Product/Attribute/ManagementTest.php | 89 + .../Attribute/OptionManagementTest.php | 91 + .../Product/Attribute/RepositoryTest.php | 316 ++ .../Product/Attribute/SetManagementTest.php | 113 + .../Product/Attribute/SetRepositoryTest.php | 242 + .../Model/Product/Attribute/TypesListTest.php | 80 + .../Product/Gallery/GalleryManagementTest.php | 655 +++ .../Product/GroupPriceManagementTest.php} | 199 +- .../Model/Product/LinkTypeProviderTest.php | 137 + .../Product/Media/AttributeManagementTest.php | 104 + .../Model/Product/Option/RepositoryTest.php | 233 + .../Model/Product/PriceModifierTest.php | 23 +- .../Product/TierPriceManagementTest.php} | 209 +- .../ProductAttributeGroupRepositoryTest.php | 168 + .../Model/ProductLink/ManagementTest.php | 309 ++ .../Model/ProductLink/RepositoryTest.php | 213 + .../Catalog/Model/ProductRepositoryTest.php | 191 +- .../Magento/Catalog/Model/ProductTest.php | 62 +- .../ProductTypeListTest.php} | 48 +- .../Model/Resource/Eav/AttributeTest.php | 35 +- .../Product/Attribute/Backend/MediaTest.php | 161 + .../Catalog/Model/Resource/ProductTest.php | 105 + .../Catalog/Model/Rss/CategoryTest.php | 88 +- .../Pricing/Price/ConfiguredPriceTest.php | 9 +- .../Pricing/Price/CustomOptionPriceTest.php | 10 +- .../Catalog/Pricing/Price/FinalPriceTest.php | 55 +- .../Catalog/Pricing/Price/GroupPriceTest.php | 28 +- .../Pricing/Price/RegularPriceTest.php | 39 +- .../Pricing/Price/SpecialPriceTest.php | 25 +- .../Catalog/Pricing/Price/TierPriceTest.php | 150 +- .../Pricing/Render/FinalPriceBoxTest.php | 27 +- .../V1/Category/CategoryLoaderTest.php | 84 - .../Category/ProductLinks/ReadServiceTest.php | 159 - .../ProductLinks/WriteServiceTest.php | 269 - .../Service/V1/Category/ReadServiceTest.php | 147 - .../V1/Category/Tree/ReadServiceTest.php | 142 - .../Service/V1/Category/WriteServiceTest.php | 319 -- .../Service/V1/Data/Category/MapperTest.php | 70 - .../Catalog/Service/V1/Data/ConverterTest.php | 129 - .../Data/Eav/AttributeMetadataBuilderTest.php | 200 - .../V1/Data/Eav/AttributeMetadataTest.php | 135 - .../Service/V1/Data/Eav/OptionTest.php | 44 - .../Service/V1/Data/ProductBuilderTest.php | 119 - .../Service/V1/Data/ProductMapperTest.php | 112 - .../Service/V1/MetadataServiceTest.php | 211 - .../Data/GalleryEntryContentValidatorTest.php | 167 - .../Media/Data/_files/magento_image.jpg | Bin 13873 -> 0 bytes .../Media/GalleryEntryResolverTest.php | 77 - .../Attribute/Media/ReadServiceTest.php | 473 -- .../Attribute/Media/WriteServiceTest.php | 325 -- .../Attribute/Option/ReadServiceTest.php | 77 - .../Attribute/Option/WriteServiceTest.php | 235 - .../V1/Product/Attribute/ReadServiceTest.php | 103 - .../V1/Product/Attribute/WriteServiceTest.php | 294 -- .../AttributeGroup/ReadServiceTest.php | 109 - .../AttributeGroup/WriteServiceTest.php | 223 - .../AttributeSet/AttributeServiceTest.php | 379 -- .../Product/AttributeSet/ReadServiceTest.php | 345 -- .../Product/AttributeSet/WriteServiceTest.php | 379 -- .../Data/Option/ConverterTest.php | 79 - .../Metadata/Converter/CompositeTest.php | 106 - .../Converter/DefaultConverterTest.php | 108 - .../Option/Metadata/Converter/SelectTest.php | 99 - .../Metadata/Reader/DefaultReaderTest.php | 74 - .../Option/Metadata/Reader/SelectTest.php | 89 - .../Data/Option/Metadata/ReaderTest.php | 80 - .../Product/CustomOptions/ReadServiceTest.php | 181 - .../CustomOptions/WriteServiceTest.php | 415 -- .../CollectionProvider/CrosssellTest.php | 37 - .../CollectionProvider/RelatedTest.php | 37 - .../CollectionProvider/UpsellTest.php | 37 - .../ProductLink/CollectionProviderTest.php | 115 - .../ProductLink/DataMapper/CompositeTest.php | 56 - .../ProductEntity/DefaultConverterTest.php | 68 - .../V1/Product/Link/LinkTypeResolverTest.php | 62 - .../V1/Product/Link/ReadServiceTest.php | 229 - .../V1/Product/Link/WriteServiceTest.php | 317 -- .../V1/Product/MetadataServiceTest.php | 162 - .../ProductLoadProcessorCompositeTest.php | 140 - .../Service/V1/Product/ProductLoaderTest.php | 84 - .../ProductSaveProcessorCompositeTest.php | 200 - .../Catalog/Service/V1/ProductServiceTest.php | 603 --- .../Model/Import/ProductTest.php | 39 +- .../Helper/MinsaleqtyTest.php | 19 +- .../Model/Adminhtml/Stock/ItemTest.php | 21 +- .../Model/Indexer/Stock/Action/FullTest.php | 2 +- .../CatalogInventory/Model/ObserverTest.php | 20 +- .../CatalogInventory/Model/Stock/ItemTest.php | 5 + .../Pricing/Price/CatalogRulePriceTest.php | 20 +- .../CatalogSearch/Block/ResultTest.php | 10 +- .../Magento/CatalogSearch/Helper/DataTest.php | 14 - .../Adapter/Mysql/Filter/PreprocessorTest.php | 314 ++ .../CatalogSearch/Model/AdvancedTest.php | 4 +- .../Catalog/ItemCollectionProviderTest.php | 55 + .../Model/Layer/Filter/AttributeTest.php | 378 ++ .../Model/Layer/Filter/CategoryTest.php | 334 ++ .../Model/Layer/Filter/DecimalTest.php | 225 + .../Model/Layer/Filter/PriceTest.php | 267 + .../Search/AvailabilityFlag/PluginTest.php | 189 - .../Model/Resource/EngineProviderTest.php | 93 - .../Model/Search/IndexBuilderTest.php | 204 + .../Model/Search/RequestGeneratorTest.php | 21 +- .../Model/CategoryUrlPathGeneratorTest.php | 2 +- .../Checkout/Model/Type/OnepageTest.php | 28 +- .../Service/V1/Item/WriteServiceTest.php | 16 +- .../V1/PaymentMethod/WriteServiceTest.php | 4 +- .../Model/Attribute/LockValidatorTest.php | 1 - .../Type/Configurable/AttributeTest.php | 151 + .../Plugin/Model/Resource/ProductTest.php | 68 + .../Pricing/Price/AttributePriceTest.php | 13 +- .../Magento/Contact/Helper/DataTest.php | 4 +- .../Magento/Core/Model/Layout/UpdateTest.php | 3 +- .../Core/Model/Resource/Db/AbstractTest.php | 12 +- .../Core/Model/Resource/SessionTest.php | 2 +- .../Core/Model/Theme/ThemeProviderTest.php | 2 +- .../Customer/Block/Account/CustomerTest.php | 6 +- .../Block/Account/Dashboard/InfoTest.php | 4 +- .../Block/Adminhtml/Edit/Tab/AccountTest.php | 61 +- .../Block/Adminhtml/Edit/Tab/ViewTest.php | 10 - .../Block/Widget/AbstractWidgetTest.php | 7 +- .../Magento/Customer/Block/Widget/DobTest.php | 53 +- .../Customer/Block/Widget/GenderTest.php | 119 +- .../Customer/Block/Widget/NameTest.php | 101 +- .../Customer/Block/Widget/TaxvatTest.php | 40 +- .../Controller/Account/ConfirmTest.php | 67 +- .../Controller/Account/CreatePostTest.php | 101 +- .../Controller/Account/LoginPostTest.php | 10 +- .../Adminhtml/Index/ResetPasswordTest.php | 67 +- .../Magento/Customer/Helper/AddressTest.php | 22 +- .../Session/CurrentCustomerAddressTest.php | 94 +- .../Helper/Session/CurrentCustomerTest.php | 14 +- .../Magento/Customer/Helper/ViewTest.php | 14 +- .../Model/Address/AbstractAddressTest.php | 13 +- .../Customer/Model/Address/ConverterTest.php | 30 +- .../Config/Source/Group/MultiselectTest.php | 7 +- .../Model/Config/Source/GroupTest.php | 9 +- .../Magento/Customer/Model/ConverterTest.php | 184 +- .../Model/Metadata/ElementFactoryTest.php | 4 +- .../Model/Metadata/Form/AbstractDataTest.php | 6 +- .../Metadata/Form/AbstractFormTestCase.php | 6 +- .../Metadata/Form/ExtendsAbstractData.php | 2 +- .../Customer/Model/Metadata/ValidatorTest.php | 6 +- .../Customer/Model/Resource/AddressTest.php | 10 + .../Group/Grid/ServiceCollectionTest.php | 49 +- .../Customer/Model/Resource/GroupTest.php | 26 +- .../Magento/Customer/Model/SessionTest.php | 28 +- .../Service/V1/CustomerAccountServiceTest.php | 29 +- .../Service/V1/CustomerAddressServiceTest.php | 25 +- .../V1/CustomerMetadataServiceTest.php | 8 +- .../Service/V1/Data/CustomerBuilderTest.php | 21 +- .../V1/Data/CustomerDetailsBuilderTest.php | 10 +- .../Service/V1/Data/CustomerDetailsTest.php | 13 +- .../Eav/AttributeMetadataConverterTest.php | 270 +- .../Eav/AttributeMetadataDataProviderTest.php | 2 +- .../Import/CustomerComposite/DataTest.php | 2 +- .../Directory/Model/PriceCurrencyTest.php | 22 + .../Block/Catalog/Product/LinksTest.php | 23 +- .../Downloadable/Helper/DownloadTest.php | 62 +- .../Plugin/DownloadableTest.php | 75 +- .../Pricing/Price/LinkPriceTest.php | 20 +- .../Model/Attribute/GroupRepositoryTest.php | 369 ++ .../Eav/Model/AttributeManagementTest.php | 394 ++ .../Eav/Model/AttributeSetManagementTest.php | 122 + .../Eav/Model/AttributeSetRepositoryTest.php | 250 + .../Magento/Eav/Model/Entity/AbstractTest.php | 4 +- .../Entity/Attribute/OptionManagementTest.php | 398 ++ .../Collection/AbstractCollectionTest.php | 2 +- .../Attribute/Option/CollectionTest.php | 2 +- .../Model/Resource/Entity/AttributeTest.php | 16 +- .../Api/Code/Generator/DataBuilderTest.php | 80 - .../Api/Code/Generator/MapperTest.php | 58 - .../Generator/SearchResultsBuilderTest.php | 115 - .../Api/Code/Generator/SearchResultsTest.php | 115 - .../Framework/Api/Config/ConverterTest.php | 2 +- .../Api/Config/_files/data_object_valid.xml | 2 +- .../Api/SimpleDataObjectConverterTest.php | 49 +- .../Magento/Framework/App/AreaListTest.php | 20 +- .../Framework/App/Arguments/LoaderTest.php | 72 - .../Framework/App/Arguments/_files/local.xml | 58 - .../_files/other/local_developer.xml | 47 - .../Magento/Framework/App/ArgumentsTest.php | 142 - .../Magento/Framework/App/BootstrapTest.php | 24 +- .../Framework/App/Cache/Frontend/PoolTest.php | 39 +- .../App/Cache/Type/FrontendPoolTest.php | 38 +- .../DeploymentConfig/BackendConfigTest.php | 72 + .../App/DeploymentConfig/CacheConfigTest.php | 85 + .../App/DeploymentConfig/DbConfigTest.php | 145 + .../DeploymentConfig/EncryptConfigTest.php | 50 + .../DeploymentConfig/InstallConfigTest.php | 51 + .../App/DeploymentConfig/ReaderTest.php | 85 + .../DeploymentConfig/ResourceConfigTest.php | 91 + .../DeploymentConfig/SessionConfigTest.php | 64 + .../Writer/PhpFormatterTest.php | 24 +- .../App/DeploymentConfig/WriterTest.php | 113 + .../App/DeploymentConfig/_files/config.php | 12 +- .../App/DeploymentConfig/_files/custom.php | 10 +- .../Framework/App/DeploymentConfigTest.php | 138 + .../App/Resource/Config/ReaderTest.php | 2 +- .../App/Resource/ConnectionFactoryTest.php | 193 - .../Magento/Framework/App/ResourceTest.php | 277 +- .../Framework/App/StaticResourceTest.php | 12 +- .../_files/local.php => _files/config.php} | 8 +- .../_files/other/local_developer.php | 8 +- .../_files/other/local_developer_merged.php | 10 +- .../Cache/Config/_files/cache_config.php | 2 +- .../Cache/Config/_files/cache_config.xml | 2 +- .../Framework/DB/Adapter/Pdo/MysqlTest.php | 30 +- .../Magento/Framework/DB/Logger/FileTest.php | 161 + .../Data/Form/Element/AbstractElementTest.php | 3 +- .../Framework/Encryption/EncryptorTest.php | 16 +- .../Framework/Filesystem/Driver/HttpsTest.php | 40 + .../Magento/Framework/FilesystemTest.php | 32 +- .../testsuite/Magento/Framework/FlagTest.php | 4 +- .../Framework/Model/AbstractModelTest.php | 37 +- .../Model/Resource/Db/AbstractDbTest.php | 7 +- .../Type/Db/ConnectionFactoryTest.php | 41 +- .../Model/Resource/Type/Db/Pdo/MysqlTest.php | 106 + .../Module/Declaration/Converter/DomTest.php | 9 +- .../_files/converted_valid_module.php | 10 +- .../Converter/_files/valid_module.xml | 4 +- .../Module/Declaration/FileResolverTest.php | 90 - .../Declaration/Reader/FilesystemTest.php | 121 - .../Module/DependencyManagerTest.php | 172 - .../Framework/Module/Dir/ReaderTest.php | 9 +- .../Module/Dir/ReverseResolverTest.php | 13 +- .../Magento/Framework/Module/ManagerTest.php | 18 +- .../ModuleList/DeploymentConfigTest.php | 65 + .../Module/ModuleList/LoaderTest.php | 111 + .../Framework/Module/ModuleListTest.php | 136 +- .../Module/Plugin/DbStatusValidatorTest.php | 7 +- .../Framework/Module/Setup/MigrationTest.php | 21 +- .../Magento/Framework/Module/SetupTest.php | 122 + .../Magento/Framework/Module/UpdaterTest.php | 3 +- .../Framework/Mview/View/ChangelogTest.php | 6 +- .../Code/Generator/GenerateRepositoryTest.php | 16 +- .../Code/Generator/RepositoryTest.php | 10 +- .../Generator/_files/SampleRepository.txt | 110 +- .../Pricing/Price/AbstractPriceTest.php | 19 +- .../Pricing/Render/AbstractAdjustmentTest.php | 17 + .../Framework/Pricing/Render/AmountTest.php | 6 +- .../Framework/RequireJs/ConfigTest.php | 18 +- .../Search/Adapter/Mysql/AdapterTest.php | 1 - .../Mysql/Aggregation/Builder/RangeTest.php | 88 +- .../Mysql/Aggregation/Builder/TermTest.php | 44 +- .../Adapter/Mysql/Aggregation/BuilderTest.php | 14 +- .../Adapter/Mysql/ConditionManagerTest.php | 3 - .../Search/Adapter/Mysql/DimensionsTest.php | 11 +- .../Mysql/Filter/Builder/RangeTest.php | 12 +- .../Search/Adapter/Mysql/MapperTest.php | 45 +- .../Search/Dynamic/IntervalFactoryTest.php | 145 + .../Framework/Search/Request/BinderTest.php | 11 +- .../Magento/Framework/Session/ConfigTest.php | 15 + .../Session/SaveHandler/DbTableTest.php | 8 +- .../Framework/Simplexml/ElementTest.php | 24 + .../Test}/Utility/AggregateInvokerTest.php | 4 +- .../Framework/Test}/Utility/FilesTest.php | 2 +- .../Test}/Utility/_files/foo/bar/one.txt | 0 .../Utility/_files/foo/bar/recursive/one.txt | 0 .../Utility/_files/foo/bar/recursive/two.txt | 0 .../Test}/Utility/_files/foo/bar/two.txt | 0 .../Test}/Utility/_files/foo/baz/one.txt | 0 .../Test}/Utility/_files/foo/baz/two.txt | 0 .../Test}/Utility/_files/foo/one.txt | 0 .../Test}/Utility/_files/foo/two.txt | 0 .../Utility/_files/list_corrupted_dir.txt | 0 .../Utility/_files/list_corrupted_file.txt | 0 .../Test}/Utility/_files/list_good.txt | 0 .../Magento/Framework/TranslateTest.php | 5 +- .../Design/Theme/FlyweightFactoryTest.php | 4 +- .../Decorator/ModuleDependencyTest.php | 16 +- .../Model/Attribute/TaxTest.php | 36 +- .../Composite/Fieldset/GroupedTest.php | 2 +- .../Model/Product/Type/GroupedTest.php | 12 + .../Pricing/Price/FinalPriceTest.php | 10 +- .../CollectionProvider/GroupedTest.php | 2 + .../ProductEntity/ConverterTest.php | 5 +- .../Service/V1/CustomerTokenServiceTest.php | 10 +- .../Block/NavigationTest.php | 11 +- .../Customer/Edit/Tab/View/StatusTest.php | 6 +- .../Magento/Log/Model/VisitorTest.php | 2 - .../Magento/Msrp/Helper/DataTest.php | 105 + .../Msrp/Pricing/Price/MsrpPriceTest.php | 9 + .../Type/Multishipping/PluginTest.php | 74 + .../Model/Cart/SalesModel/OrderTest.php | 58 +- .../Magento/Paypal/Controller/ExpressTest.php | 4 +- .../Paypal/Model/Express/CheckoutTest.php | 28 +- .../Model/Observer/EmulateCustomerTest.php | 2 +- .../Model/Observer/EmulateQuoteTest.php | 2 +- .../Persistent/Model/Observer/SessionTest.php | 2 +- .../Observer/UpdateCustomerCookiesTest.php | 2 +- .../Magento/Persistent/Model/SessionTest.php | 3 +- .../Review/Block/Adminhtml/MainTest.php | 27 +- .../Review/Summary/CollectionTest.php | 2 +- .../Model/Condition/AbstractConditionTest.php | 139 +- .../Condition/Product/AbstractProductTest.php | 435 ++ .../Adminhtml/Order/Create/Items/GridTest.php | 1 + .../Sales/Model/AdminOrder/CreateTest.php | 25 +- .../Observer/Backend/CustomerQuoteTest.php | 8 +- .../Quote/Address/CollectTotalsTest.php | 71 +- .../Sales/Model/OrderConverterTest.php | 486 -- .../Magento/Sales/Model/OrderTest.php | 74 +- .../Model/Quote/Item/AbstractItemTest.php | 128 + .../Model/Resource/Order/AddressTest.php | 29 +- .../Resource/Order/Creditmemo/CommentTest.php | 5 +- .../Resource/Order/Handler/AddressTest.php | 10 +- .../Resource/Order/Invoice/CommentTest.php | 5 +- .../Resource/Order/Shipment/CommentTest.php | 5 +- .../Resource/Order/Shipment/TrackTest.php | 4 +- .../Resource/Order/Status/HistoryTest.php | 6 +- .../Sales/Model/Resource/Order/StatusTest.php | 2 +- .../Sales/Model/Resource/OrderTest.php | 20 +- .../Model/Service/CreditmemoServiceTest.php | 214 + .../Model/Service/InvoiceServiceTest.php | 254 + .../Sales/Model/Service/OrderServiceTest.php | 244 + .../Model/Service/ShipmentServiceTest.php | 227 + .../V1/Action/CreditmemoAddCommentTest.php | 93 - .../V1/Action/CreditmemoCancelTest.php | 84 - .../V1/Action/CreditmemoCommentsListTest.php | 197 - .../V1/Action/CreditmemoCreateTest.php | 143 - .../Service/V1/Action/CreditmemoEmailTest.php | 94 - .../Service/V1/Action/CreditmemoGetTest.php | 113 - .../Service/V1/Action/CreditmemoListTest.php | 154 - .../V1/Action/InvoiceAddCommentTest.php | 93 - .../Service/V1/Action/InvoiceCaptureTest.php | 84 - .../V1/Action/InvoiceCommentsListTest.php | 197 - .../Service/V1/Action/InvoiceCreateTest.php | 120 - .../Service/V1/Action/InvoiceEmailTest.php | 92 - .../Service/V1/Action/InvoiceGetTest.php | 110 - .../Service/V1/Action/InvoiceListTest.php | 150 - .../Service/V1/Action/InvoiceVoidTest.php | 84 - .../V1/Action/OrderAddressUpdateTest.php | 85 - .../Service/V1/Action/OrderCancelTest.php | 84 - .../V1/Action/OrderCommentsListTest.php | 197 - .../Service/V1/Action/OrderEmailTest.php | 64 - .../Service/V1/Action/OrderGetStatusTest.php | 80 - .../Sales/Service/V1/Action/OrderGetTest.php | 124 - .../Sales/Service/V1/Action/OrderHoldTest.php | 81 - .../Sales/Service/V1/Action/OrderListTest.php | 150 - .../V1/Action/OrderStatusHistoryAddTest.php | 96 - .../Service/V1/Action/OrderUnHoldTest.php | 81 - .../V1/Action/ShipmentAddCommentTest.php | 93 - .../V1/Action/ShipmentAddTrackTest.php | 93 - .../V1/Action/ShipmentCommentsListTest.php | 197 - .../Service/V1/Action/ShipmentCreateTest.php | 130 - .../Service/V1/Action/ShipmentEmailTest.php | 64 - .../Service/V1/Action/ShipmentGetTest.php | 117 - .../V1/Action/ShipmentLabelGetTest.php | 81 - .../Service/V1/Action/ShipmentListTest.php | 150 - .../V1/Action/ShipmentRemoveTrackTest.php | 83 - .../Sales/Service/V1/CreditmemoReadTest.php | 121 - .../Sales/Service/V1/CreditmemoWriteTest.php | 148 - .../Sales/Service/V1/Data/CommentTest.php | 123 - .../V1/Data/CreditmemoConverterTest.php | 80 - .../Service/V1/Data/CreditmemoItemTest.php | 555 -- .../Service/V1/Data/CreditmemoMapperTest.php | 127 - .../Sales/Service/V1/Data/CreditmemoTest.php | 817 --- .../Service/V1/Data/InvoiceConverterTest.php | 121 - .../Sales/Service/V1/Data/InvoiceItemTest.php | 411 -- .../Service/V1/Data/InvoiceMapperTest.php | 127 - .../Sales/Service/V1/Data/InvoiceTest.php | 753 --- .../Service/V1/Data/OrderAddressTest.php | 443 -- .../Sales/Service/V1/Data/OrderItemTest.php | 1537 ------ .../Sales/Service/V1/Data/OrderMapperTest.php | 198 - .../Service/V1/Data/OrderPaymentTest.php | 897 ---- .../V1/Data/OrderStatusHistoryTest.php | 155 - .../Sales/Service/V1/Data/OrderTest.php | 2242 -------- .../Service/V1/Data/ShipmentConverterTest.php | 90 - .../Service/V1/Data/ShipmentItemTest.php | 219 - .../Service/V1/Data/ShipmentMapperTest.php | 167 - .../Sales/Service/V1/Data/ShipmentTest.php | 267 - .../Service/V1/Data/ShipmentTrackTest.php | 203 - .../Service/V1/Data/TransactionMapperTest.php | 257 - .../Sales/Service/V1/InvoiceReadTest.php | 121 - .../Sales/Service/V1/InvoiceWriteTest.php | 172 - .../Sales/Service/V1/OrderReadTest.php | 146 - .../Sales/Service/V1/OrderWriteTest.php | 224 - .../Sales/Service/V1/ShipmentReadTest.php | 146 - .../Sales/Service/V1/ShipmentWriteTest.php | 174 - .../Sales/Service/V1/TransactionReadTest.php | 131 - .../SalesRule/Model/Quote/DiscountTest.php | 110 +- .../Model/Resource/Report/RuleTest.php | 2 +- .../Adminhtml/Order/Shipment/AddTrackTest.php | 9 +- .../Adminhtml/Order/ShipmentLoaderTest.php | 4 +- .../Magento/Sitemap/Model/SitemapTest.php | 10 +- .../Tax/IgnoreTaxNotificationTest.php | 85 + .../testsuite/Magento/Tax/Helper/DataTest.php | 482 -- .../Model/Calculation/Rate/ConverterTest.php | 357 +- .../Model/Calculation/RateRepositoryTest.php | 296 ++ .../Tax/Model/Calculation/RateTest.php | 2 +- .../RowBaseAndTotalBaseCalculatorTestCase.php | 86 +- .../Calculation/RowBaseCalculatorTest.php | 27 +- .../Calculation/TotalBaseCalculatorTest.php | 38 +- .../Calculation/UnitBaseCalculatorTest.php | 55 +- .../Magento/Tax/Model/Config/TaxClassTest.php | 89 + .../Model/Sales/Order/TaxManagementTest.php | 207 + .../Total/Quote/CommonTaxCollectorTest.php | 105 +- .../Model/Sales/Total/Quote/ShippingTest.php | 474 +- .../Model/Sales/Total/Quote/SubtotalTest.php | 456 +- .../Tax/Model/Sales/Total/Quote/TaxTest.php | 142 +- .../Magento/Tax/Model/TaxCalculationTest.php | 267 + .../Tax/Model/TaxClass/ManagementTest.php | 132 + .../Tax/Model/TaxClass/RepositoryTest.php | 214 + .../Tax/Model/TaxClass/Type/CustomerTest.php | 6 +- .../Tax/Model/TaxRuleRepositoryTest.php | 155 + .../Price/Plugin/AttributePriceTest.php | 11 +- .../Tax/Pricing/Render/AdjustmentTest.php | 4 +- .../Tax/Service/V1/OrderTaxServiceTest.php | 356 -- .../Service/V1/TaxCalculationServiceTest.php | 419 -- .../Tax/Service/V1/TaxClassServiceTest.php | 657 --- .../Tax/Service/V1/TaxRateServiceTest.php | 633 --- .../Tax/Service/V1/TaxRuleServiceTest.php | 713 --- .../Tools/I18n/{Code => }/ContextTest.php | 8 +- .../{Code => }/Dictionary/GeneratorTest.php | 46 +- .../Loader/File/AbstractFileTest.php | 28 +- .../Options/ResolverFactoryTest.php | 12 +- .../Dictionary/Options/ResolverTest.php | 10 +- .../Options/_files/source/app/code/.gitignore | 0 .../_files/source/app/design/.gitignore | 0 .../_files/source/lib/web/mage/.gitignore | 0 .../_files/source/lib/web/varien/.gitignore | 0 .../I18n/{Code => }/Dictionary/PhraseTest.php | 8 +- .../Dictionary/Writer/Csv/StdoTest.php | 6 +- .../{Code => }/Dictionary/Writer/CsvTest.php | 20 +- .../Dictionary/Writer/_files/.gitignore | 0 .../Tools/I18n/{Code => }/DictionaryTest.php | 16 +- .../Tools/I18n/{Code => }/FactoryTest.php | 14 +- .../I18n/{Code => }/FilesCollectorTest.php | 8 +- .../Test/Tools/I18n/{Code => }/LocaleTest.php | 4 +- .../I18n/{Code => }/Pack/GeneratorTest.php | 34 +- .../{Code => }/Parser/AbstractParserTest.php | 8 +- .../Parser/Adapter/AbstractAdapterTest.php | 6 +- .../I18n/{Code => }/Parser/Adapter/JsTest.php | 8 +- .../{Code => }/Parser/Adapter/PhpTest.php | 10 +- .../{Code => }/Parser/Adapter/XmlTest.php | 6 +- .../Parser/Adapter/_files/default.xml | 0 .../{Code => }/Parser/Adapter/_files/file.js | 0 .../I18n/{Code => }/Parser/ParserTest.php | 14 +- .../_files/files_collector/default.xml | 0 .../{Code => }/_files/files_collector/file.js | 0 .../Theme/Model/Config/CustomizationTest.php | 2 +- .../Ui/Component/Control/ActionPoolTest.php | 161 + .../Ui/Component/Control/ButtonTest.php | 86 + .../Ui/Component/Control/ContainerTest.php | 71 + .../Magento/Ui/Component/FilterPoolTest.php | 424 ++ .../Magento/Ui/Component/FilterTest.php | 211 + .../Magento/Ui/Component/ListingTest.php | 215 + .../MassActionTest.php} | 39 +- .../ViewTest.php => Component/PagingTest.php} | 97 +- .../SortingTest.php} | 40 +- .../{Builders => Builder}/ConfigJsonTest.php | 4 +- .../ConfigStorageJsonTest.php | 25 +- .../Ui/Context/ConfigurationStorageTest.php | 174 + .../Magento/Ui/Context/ConfigurationTest.php | 88 + .../Controller/Adminhtml/Index/RenderTest.php | 102 + .../Magento/Weee/Pricing/AdjustmentTest.php | 23 +- .../Widget/Model/Config/FileResolverTest.php | 89 + .../Magento/Wishlist/Block/Rss/LinkTest.php | 3 +- .../Wishlist/Model/Rss/WishlistTest.php | 2 +- .../Magento/Wishlist/Model/WishlistTest.php | 6 - .../generate/framework-dependencies.php | 4 +- .../modules-circular-dependencies.php | 4 +- .../generate/modules-dependencies.php | 4 +- .../Magento/Tools/I18n/{Code => }/Context.php | 2 +- .../Tools/I18n/{Code => }/Dictionary.php | 8 +- .../I18n/{Code => }/Dictionary/Generator.php | 14 +- .../Dictionary/Loader/File/AbstractFile.php | 12 +- .../{Code => }/Dictionary/Loader/File/Csv.php | 4 +- .../Dictionary/Loader/FileInterface.php | 4 +- .../Dictionary/Options/Resolver.php | 2 +- .../Dictionary/Options/ResolverFactory.php | 4 +- .../Dictionary/Options/ResolverInterface.php | 2 +- .../I18n/{Code => }/Dictionary/Phrase.php | 2 +- .../I18n/{Code => }/Dictionary/Writer/Csv.php | 6 +- .../{Code => }/Dictionary/Writer/Csv/Stdo.php | 4 +- .../{Code => }/Dictionary/WriterInterface.php | 2 +- .../Magento/Tools/I18n/{Code => }/Factory.php | 14 +- .../Tools/I18n/{Code => }/FilesCollector.php | 2 +- .../Magento/Tools/I18n/{Code => }/Locale.php | 2 +- .../Tools/I18n/{Code => }/Pack/Generator.php | 22 +- .../Pack/Writer/File/AbstractFile.php | 20 +- .../I18n/{Code => }/Pack/Writer/File/Csv.php | 6 +- .../I18n/{Code => }/Pack/WriterInterface.php | 10 +- .../I18n/{Code => }/Parser/AbstractParser.php | 18 +- .../Parser/Adapter/AbstractAdapter.php | 8 +- .../I18n/{Code => }/Parser/Adapter/Js.php | 2 +- .../I18n/{Code => }/Parser/Adapter/Php.php | 8 +- .../Parser/Adapter/Php/Tokenizer.php | 8 +- .../Adapter/Php/Tokenizer/PhraseCollector.php | 8 +- .../Parser/Adapter/Php/Tokenizer/Token.php | 2 +- .../Tokenizer/Translate/MethodCollector.php | 6 +- .../I18n/{Code => }/Parser/Adapter/Xml.php | 2 +- .../{Code => }/Parser/AdapterInterface.php | 2 +- .../I18n/{Code => }/Parser/Contextual.php | 16 +- .../Tools/I18n/{Code => }/Parser/Parser.php | 2 +- .../Tools/I18n/{Code => }/ParserInterface.php | 2 +- .../Tools/I18n/{Code => }/ServiceLocator.php | 26 +- dev/tools/Magento/Tools/I18n/generator.php | 2 +- dev/tools/Magento/Tools/I18n/pack.php | 2 +- .../Magento/Tools/Migration/factory_names.php | 12 +- .../Tools/Migration/factory_table_names.php | 2 +- .../Tools/Migration/get_aliases_map.php | 9 +- .../Magento/Tools/Migration/themes_view.php | 4 +- dev/tools/Magento/Tools/View/Deployer.php | 2 +- dev/tools/Magento/Tools/View/deploy.php | 2 +- index.php | 5 +- .../Api/AbstractSimpleObjectBuilder.php | 2 +- .../Magento/Framework/Api/Builder.php | 7 +- .../Framework/Api/ExtensibleDataInterface.php | 2 +- .../Api/ExtensibleDataObjectConverter.php | 58 +- .../Magento/Framework/Api/ObjectFactory.php | 2 +- .../Api/SimpleDataObjectConverter.php | 22 +- .../Magento/Framework/App/AreaList.php | 18 +- .../Magento/Framework/App/Arguments.php | 190 - .../App/Arguments/ArgumentInterpreter.php | 1 - .../Framework/App/Arguments/Loader.php | 108 - .../Magento/Framework/App/Bootstrap.php | 32 +- .../Framework/App/Cache/Frontend/Pool.php | 19 +- .../Framework/App/Cache/Type/FrontendPool.php | 19 +- .../Framework/App/DeploymentConfig.php | 175 + .../App/DeploymentConfig/AbstractSegment.php | 94 + .../App/DeploymentConfig/BackendConfig.php | 63 + .../App/DeploymentConfig/CacheConfig.php | 106 + .../App/DeploymentConfig/DbConfig.php | 134 + .../App/DeploymentConfig/EncryptConfig.php | 42 +- .../App/DeploymentConfig/InstallConfig.php | 37 +- .../Framework/App/DeploymentConfig/Reader.php | 94 + .../App/DeploymentConfig/ResourceConfig.php | 81 + .../App/DeploymentConfig/SegmentInterface.php | 22 +- .../App/DeploymentConfig/SessionConfig.php | 65 + .../Framework/App/DeploymentConfig/Writer.php | 130 + .../Writer/FormatterInterface.php | 17 +- .../DeploymentConfig/Writer/PhpFormatter.php | 39 + .../Framework/App/ObjectManagerFactory.php | 50 +- .../Magento/Framework/App/Resource.php | 76 +- .../Resource/ConnectionAdapterInterface.php | 5 +- .../App/Resource/ConnectionFactory.php | 50 +- .../Framework/App/Router/ActionList.php | 25 +- lib/internal/Magento/Framework/App/State.php | 1 - .../Magento/Framework/App/StaticResource.php | 13 +- .../Magento/Framework/AppInterface.php | 2 +- .../Magento/Framework/Config/Data.php | 9 +- lib/internal/Magento/Framework/Config/Dom.php | 9 +- .../Framework/DB/Adapter/AdapterInterface.php | 1 + .../Framework/DB/Adapter/Pdo/Mysql.php | 196 +- .../Magento/Framework/DB/Logger/File.php | 98 + .../Framework/DB/Logger/LoggerAbstract.php | 119 + .../Magento/Framework/DB/Logger/Null.php | 55 + .../Magento/Framework/DB/LoggerInterface.php | 66 + .../Data/Form/Element/AbstractElement.php | 3 +- .../Framework/Data/Form/Element/Checkbox.php | 13 +- .../Framework/Data/Form/Element/Multiline.php | 12 +- .../Data/Form/Element/Multiselect.php | 12 +- .../Framework/Data/Form/Element/Obscure.php | 3 +- .../Framework/Data/Form/Element/Select.php | 12 +- .../Framework/Data/Form/Element/Text.php | 3 +- .../Framework/Data/Form/Element/Textarea.php | 3 +- .../Framework/Encryption/Encryptor.php | 10 +- lib/internal/Magento/Framework/Filesystem.php | 41 +- .../Framework/Filesystem/Driver/Http.php | 47 +- .../Framework/Filesystem/Driver/Https.php | 31 + lib/internal/Magento/Framework/Flag.php | 8 +- .../Model/AbstractExtensibleModel.php | 39 +- .../Magento/Framework/Model/AbstractModel.php | 68 +- .../Model/Resource/Db/AbstractDb.php | 121 +- .../Resource/Type/Db/ConnectionFactory.php | 38 +- .../Type/Db/ConnectionFactoryInterface.php | 38 + .../Model/Resource/Type/Db/Pdo/Mysql.php | 109 +- .../Magento/Framework/Module/DataSetup.php | 481 ++ .../Module/Declaration/Converter/Dom.php | 24 +- .../Module/Declaration/FileResolver.php | 103 - .../Module/Declaration/Reader/Filesystem.php | 174 - .../Framework/Module/DependencyManager.php | 142 - .../Module/DependencyManagerInterface.php | 50 - .../Magento/Framework/Module/Dir/Reader.php | 4 +- .../Framework/Module/Dir/ReverseResolver.php | 2 +- .../Magento/Framework/Module/Manager.php | 4 +- .../Magento/Framework/Module/ModuleList.php | 129 +- .../Module/ModuleList/DeploymentConfig.php | 62 + .../Framework/Module/ModuleList/Loader.php | 143 + .../Framework/Module/ModuleListInterface.php | 31 +- .../Module/Plugin/DbStatusValidator.php | 2 +- .../Magento/Framework/Module/Resource.php | 12 +- .../Framework/Module/ResourceInterface.php | 18 +- .../Magento/Framework/Module/Setup.php | 474 +- .../Framework/Module/Setup/Context.php | 18 +- .../Framework/Module/Setup/Migration.php | 2 +- .../Magento/Framework/Module/Updater.php | 2 +- .../Magento/Framework/Module/etc/module.xsd | 1 - .../Magento/Framework/Oauth/Oauth.php | 5 +- .../Object/KeyValueObjectInterface.php | 45 + .../Code/Generator/Persistor.php | 518 ++ .../Code/Generator/Repository.php | 288 +- .../Framework/ObjectManager/Config/Config.php | 16 +- .../ObjectManager/DefinitionFactory.php | 2 + .../Pricing/Amount/AmountInterface.php | 2 +- .../Framework/Pricing/Price/AbstractPrice.php | 30 +- .../Pricing/PriceCurrencyInterface.php | 33 +- .../Pricing/Render/AbstractAdjustment.php | 16 + .../Framework/Pricing/Render/Amount.php | 6 +- .../Framework/Reflection/TypeProcessor.php | 6 +- .../Magento/Framework/RequireJs/Config.php | 28 +- .../Adapter/Mysql/Aggregation/Builder.php | 23 +- .../Aggregation/Builder/BucketInterface.php | 15 +- .../Mysql/Aggregation/Builder/Dynamic.php | 54 +- .../Mysql/Aggregation/Builder/Range.php | 29 +- .../Mysql/Aggregation/Builder/Term.php | 18 +- .../Aggregation/DataProviderInterface.php | 50 +- .../Adapter/Mysql/Aggregation/Interval.php | 153 + .../Mysql/Aggregation/IntervalFactory.php | 40 +- .../Search/Adapter/Mysql/Dimensions.php | 4 +- .../Adapter/Mysql/Filter/Builder/Range.php | 2 +- .../Adapter/Mysql/IndexBuilderInterface.php | 41 + .../Framework/Search/Adapter/Mysql/Mapper.php | 44 +- .../Framework/Search/Dynamic/Algorithm.php | 89 +- .../Dynamic/Algorithm/AbstractAlgorithm.php | 43 + .../Dynamic/Algorithm/AlgorithmInterface.php | 37 + .../Search/Dynamic/Algorithm/Auto.php | 92 + .../Search/Dynamic/Algorithm/Improved.php | 82 + .../Search/Dynamic/Algorithm/Manual.php | 68 + .../Search/Dynamic/Algorithm/Repository.php | 86 + .../Magento/Framework/Search/Request.php | 8 - .../Request/Aggregation/DynamicBucket.php | 2 +- .../Framework/Search/Request/Binder.php | 1 + .../Framework/Search/Request/Dimension.php | 1 - .../Framework/Search/RequestInterface.php | 7 - .../Magento/Framework/Session/Config.php | 22 +- .../Magento/Framework/Session/SaveHandler.php | 12 +- .../Magento/Framework/Simplexml/Element.php | 16 + .../Test}/Utility/AggregateInvoker.php | 4 +- .../Framework/Test}/Utility/Classes.php | 12 +- .../Magento/Framework/Test}/Utility/Files.php | 13 +- lib/internal/Magento/Framework/Translate.php | 4 +- .../Magento/Framework/View/Context.php | 15 - .../Element/UiComponent/ConfigFactory.php | 2 +- .../UiComponent/ConfigStorageInterface.php | 101 +- .../View/Element/UiComponent/Context.php | 28 +- .../UiComponent/DataProviderInterface.php | 18 +- .../View/Element/UiComponentFactory.php | 42 +- .../View/Element/UiComponentInterface.php | 34 +- .../View/Element/UiElementFactory.php | 77 + .../Collector/Decorator/ModuleDependency.php | 5 +- .../Framework/View/Layout/Argument/Parser.php | 2 +- .../View/Layout/Generator/Container.php | 1 + .../View/Layout/ScheduledStructure/Helper.php | 7 +- .../Framework/View/Layout/etc/elements.xsd | 1 + .../Magento/Framework/View/Result/Page.php | 48 +- lib/internal/Magento/Framework/composer.json | 7 +- lib/web/app-config.js | 19 +- lib/web/css/docs/actions-toolbar.html | 65 +- lib/web/css/docs/breadcrumbs.html | 269 +- lib/web/css/docs/buttons.html | 504 +- lib/web/css/docs/docs.css | 2480 +++++---- lib/web/css/docs/docs.html | 11 +- lib/web/css/docs/dropdowns.html | 246 +- lib/web/css/docs/forms.html | 2171 ++++---- lib/web/css/docs/icons.html | 214 +- lib/web/css/docs/index.html | 22 +- lib/web/css/docs/layout.html | 82 +- lib/web/css/docs/lib.html | 6 +- lib/web/css/docs/loaders.html | 44 +- lib/web/css/docs/messages.html | 412 +- lib/web/css/docs/navigation.html | 478 -- lib/web/css/docs/pages.html | 396 +- lib/web/css/docs/popups.html | 285 +- lib/web/css/docs/rating.html | 84 +- lib/web/css/docs/resets.html | 6 +- lib/web/css/docs/responsive.html | 58 + lib/web/css/docs/sections.html | 196 +- lib/web/css/docs/source/README.md | 16 +- lib/web/css/docs/source/actions-toolbar.less | 59 +- lib/web/css/docs/source/breadcrumbs.less | 264 +- lib/web/css/docs/source/buttons.less | 516 +- lib/web/css/docs/source/docs.less | 6 +- lib/web/css/docs/source/dropdowns.less | 256 +- lib/web/css/docs/source/forms.less | 271 +- lib/web/css/docs/source/icons.less | 212 +- lib/web/css/docs/source/js/dropdown.js | 79 + lib/web/css/docs/source/layout.less | 65 +- lib/web/css/docs/source/loaders.less | 20 + lib/web/css/docs/source/messages.less | 310 +- lib/web/css/docs/source/navigation.less | 508 -- lib/web/css/docs/source/pages.less | 390 +- lib/web/css/docs/source/popups.less | 133 +- lib/web/css/docs/source/rating.less | 16 +- lib/web/css/docs/source/responsive.less | 97 + lib/web/css/docs/source/sections.less | 188 +- lib/web/css/docs/source/tables.less | 260 +- lib/web/css/docs/source/tooltips.less | 131 +- lib/web/css/docs/source/typography.less | 177 +- lib/web/css/docs/source/utilities.less | 358 ++ lib/web/css/docs/source/variables.less | 3441 +++++++------ lib/web/css/docs/tables.html | 269 +- lib/web/css/docs/tooltips.html | 137 +- lib/web/css/docs/typography.html | 173 +- lib/web/css/docs/utilities.html | 261 + lib/web/css/docs/variables.html | 3443 ++++++------- lib/web/css/source/lib/breadcrumbs.less | 31 +- lib/web/css/source/lib/buttons.less | 5 +- lib/web/css/source/lib/dropdowns.less | 12 +- lib/web/css/source/lib/forms.less | 47 +- lib/web/css/source/lib/layout.less | 9 +- lib/web/css/source/lib/loaders.less | 6 +- lib/web/css/source/lib/navigation.less | 6 +- lib/web/css/source/lib/popups.less | 4 +- lib/web/css/source/lib/resets.less | 18 +- lib/web/css/source/lib/sections.less | 8 +- lib/web/css/source/lib/tables.less | 205 +- lib/web/css/source/lib/tooltips.less | 8 +- lib/web/css/source/lib/typography.less | 68 +- lib/web/css/source/lib/utilities.less | 172 +- lib/web/css/source/lib/variables.less | 142 +- lib/web/mage/accordion.js | 7 +- lib/web/mage/adminhtml/grid.js | 1 + lib/web/mage/adminhtml/varienLoader.js | 24 +- lib/web/mage/apply/main.js | 142 +- lib/web/mage/apply/registry.js | 26 +- lib/web/mage/backend/action-link.js | 6 +- lib/web/mage/backend/bootstrap.js | 6 +- lib/web/mage/backend/button.js | 2 + lib/web/mage/backend/components.js | 76 - lib/web/mage/backend/floating-header.js | 3 +- lib/web/mage/backend/form.js | 2 + lib/web/mage/backend/menu.js | 4 + lib/web/mage/backend/notification.js | 8 +- lib/web/mage/backend/suggest.js | 39 +- lib/web/mage/backend/tabs.js | 2 + lib/web/mage/backend/tree-suggest.js | 2 + lib/web/mage/backend/validation.js | 63 +- lib/web/mage/bootstrap.js | 10 +- lib/web/mage/calendar.css | 2 +- lib/web/mage/calendar.js | 5 + lib/web/mage/collapsible.js | 14 +- lib/web/mage/components.js | 132 - lib/web/mage/dataPost.js | 4 +- lib/web/mage/deletable-item.js | 5 +- lib/web/mage/dialog.js | 2 + lib/web/mage/dropdown.js | 2 + lib/web/mage/dropdown_old.js | 3 + lib/web/mage/dropdowns.js | 8 +- lib/web/mage/edit-trigger.js | 2 + lib/web/mage/fieldset-controls.js | 4 + lib/web/mage/gallery-fullscreen.js | 2 + lib/web/mage/gallery.js | 2 + lib/web/mage/gallery.less | 12 +- lib/web/mage/ie-class-fixer.js | 44 + lib/web/mage/item-table.js | 3 +- lib/web/mage/list.js | 3 +- lib/web/mage/loader.js | 6 +- lib/web/mage/loader_old.js | 7 + lib/web/mage/mage.js | 237 +- lib/web/mage/menu.js | 15 +- lib/web/mage/popup-window.js | 3 +- lib/web/mage/redirect-url.js | 4 +- lib/web/mage/requirejs/resolver.js | 60 +- lib/web/mage/smart-keyboard-handler.js | 36 +- lib/web/mage/sticky.js | 8 +- lib/web/mage/tabs.js | 9 +- lib/web/mage/terms.js | 3 + lib/web/mage/toggle.js | 3 +- lib/web/mage/tooltip.js | 2 + lib/web/mage/translate-inline.js | 2 + lib/web/mage/translate.js | 2 + lib/web/mage/utils.js | 469 ++ lib/web/mage/validation.js | 37 +- lib/web/mage/zoom.js | 2 + lib/web/prototype/prototype.js | 23 +- package.json | 14 + pub/get.php | 7 +- .../Magento/Composer/src/FileResolver.php | 43 +- .../Magento/Composer/src/Reader/Json.php | 4 +- setup/module/Magento/Config/phpunit.xml.dist | 53 - .../src/Converter/ConverterInterface.php | 36 - .../Magento/Config/src/Reader/Filesystem.php | 170 - .../Config/src/Reader/ReaderInterface.php | 35 - .../Magento/Config/src/Resolver/ByPattern.php | 69 - .../Config/tests/Resolver/ByPatternTest.php | 44 - .../Magento/Locale/src/Data/Country.php | 308 -- .../Magento/Locale/src/Data/Currency.php | 212 - .../Magento/Locale/src/Data/Language.php | 110 - .../module/Magento/Locale/src/Data/Locale.php | 101 - .../Magento/Locale/src/Data/Timezone.php | 132 - .../module/Magento/Setup/config/di.config.php | 6 +- .../src/Controller/ConsoleController.php | 52 +- .../CustomizeYourStoreController.php | 6 +- .../Controller/Data/DatabaseController.php | 3 +- .../Controller/Install/StartController.php | 46 +- .../Magento/Setup/src/Model/Installer.php | 304 +- .../Setup/src/Model/InstallerFactory.php | 7 +- .../{Locale/src => Setup/src/Model}/Lists.php | 75 +- ...ta.php => UserConfigurationDataMapper.php} | 45 +- .../Setup/src/Module/ConnectionFactory.php | 64 + .../Setup/src/Module/Converter/Dom.php | 172 - .../Setup/src/Module/Dependency/Manager.php | 143 - setup/module/Magento/Setup/src/Module/Dir.php | 70 - .../Magento/Setup/src/Module/FileResolver.php | 75 - .../Setup/src/Module/Reader/Filesystem.php | 148 - .../Setup/src/Module/Resource/Resource.php | 127 - ...nectionFactory.php => ResourceFactory.php} | 37 +- .../module/Magento/Setup/src/Module/Setup.php | 327 +- .../Magento/Setup/src/Module/Setup/Config.php | 243 - .../Setup/src/Module/Setup/ConfigMapper.php | 69 + .../Setup/src/Module/Setup/ResourceConfig.php | 39 + .../Magento/Setup/src/Module/SetupFactory.php | 50 +- .../Magento/Setup/src/Module/SetupModule.php | 65 +- .../src/Module/Updater/SetupInterface.php | 67 - .../view/magento/setup/add-database.phtml | 16 +- .../magento/setup/create-admin-account.phtml | 8 +- .../magento/setup/customize-your-store.phtml | 10 +- .../Setup/view/magento/setup/install.phtml | 10 +- .../Setup/view/magento/setup/landing.phtml | 2 +- .../view/magento/setup/readiness-check.phtml | 10 +- .../setup/readiness-check/progress.phtml | 10 +- .../magento/setup/web-configuration.phtml | 12 +- 3108 files changed, 120402 insertions(+), 89066 deletions(-) create mode 100644 Gruntfile.js create mode 100644 app/code/Magento/AdminNotification/view/adminhtml/requirejs-config.js create mode 100644 app/code/Magento/Authorizenet/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/Backend/App/UserConfig.php create mode 100644 app/code/Magento/Backend/view/adminhtml/requirejs-config.js create mode 100644 app/code/Magento/Bundle/Model/Plugin/BundleOptions.php create mode 100644 app/code/Magento/Bundle/Model/Plugin/Product.php create mode 100644 app/code/Magento/Bundle/Pricing/Price/BundleRegularPrice.php create mode 100644 app/code/Magento/Bundle/Pricing/Price/RegularPriceInterface.php rename app/code/Magento/Bundle/data/bundle_setup/{data-install-1.6.0.0.php => data-install-2.0.0.php} (97%) delete mode 100644 app/code/Magento/Bundle/sql/bundle_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/Bundle/sql/bundle_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Bundle/sql/bundle_setup/upgrade-1.6.0.0-1.6.0.0.1.php rename app/code/Magento/{Ui/view/base/templates/filter/type/date/label.phtml => Bundle/view/adminhtml/requirejs-config.js} (88%) create mode 100644 app/code/Magento/Bundle/view/frontend/requirejs-config.js rename app/code/Magento/{Ui/view/base/templates/filter/type/range/label.phtml => Captcha/view/frontend/requirejs-config.js} (88%) rename app/code/Magento/{Sales/Service/V1/TransactionReadInterface.php => Catalog/Api/AttributeSetManagementInterface.php} (70%) create mode 100644 app/code/Magento/Catalog/Api/AttributeSetRepositoryInterface.php create mode 100644 app/code/Magento/Catalog/Api/CategoryAttributeOptionManagementInterface.php rename app/code/Magento/{Tax/Service/V1/Data/ZipRangeBuilder.php => Catalog/Api/CategoryAttributeRepositoryInterface.php} (59%) create mode 100644 app/code/Magento/Catalog/Api/CategoryLinkManagementInterface.php create mode 100644 app/code/Magento/Catalog/Api/CategoryLinkRepositoryInterface.php rename app/code/Magento/{Sales/Service/V1/ShipmentReadInterface.php => Catalog/Api/CategoryManagementInterface.php} (62%) create mode 100644 app/code/Magento/Catalog/Api/CategoryRepositoryInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/CategoryAttributeInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/CategoryAttributeSearchResultsInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/CategoryInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/CategoryProductLinkInterface.php rename app/code/Magento/{Sales/Service/V1/ShipmentWriteInterface.php => Catalog/Api/Data/CategoryTreeInterface.php} (53%) create mode 100644 app/code/Magento/Catalog/Api/Data/EavAttributeInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductAttributeDataBuilder.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryContentInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductAttributeMediaGalleryEntryInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductAttributeSearchResultsInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductAttributeTypeInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductCustomOptionInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductCustomOptionTypeInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductCustomOptionValuesInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductGroupPriceInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductLinkAttributeInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductLinkInterface.php rename app/code/Magento/{Tax/Service/V1/Data/TaxClassSearchResults.php => Catalog/Api/Data/ProductLinkSearchResults.php} (81%) create mode 100644 app/code/Magento/Catalog/Api/Data/ProductLinkTypeInterface.php create mode 100644 app/code/Magento/Catalog/Api/Data/ProductSearchResultsInterface.php rename app/code/Magento/{Tax/Service/V1/Data/TaxRateSearchResults.php => Catalog/Api/Data/ProductTierPriceInterface.php} (71%) create mode 100644 app/code/Magento/Catalog/Api/Data/ProductTypeInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductAttributeGroupRepositoryInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductAttributeManagementInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductAttributeMediaGalleryManagementInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductAttributeOptionManagementInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductAttributeRepositoryInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductAttributeTypesListInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductCustomOptionRepositoryInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductCustomOptionTypeListInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductGroupPriceManagementInterface.php rename app/code/Magento/{Sales/Service/V1/Action/InvoiceCapture.php => Catalog/Api/ProductLinkManagementInterface.php} (62%) rename app/code/Magento/{Sales/Service/V1/InvoiceWriteInterface.php => Catalog/Api/ProductLinkRepositoryInterface.php} (55%) create mode 100644 app/code/Magento/Catalog/Api/ProductLinkTypeListInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductMediaAttributeManagementInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductRepositoryInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductTierPriceManagementInterface.php create mode 100644 app/code/Magento/Catalog/Api/ProductTypeListInterface.php create mode 100644 app/code/Magento/Catalog/Model/Category/Attribute.php rename app/code/Magento/{Sales/Service/V1/Action/OrderAddressUpdate.php => Catalog/Model/Category/Attribute/OptionManagement.php} (57%) create mode 100644 app/code/Magento/Catalog/Model/Category/AttributeRepository.php create mode 100644 app/code/Magento/Catalog/Model/Category/Tree.php create mode 100644 app/code/Magento/Catalog/Model/CategoryLinkManagement.php create mode 100644 app/code/Magento/Catalog/Model/CategoryLinkRepository.php create mode 100644 app/code/Magento/Catalog/Model/CategoryManagement.php create mode 100644 app/code/Magento/Catalog/Model/CategoryProductLink.php create mode 100644 app/code/Magento/Catalog/Model/CategoryRepository.php delete mode 100644 app/code/Magento/Catalog/Model/Layer/Category/Context.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Category.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Decimal.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Price.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmFactory.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmInterface.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Auto.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Improved.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Manual.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/FilterInterface.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/Item/DataBuilder.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/Price/Range.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Filter/Price/Render.php create mode 100644 app/code/Magento/Catalog/Model/Layer/Resolver.php delete mode 100644 app/code/Magento/Catalog/Model/Layer/Search/Context.php create mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/Management.php create mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php create mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/Repository.php create mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/SetManagement.php create mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php rename lib/internal/Magento/Framework/Module/Declaration/FileIteratorFactory.php => app/code/Magento/Catalog/Model/Product/Attribute/Type.php (70%) create mode 100644 app/code/Magento/Catalog/Model/Product/Attribute/TypesList.php create mode 100644 app/code/Magento/Catalog/Model/Product/AttributeSet/AlreadyExistsException.php create mode 100644 app/code/Magento/Catalog/Model/Product/AttributeSet/Build.php create mode 100644 app/code/Magento/Catalog/Model/Product/Gallery/ContentValidator.php rename setup/module/Magento/Config/src/FileIterator.php => app/code/Magento/Catalog/Model/Product/Gallery/Entry.php (52%) create mode 100644 app/code/Magento/Catalog/Model/Product/Gallery/EntryResolver.php create mode 100644 app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php rename app/code/Magento/{Tax/Service/V1/Data/ZipRange.php => Catalog/Model/Product/GroupPrice.php} (66%) create mode 100644 app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php create mode 100644 app/code/Magento/Catalog/Model/Product/Media/AttributeManagement.php rename lib/internal/Magento/Framework/Module/Declaration/FileIterator.php => app/code/Magento/Catalog/Model/Product/Media/GalleryEntryContent.php (64%) rename app/code/Magento/{Sales/Service/V1/Action/OrderGet.php => Catalog/Model/Product/Option/Converter.php} (52%) create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Repository.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/Exception.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/LargeSizeException.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/NotImageException.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/OptionRequiredException.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/RunValidationException.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidateFactory.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/Validator.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php create mode 100644 app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php rename lib/internal/Magento/Framework/Module/Declaration/SchemaLocator.php => app/code/Magento/Catalog/Model/Product/TierPrice.php (69%) create mode 100644 app/code/Magento/Catalog/Model/Product/TierPriceManagement.php create mode 100644 app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/Attribute.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Crosssell.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Related.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Upsell.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/CollectionProviderInterface.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/Converter/ConverterInterface.php rename app/code/Magento/{Sales/Service/V1/Action/OrderCancel.php => Catalog/Model/ProductLink/Converter/ConverterPool.php} (60%) rename app/code/Magento/{Tax/Service/V1/Data/TaxRuleSearchResults.php => Catalog/Model/ProductLink/Converter/DefaultConverter.php} (72%) create mode 100644 app/code/Magento/Catalog/Model/ProductLink/Link.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/Management.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/Repository.php create mode 100644 app/code/Magento/Catalog/Model/ProductLink/Type.php create mode 100644 app/code/Magento/Catalog/Model/ProductOptions/TypeList.php rename setup/module/Magento/Setup/src/Module/ResourceInterface.php => app/code/Magento/Catalog/Model/ProductType.php (69%) create mode 100644 app/code/Magento/Catalog/Model/ProductTypeList.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php create mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.12-1.6.0.0.13.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.13-1.6.0.0.14.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.14-1.6.0.0.15.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.16-1.6.0.0.17.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.17-1.6.0.0.18.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.18-1.6.0.0.19.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.21-1.6.0.0.22.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.23-1.6.0.0.24.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.24-1.6.0.0.25.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.28-1.6.0.0.29.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.4-1.6.0.0.5.php delete mode 100644 app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.9-1.6.0.0.10.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php create mode 100644 app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.11-1.6.0.0.12.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.2-1.6.0.0.3.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.26-1.6.0.0.27.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.27-1.6.0.0.28.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.4-1.6.0.0.5.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.6-1.6.0.0.7.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.7-1.6.0.0.8.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.8-1.6.0.0.9.php delete mode 100644 app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php rename app/code/Magento/{Ui/view/base/templates/filter/default.phtml => Catalog/view/adminhtml/requirejs-config.js} (65%) create mode 100644 app/code/Magento/Catalog/view/frontend/requirejs-config.js rename app/code/Magento/CatalogInventory/data/cataloginventory_setup/{data-upgrade-1.6.0.0.3-1.6.0.0.4.php => data-install-2.0.0.php} (82%) delete mode 100644 app/code/Magento/CatalogInventory/data/cataloginventory_setup/data-upgrade-1.6.0.0.0-1.6.0.0.1.php delete mode 100644 app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/CatalogInventory/sql/cataloginventory_setup/install-2.0.0.php delete mode 100644 app/code/Magento/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php delete mode 100644 app/code/Magento/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.2-1.6.0.0.3.php delete mode 100644 app/code/Magento/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.5-1.6.0.0.6.php delete mode 100644 app/code/Magento/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.6-1.6.0.0.7.php rename app/code/Magento/CatalogRule/data/catalogrule_setup/{data-upgrade-1.6.0.3-1.6.0.4.php => data-install-2.0.0.php} (94%) delete mode 100644 app/code/Magento/CatalogRule/sql/catalogrule_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/CatalogRule/sql/catalogrule_setup/install-2.0.0.php delete mode 100644 app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.0-1.6.0.1.php delete mode 100644 app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.1-1.6.0.2.php delete mode 100644 app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.2-1.6.0.3.php delete mode 100644 app/code/Magento/CatalogRule/sql/catalogrule_setup/upgrade-1.6.0.3-1.6.0.4.php create mode 100644 app/code/Magento/CatalogSearch/Model/Adapter/Mysql/Plugin/Aggregation/Category/DataProvider.php delete mode 100644 app/code/Magento/CatalogSearch/Model/Config/Backend/Search/Type.php delete mode 100644 app/code/Magento/CatalogSearch/Model/Config/Source/Search/Type.php rename app/code/Magento/CatalogSearch/Model/Layer/{Search => Category}/ItemCollectionProvider.php (69%) create mode 100644 app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php create mode 100644 app/code/Magento/CatalogSearch/Model/Layer/Filter/Category.php create mode 100644 app/code/Magento/CatalogSearch/Model/Layer/Filter/Decimal.php create mode 100644 app/code/Magento/CatalogSearch/Model/Layer/Filter/Price.php delete mode 100644 app/code/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/Plugin.php rename app/code/Magento/CatalogSearch/Model/Resource/{Fulltext => }/Engine.php (66%) create mode 100644 app/code/Magento/CatalogSearch/Model/Resource/Product/CollectionFactory.php create mode 100644 app/code/Magento/CatalogSearch/Model/Search/IndexBuilder.php delete mode 100644 app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/CatalogSearch/sql/catalogsearch_setup/install-2.0.0.php rename app/code/Magento/{Ui/view/base/templates/data_type/number/default.phtml => CatalogSearch/view/frontend/requirejs-config.js} (88%) rename app/code/Magento/CatalogUrlRewrite/data/catalogurlrewrite_setup/{data-install-1.0.0.0.php => data-install-2.0.0.php} (97%) delete mode 100644 app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-1.0.0.0.php create mode 100644 app/code/Magento/CatalogUrlRewrite/sql/catalogurlrewrite_setup/install-2.0.0.php create mode 100644 app/code/Magento/Centinel/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/Checkout/Block/Adminhtml/CartTab.php rename app/code/Magento/Checkout/data/checkout_setup/{data-install-1.6.0.0.php => data-install-2.0.0.php} (100%) rename dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/FileResolver/_files/app/code/Module/Three/etc/module.xml => app/code/Magento/Checkout/view/frontend/requirejs-config.js (58%) rename app/code/Magento/CheckoutAgreements/sql/checkoutagreements_setup/{install-1.0.0.0.php => install-2.0.0.php} (100%) rename app/code/Magento/{Ui/view/base/templates/data_type/text/default.phtml => Cms/view/adminhtml/requirejs-config.js} (88%) rename setup/module/Magento/Setup/src/Module/Dependency/ManagerInterface.php => app/code/Magento/ConfigurableProduct/Plugin/Model/Resource/Product.php (56%) rename app/code/Magento/ConfigurableProduct/data/configurableproduct_setup/{data-install-1.0.0.0.php => data-install-2.0.0.php} (98%) delete mode 100644 app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-1.0.0.0.php create mode 100644 app/code/Magento/ConfigurableProduct/sql/configurableproduct_setup/install-2.0.0.php create mode 100644 app/code/Magento/ConfigurableProduct/view/adminhtml/requirejs-config.js create mode 100644 app/code/Magento/ConfigurableProduct/view/frontend/requirejs-config.js rename app/code/Magento/{Ui/view/base/templates/control/action/default.phtml => Core/view/adminhtml/requirejs-config.js} (88%) rename app/code/Magento/{Ui/view/base/templates/data_type/media/default.phtml => Core/view/frontend/requirejs-config.js} (88%) rename app/code/Magento/{Sales/Service/V1/Action/OrderGetStatus.php => Customer/Block/Adminhtml/Edit/BackButton.php} (62%) create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/DeleteButton.php create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/GenericButton.php create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/InvalidateTokenButton.php create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/OrderButton.php create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/ResetButton.php create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/ResetPasswordButton.php create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/SaveAndContinueButton.php create mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/SaveButton.php delete mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/Accordion.php delete mode 100644 app/code/Magento/Customer/Block/Adminhtml/Edit/Tabs.php create mode 100644 app/code/Magento/Customer/Model/Address/Mapper.php rename app/code/Magento/Customer/{Service/V1/Data/Eav => Model}/AttributeMetadataConverter.php (81%) rename app/code/Magento/Customer/{Service/V1/Data/Eav => Model}/AttributeMetadataDataProvider.php (97%) rename app/code/Magento/{Sales/Service/V1/Action/ShipmentAddComment.php => Customer/Model/Customer/Mapper.php} (50%) delete mode 100644 app/code/Magento/Customer/Model/Data/CustomerBuilder.php create mode 100644 app/code/Magento/Customer/etc/data_source/customer.xml create mode 100644 app/code/Magento/Customer/etc/data_source/customer_address.xml rename dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/FileResolver/_files/app/code/Module/Four/etc/module.xml => app/code/Magento/Customer/etc/data_source/customer_group.xml (70%) create mode 100644 app/code/Magento/Customer/view/adminhtml/layout/customer_form.xml create mode 100644 app/code/Magento/Customer/view/adminhtml/requirejs-config.js create mode 100644 app/code/Magento/Customer/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/DesignEditor/view/adminhtml/requirejs-config.js rename app/code/Magento/Downloadable/data/downloadable_setup/{data-install-1.6.0.0.php => data-install-2.0.0.php} (97%) delete mode 100644 app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php delete mode 100644 app/code/Magento/Downloadable/data/downloadable_setup/data-upgrade-1.6.0.0.2-1.6.0.0.3.php delete mode 100644 app/code/Magento/Downloadable/sql/downloadable_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/Downloadable/sql/downloadable_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Downloadable/sql/downloadable_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php create mode 100644 app/code/Magento/Downloadable/view/adminhtml/requirejs-config.js rename app/code/Magento/{Ui/view/base/templates/data_type/boolean/default.phtml => Downloadable/view/frontend/requirejs-config.js} (88%) create mode 100644 app/code/Magento/Eav/Api/AttributeGroupRepositoryInterface.php create mode 100644 app/code/Magento/Eav/Api/AttributeManagementInterface.php create mode 100644 app/code/Magento/Eav/Api/AttributeOptionManagementInterface.php create mode 100644 app/code/Magento/Eav/Api/AttributeRepositoryInterface.php rename app/code/Magento/{Sales/Service/V1/CreditmemoReadInterface.php => Eav/Api/AttributeSetManagementInterface.php} (64%) create mode 100644 app/code/Magento/Eav/Api/AttributeSetRepositoryInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeFrontendLabelInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeGroupDataBuilder.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeGroupInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeGroupSearchResultsInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeOptionInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeOptionLabelInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeSearchResultsInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeSetDataBuilder.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeSetInterface.php create mode 100644 app/code/Magento/Eav/Api/Data/AttributeSetSearchResultsInterface.php rename app/code/Magento/{Catalog/Model/Layer/Search/AvailabilityFlag.php => Eav/Api/Data/AttributeValidationRuleInterface.php} (87%) create mode 100644 app/code/Magento/Eav/Model/Attribute/GroupRepository.php create mode 100644 app/code/Magento/Eav/Model/AttributeManagement.php create mode 100644 app/code/Magento/Eav/Model/AttributeRepository.php create mode 100644 app/code/Magento/Eav/Model/AttributeSetManagement.php create mode 100644 app/code/Magento/Eav/Model/AttributeSetRepository.php create mode 100644 app/code/Magento/Eav/Model/Entity/Attribute/FrontendLabel.php rename app/code/Magento/{GroupedProduct/Service/V1/Product/Link/Data/ProductLink/DataMapper/GroupedProduct.php => Eav/Model/Entity/Attribute/OptionLabel.php} (66%) create mode 100644 app/code/Magento/Eav/Model/Entity/Attribute/OptionManagement.php create mode 100644 app/code/Magento/Eav/Model/Entity/Attribute/ValidationRule.php delete mode 100644 app/code/Magento/Eav/data/eav_setup/data-upgrade-1.6.0.1-1.6.0.2.php rename app/code/Magento/Eav/data/eav_setup/{data-upgrade-1.6.0.0-1.6.0.1.php => data-upgrade-2.0.0.php} (77%) create mode 100644 app/code/Magento/Eav/etc/webapi.xml rename app/code/Magento/Eav/sql/eav_setup/{install-1.6.0.0.php => install-2.0.0.php} (99%) rename app/code/Magento/GiftMessage/data/giftmessage_setup/{data-install-1.6.0.0.php => data-install-2.0.0.php} (78%) delete mode 100644 app/code/Magento/GiftMessage/data/giftmessage_setup/data-upgrade-1.6.0.0-1.6.0.1.php rename app/code/Magento/GiftMessage/sql/giftmessage_setup/{install-1.6.0.0.php => install-2.0.0.php} (100%) rename app/code/Magento/{Backend/view/adminhtml/templates/admin/loader.phtml => GiftMessage/view/frontend/requirejs-config.js} (82%) delete mode 100644 app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.0.php create mode 100644 app/code/Magento/GoogleOptimizer/sql/googleoptimizer_setup/install-2.0.0.php rename app/code/Magento/GoogleShopping/data/googleshopping_setup/{data-install-1.6.0.0.php => data-install-2.0.0.php} (90%) delete mode 100644 app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/GoogleShopping/sql/googleshopping_setup/install-2.0.0.php delete mode 100644 app/code/Magento/GoogleShopping/sql/googleshopping_setup/upgrade-1.6.0.0-1.6.0.0.1.php rename app/code/Magento/GroupedProduct/{Service/V1/Product/Link/Data/ProductLink => Model/Product/Link}/CollectionProvider/Grouped.php (82%) rename app/code/Magento/GroupedProduct/{Service/V1/Product/Link/Data/ProductLink => Model/Product/Link}/ProductEntity/Converter.php (64%) rename app/code/Magento/GroupedProduct/data/groupedproduct_setup/{data-install-0.0.1.php => data-install-2.0.0.php} (82%) rename dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/Magento/Test/etc/module.xml => app/code/Magento/GroupedProduct/etc/data_object.xml (80%) create mode 100644 app/code/Magento/GroupedProduct/view/adminhtml/requirejs-config.js rename app/code/Magento/ImportExport/sql/importexport_setup/{install-1.6.0.0.php => install-2.0.0.php} (55%) delete mode 100644 app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.1-1.6.0.2.php delete mode 100644 app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.2-1.6.0.3.php delete mode 100644 app/code/Magento/ImportExport/sql/importexport_setup/upgrade-1.6.0.3-1.6.0.4.php rename app/code/Magento/Indexer/sql/indexer_setup/{install-1.0.0.0.php => install-2.0.0.php} (55%) create mode 100644 app/code/Magento/Integration/view/adminhtml/requirejs-config.js rename app/code/Magento/Log/view/adminhtml/layout/{customer_index_edit.xml => customer_form.xml} (100%) rename app/code/Magento/Msrp/data/msrp_setup/{data-install-1.0.0.0.php => data-install-2.0.0.php} (98%) create mode 100644 app/code/Magento/Msrp/view/frontend/requirejs-config.js rename setup/module/Magento/Setup/src/Module/SchemaLocator.php => app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping/Plugin.php (54%) create mode 100644 app/code/Magento/Multishipping/view/frontend/requirejs-config.js delete mode 100644 app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.0-1.6.0.1.php delete mode 100644 app/code/Magento/Newsletter/data/newsletter_setup/data-upgrade-1.6.0.1-1.6.0.2.php delete mode 100644 app/code/Magento/Newsletter/sql/newsletter_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/Newsletter/sql/newsletter_setup/install-2.0.0.php create mode 100644 app/code/Magento/Newsletter/view/adminhtml/layout/customer_form.xml create mode 100644 app/code/Magento/Newsletter/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/PageCache/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/Payment/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/Paypal/view/adminhtml/layout/customer_form.xml create mode 100644 app/code/Magento/Paypal/view/frontend/requirejs-config.js rename app/code/Magento/Persistent/sql/persistent_setup/{install-1.0.0.0.php => install-2.0.0.php} (100%) create mode 100644 app/code/Magento/RecurringPayment/view/adminhtml/layout/customer_form.xml rename app/code/Magento/Reports/data/reports_setup/{data-install-1.6.0.0.php => data-install-2.0.0.php} (78%) delete mode 100644 app/code/Magento/Reports/sql/reports_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/Reports/sql/reports_setup/install-2.0.0.php delete mode 100644 app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0-1.6.0.0.1.php delete mode 100644 app/code/Magento/Reports/sql/reports_setup/upgrade-1.6.0.0.1-1.6.0.0.2.php create mode 100644 app/code/Magento/Reports/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/RequireJs/README.md create mode 100644 app/code/Magento/Review/Block/Adminhtml/ReviewTab.php rename app/code/Magento/Review/data/review_setup/{data-install-1.6.0.0.php => data-install-2.0.0.php} (76%) delete mode 100644 app/code/Magento/Review/sql/review_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/Review/sql/review_setup/install-2.0.0.php create mode 100644 app/code/Magento/Review/view/adminhtml/layout/customer_form.xml create mode 100644 app/code/Magento/Review/view/adminhtml/requirejs-config.js create mode 100644 app/code/Magento/Sales/Api/CreditmemoCommentRepositoryInterface.php create mode 100644 app/code/Magento/Sales/Api/CreditmemoItemRepositoryInterface.php rename app/code/Magento/Sales/{Service/V1/InvoiceReadInterface.php => Api/CreditmemoManagementInterface.php} (65%) create mode 100644 app/code/Magento/Sales/Api/CreditmemoRepositoryInterface.php rename app/code/Magento/Sales/{Service/V1/Data/Comment.php => Api/Data/CreditmemoCommentInterface.php} (68%) create mode 100644 app/code/Magento/Sales/Api/Data/CreditmemoCommentSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/Creditmemo.php => Api/Data/CreditmemoInterface.php} (57%) rename app/code/Magento/Sales/{Service/V1/Data/CreditmemoItem.php => Api/Data/CreditmemoItemInterface.php} (52%) create mode 100644 app/code/Magento/Sales/Api/Data/CreditmemoItemSearchResultInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/CreditmemoSearchResultInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/InvoiceCommentInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/InvoiceCommentSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/Invoice.php => Api/Data/InvoiceInterface.php} (57%) rename app/code/Magento/Sales/{Service/V1/Data/InvoiceItem.php => Api/Data/InvoiceItemInterface.php} (59%) create mode 100644 app/code/Magento/Sales/Api/Data/InvoiceItemSearchResultInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/InvoiceSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/OrderAddress.php => Api/Data/OrderAddressInterface.php} (58%) create mode 100644 app/code/Magento/Sales/Api/Data/OrderAddressSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/Order.php => Api/Data/OrderInterface.php} (55%) rename app/code/Magento/Sales/{Service/V1/Data/OrderItem.php => Api/Data/OrderItemInterface.php} (54%) create mode 100644 app/code/Magento/Sales/Api/Data/OrderItemSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/OrderPayment.php => Api/Data/OrderPaymentInterface.php} (57%) create mode 100644 app/code/Magento/Sales/Api/Data/OrderPaymentSearchResultInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/OrderSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/OrderStatusHistory.php => Api/Data/OrderStatusHistoryInterface.php} (65%) create mode 100644 app/code/Magento/Sales/Api/Data/OrderStatusHistorySearchResultInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/ShipmentCommentInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/ShipmentCommentSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/Shipment.php => Api/Data/ShipmentInterface.php} (58%) rename app/code/Magento/Sales/{Service/V1/Data/ShipmentItem.php => Api/Data/ShipmentItemInterface.php} (63%) create mode 100644 app/code/Magento/Sales/Api/Data/ShipmentItemSearchResultInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/ShipmentPackageInterface.php create mode 100644 app/code/Magento/Sales/Api/Data/ShipmentSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/ShipmentTrack.php => Api/Data/ShipmentTrackInterface.php} (63%) create mode 100644 app/code/Magento/Sales/Api/Data/ShipmentTrackSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Data/Transaction.php => Api/Data/TransactionInterface.php} (55%) create mode 100644 app/code/Magento/Sales/Api/Data/TransactionSearchResultInterface.php rename app/code/Magento/Sales/{Service/V1/Action/ShipmentEmail.php => Api/InvoiceCommentRepositoryInterface.php} (53%) create mode 100644 app/code/Magento/Sales/Api/InvoiceItemRepositoryInterface.php rename app/code/Magento/Sales/{Service/V1/Action/OrderHold.php => Api/InvoiceManagementInterface.php} (63%) rename app/code/Magento/Sales/{Service/V1/OrderReadInterface.php => Api/InvoiceRepositoryInterface.php} (55%) create mode 100644 app/code/Magento/Sales/Api/OrderAddressRepositoryInterface.php create mode 100644 app/code/Magento/Sales/Api/OrderItemRepositoryInterface.php rename app/code/Magento/Sales/{Service/V1/OrderWriteInterface.php => Api/OrderManagementInterface.php} (59%) create mode 100644 app/code/Magento/Sales/Api/OrderPaymentRepositoryInterface.php rename app/code/Magento/Sales/{Service/V1/Action/OrderEmail.php => Api/OrderRepositoryInterface.php} (56%) create mode 100644 app/code/Magento/Sales/Api/OrderStatusHistoryRepositoryInterface.php rename app/code/Magento/Sales/{Service/V1/Action/InvoiceEmail.php => Api/ShipmentCommentRepositoryInterface.php} (53%) create mode 100644 app/code/Magento/Sales/Api/ShipmentItemRepositoryInterface.php create mode 100644 app/code/Magento/Sales/Api/ShipmentManagementInterface.php create mode 100644 app/code/Magento/Sales/Api/ShipmentRepositoryInterface.php rename app/code/Magento/Sales/{Service/V1/CreditmemoWriteInterface.php => Api/ShipmentTrackRepositoryInterface.php} (52%) create mode 100644 app/code/Magento/Sales/Api/TransactionRepositoryInterface.php create mode 100644 app/code/Magento/Sales/Block/Adminhtml/CustomerOrdersTab.php delete mode 100644 app/code/Magento/Sales/Model/OrderConverter.php rename app/code/Magento/Sales/Model/{OrderRepository => Resource/Order}/Plugin/Authorization.php (77%) create mode 100644 app/code/Magento/Sales/Model/Service/CreditmemoService.php create mode 100644 app/code/Magento/Sales/Model/Service/InvoiceService.php create mode 100644 app/code/Magento/Sales/Model/Service/OrderService.php create mode 100644 app/code/Magento/Sales/Model/Service/ShipmentService.php create mode 100644 app/code/Magento/Sales/Model/Spi/CreditmemoCommentResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/CreditmemoItemResourceInterface.php rename app/code/Magento/{Tax/Service/V1/Data/TaxDetails/AppliedTaxRateBuilder.php => Sales/Model/Spi/CreditmemoResourceInterface.php} (57%) create mode 100644 app/code/Magento/Sales/Model/Spi/InvoiceCommentResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/InvoiceItemResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/InvoiceResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/OrderAddressResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/OrderItemResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/OrderPaymentResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/OrderResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/OrderStatusHistoryResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/ShipmentCommentResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/ShipmentItemResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/ShipmentResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/ShipmentTrackResourceInterface.php create mode 100644 app/code/Magento/Sales/Model/Spi/TransactionResourceInterface.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/CreditmemoAddComment.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/CreditmemoCommentsList.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/CreditmemoCreate.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/CreditmemoEmail.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/CreditmemoGet.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/CreditmemoList.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/InvoiceAddComment.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/InvoiceCommentsList.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/InvoiceCreate.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/InvoiceGet.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/InvoiceList.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/OrderCommentsList.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/OrderCreate.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/OrderList.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/OrderStatusHistoryAdd.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/ShipmentAddTrack.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/ShipmentCommentsList.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/ShipmentCreate.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/ShipmentGet.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/ShipmentList.php delete mode 100644 app/code/Magento/Sales/Service/V1/Action/ShipmentRemoveTrack.php delete mode 100644 app/code/Magento/Sales/Service/V1/CreditmemoRead.php delete mode 100644 app/code/Magento/Sales/Service/V1/CreditmemoWrite.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/CreditmemoConverter.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/CreditmemoMapper.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/InvoiceConverter.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/InvoiceMapper.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/OrderMapper.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/ShipmentConverter.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/ShipmentMapper.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/TransactionBuilder.php delete mode 100644 app/code/Magento/Sales/Service/V1/Data/TransactionMapper.php delete mode 100644 app/code/Magento/Sales/Service/V1/InvoiceRead.php delete mode 100644 app/code/Magento/Sales/Service/V1/InvoiceWrite.php delete mode 100644 app/code/Magento/Sales/Service/V1/OrderRead.php delete mode 100644 app/code/Magento/Sales/Service/V1/OrderWrite.php delete mode 100644 app/code/Magento/Sales/Service/V1/ShipmentRead.php delete mode 100644 app/code/Magento/Sales/Service/V1/ShipmentWrite.php delete mode 100644 app/code/Magento/Sales/Service/V1/TransactionRead.php create mode 100644 app/code/Magento/Sales/view/adminhtml/layout/customer_form.xml create mode 100644 app/code/Magento/Sales/view/adminhtml/requirejs-config.js create mode 100644 app/code/Magento/Sales/view/frontend/requirejs-config.js rename app/code/Magento/{Reports/Block/Adminhtml => Search/Block/Adminhtml/Reports}/Search.php (89%) rename app/code/Magento/{Reports/Controller/Adminhtml/Index => Search/Controller/Adminhtml/Term}/ExportSearchCsv.php (88%) rename app/code/Magento/{Reports/Controller/Adminhtml/Index => Search/Controller/Adminhtml/Term}/ExportSearchExcel.php (88%) create mode 100644 app/code/Magento/Search/Controller/Adminhtml/Term/Report.php rename app/code/Magento/{Reports/Controller/Adminhtml/Index/Search.php => Search/Controller/Term/Index.php} (93%) delete mode 100644 app/code/Magento/Search/sql/search_setup/install-1.6.0.0.php create mode 100644 app/code/Magento/Search/sql/search_setup/install-2.0.0.php rename app/code/Magento/{Reports/view/adminhtml/layout/reports_index_search_block.xml => Search/view/adminhtml/layout/search_term_block.xml} (99%) rename app/code/Magento/{Reports/view/adminhtml/layout/reports_index_exportsearchcsv.xml => Search/view/adminhtml/layout/search_term_exportsearchcsv.xml} (100%) rename app/code/Magento/{Reports/view/adminhtml/layout/reports_index_exportsearchexcel.xml => Search/view/adminhtml/layout/search_term_exportsearchexcel.xml} (100%) rename app/code/Magento/{Reports/view/adminhtml/layout/reports_index_search.xml => Search/view/adminhtml/layout/search_term_report.xml} (92%) create mode 100644 app/code/Magento/Search/view/adminhtml/layout/search_term_report_block.xml create mode 100644 app/code/Magento/Search/view/frontend/requirejs-config.js rename app/code/Magento/{CatalogSearch => Search}/view/frontend/templates/term.phtml (100%) rename app/code/Magento/{Ui/DataProvider/Options/Store.php => Store/Ui/DataProvider/Options.php} (95%) rename app/code/Magento/{Ui/DataProvider/Row/Store.php => Store/Ui/DataProvider/Row.php} (95%) rename app/code/Magento/{Backend/etc/adminhtml/cache.xml => Store/etc/data_source/website.xml} (74%) rename app/code/Magento/Store/view/base/web/templates/filter/{store.html => filter_store.html} (72%) rename app/code/Magento/Tax/{Service/V1/Data/TaxDetails/AppliedTax.php => Api/Data/AppliedTaxInterface.php} (71%) rename app/code/Magento/Tax/{Service/V1/Data/TaxDetails/AppliedTaxRate.php => Api/Data/AppliedTaxRateInterface.php} (77%) rename app/code/Magento/Tax/{Service/V1/Data/OrderTaxDetails/AppliedTax.php => Api/Data/OrderTaxDetailsAppliedTaxInterface.php} (72%) rename app/code/Magento/Tax/{Service/V1/Data/OrderTaxDetails.php => Api/Data/OrderTaxDetailsInterface.php} (66%) rename app/code/Magento/Tax/{Service/V1/Data/OrderTaxDetails/Item.php => Api/Data/OrderTaxDetailsItemInterface.php} (72%) rename app/code/Magento/Tax/{Service/V1/Data/QuoteDetails.php => Api/Data/QuoteDetailsInterface.php} (67%) rename app/code/Magento/Tax/{Service/V1/Data/QuoteDetails/Item.php => Api/Data/QuoteDetailsItemInterface.php} (66%) create mode 100644 app/code/Magento/Tax/Api/Data/TaxClassDataBuilder.php rename app/code/Magento/Tax/{Service/V1/Data/TaxClass.php => Api/Data/TaxClassInterface.php} (76%) rename app/code/Magento/Tax/{Service/V1/Data/TaxClassKey.php => Api/Data/TaxClassKeyInterface.php} (80%) create mode 100644 app/code/Magento/Tax/Api/Data/TaxClassSearchResultsInterface.php rename app/code/Magento/Tax/{Service/V1/Data/TaxDetails.php => Api/Data/TaxDetailsInterface.php} (66%) rename app/code/Magento/Tax/{Service/V1/Data/TaxDetails/Item.php => Api/Data/TaxDetailsItemInterface.php} (63%) create mode 100644 app/code/Magento/Tax/Api/Data/TaxRateDataBuilder.php rename app/code/Magento/Tax/{Service/V1/Data/TaxRate.php => Api/Data/TaxRateInterface.php} (55%) create mode 100644 app/code/Magento/Tax/Api/Data/TaxRateSearchResultsInterface.php create mode 100644 app/code/Magento/Tax/Api/Data/TaxRateTitleDataBuilder.php rename app/code/Magento/Tax/{Service/V1/Data/TaxRateTitle.php => Api/Data/TaxRateTitleInterface.php} (76%) create mode 100644 app/code/Magento/Tax/Api/Data/TaxRuleDataBuilder.php create mode 100644 app/code/Magento/Tax/Api/Data/TaxRuleInterface.php create mode 100644 app/code/Magento/Tax/Api/Data/TaxRuleSearchResultsInterface.php rename app/code/Magento/Tax/{Service/V1/OrderTaxServiceInterface.php => Api/OrderTaxManagementInterface.php} (89%) rename app/code/Magento/Tax/{Service/V1/TaxCalculationServiceInterface.php => Api/TaxCalculationInterface.php} (85%) create mode 100644 app/code/Magento/Tax/Api/TaxClassManagementInterface.php rename app/code/Magento/Tax/{Service/V1/TaxClassServiceInterface.php => Api/TaxClassRepositoryInterface.php} (56%) create mode 100644 app/code/Magento/Tax/Api/TaxRateManagementInterface.php rename app/code/Magento/Tax/{Service/V1/TaxRateServiceInterface.php => Api/TaxRateRepositoryInterface.php} (64%) rename app/code/Magento/Tax/{Service/V1/TaxRuleServiceInterface.php => Api/TaxRuleRepositoryInterface.php} (58%) rename app/code/Magento/Tax/{Service/V1/TaxRateService.php => Model/Calculation/RateRepository.php} (69%) create mode 100644 app/code/Magento/Tax/Model/Calculation/Rule/Validator.php delete mode 100644 app/code/Magento/Tax/Model/Calculation/TaxRuleConverter.php create mode 100644 app/code/Magento/Tax/Model/Config/TaxClass.php create mode 100644 app/code/Magento/Tax/Model/Sales/Order/Details.php rename app/code/Magento/Tax/{Service/V1/OrderTaxService.php => Model/Sales/Order/TaxManagement.php} (76%) create mode 100644 app/code/Magento/Tax/Model/Sales/Quote/ItemDetails.php create mode 100644 app/code/Magento/Tax/Model/Sales/Quote/QuoteDetails.php rename app/code/Magento/Tax/{Service/V1/TaxCalculationService.php => Model/TaxCalculation.php} (72%) rename app/code/Magento/{Sales/Service/V1/Data/Transaction/AdditionalInformation.php => Tax/Model/TaxClass/Key.php} (67%) create mode 100644 app/code/Magento/Tax/Model/TaxClass/Management.php rename app/code/Magento/Tax/{Service/V1/TaxClassService.php => Model/TaxClass/Repository.php} (56%) create mode 100644 app/code/Magento/Tax/Model/TaxDetails/AppliedTax.php rename app/code/Magento/{Sales/Service/V1/Action/InvoiceVoid.php => Tax/Model/TaxDetails/AppliedTaxRate.php} (61%) create mode 100644 app/code/Magento/Tax/Model/TaxDetails/ItemDetails.php create mode 100644 app/code/Magento/Tax/Model/TaxDetails/TaxDetails.php rename app/code/Magento/Tax/{Service/V1/Collection => Model}/TaxRateCollection.php (75%) create mode 100644 app/code/Magento/Tax/Model/TaxRateManagement.php rename app/code/Magento/Tax/{Service/V1/Collection => Model}/TaxRuleCollection.php (80%) create mode 100644 app/code/Magento/Tax/Model/TaxRuleRepository.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/AppliedTaxBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/OrderTaxDetails/ItemBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/OrderTaxDetailsBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/QuoteDetailsBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxClassSearchResultsBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxDetailsBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxRateBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxRule.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxRuleBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilder.php delete mode 100644 app/code/Magento/Tax/Service/V1/TaxRuleService.php create mode 100644 app/code/Magento/Theme/view/frontend/requirejs-config.js rename app/code/Magento/Ui/{ => Component}/AbstractView.php (58%) create mode 100644 app/code/Magento/Ui/Component/Container/Content.php rename app/code/Magento/Ui/{ => Component}/Control/Action.php (92%) rename app/code/Magento/Ui/{ => Component}/Control/ActionPool.php (92%) rename app/code/Magento/Ui/{ => Component}/Control/ActionPoolInterface.php (97%) rename app/code/Magento/Ui/{ => Component}/Control/Button.php (92%) create mode 100644 app/code/Magento/Ui/Component/Control/ButtonProviderFactory.php rename app/code/Magento/{Catalog/Pricing/Price/GroupPriceInterface.php => Ui/Component/Control/ButtonProviderInterface.php} (83%) rename app/code/Magento/Ui/{ => Component}/Control/Container.php (82%) rename app/code/Magento/Ui/{ => Component}/Control/ControlInterface.php (96%) rename app/code/Magento/Ui/{ => Component}/Control/Item.php (96%) rename app/code/Magento/Ui/{ => Component}/Control/Link.php (92%) rename app/code/Magento/{Sales/Service/V1/Action/ShipmentLabelGet.php => Ui/Component/ElementRenderer.php} (60%) create mode 100644 app/code/Magento/Ui/Component/ElementRendererBuilder.php create mode 100644 app/code/Magento/Ui/Component/ElementRendererInterface.php rename app/code/Magento/Ui/{Filter/View.php => Component/Filter/FilterAbstract.php} (72%) rename app/code/Magento/Ui/{ => Component}/Filter/FilterInterface.php (91%) rename app/code/Magento/Ui/{ => Component}/Filter/FilterPool.php (70%) rename app/code/Magento/Ui/{ => Component}/Filter/Type/Date.php (90%) rename app/code/Magento/Ui/{ => Component}/Filter/Type/Input.php (91%) rename app/code/Magento/Ui/{ => Component}/Filter/Type/Range.php (92%) rename app/code/Magento/Ui/{ => Component}/Filter/Type/Select.php (90%) create mode 100644 app/code/Magento/Ui/Component/Filter/Type/Store.php rename app/code/Magento/Ui/{FilterPool/View.php => Component/FilterPool.php} (67%) create mode 100644 app/code/Magento/Ui/Component/Form.php create mode 100644 app/code/Magento/Ui/Component/Form/Collection.php rename app/code/Magento/Ui/{FormElement => Component/Form/Element}/AbstractFormElement.php (95%) rename app/code/Magento/Ui/{FormElement => Component/Form/Element}/Checkbox.php (95%) rename app/code/Magento/Ui/{ => Component/Form/Element}/DataType/AbstractDataType.php (93%) rename app/code/Magento/Ui/{ => Component/Form/Element}/DataType/Boolean.php (94%) rename app/code/Magento/Ui/{ => Component/Form/Element}/DataType/DataTypeInterface.php (96%) rename app/code/Magento/Ui/{ => Component/Form/Element}/DataType/Date.php (94%) rename app/code/Magento/Ui/{Search/View.php => Component/Form/Element/DataType/Email.php} (89%) rename app/code/Magento/Ui/{ => Component/Form/Element}/DataType/Media.php (94%) rename app/code/Magento/Ui/{ => Component/Form/Element}/DataType/Number.php (94%) rename app/code/Magento/Ui/{ => Component/Form/Element}/DataType/Password.php (94%) create mode 100644 app/code/Magento/Ui/Component/Form/Element/DataType/Price.php rename app/code/Magento/Ui/{ => Component/Form/Element}/DataType/Text.php (94%) rename app/code/Magento/Ui/{FormElement => Component/Form/Element}/ElementInterface.php (96%) rename app/code/Magento/Ui/{FormElement => Component/Form/Element}/Input.php (85%) create mode 100644 app/code/Magento/Ui/Component/Form/Element/Multiline.php rename app/code/Magento/Ui/{FormElement => Component/Form/Element}/Radio.php (96%) rename app/code/Magento/Ui/{FormElement => Component/Form/Element}/Range.php (96%) rename app/code/Magento/Ui/{Filter/Type/Store.php => Component/Form/Element/Select.php} (77%) rename app/code/Magento/Ui/{FormElement => Component/Form/Element}/Textarea.php (95%) rename app/code/Magento/Ui/{ => Component}/Form/Field.php (95%) create mode 100644 app/code/Magento/Ui/Component/Form/Fieldset.php create mode 100644 app/code/Magento/Ui/Component/Form/Fieldset/Factory.php create mode 100644 app/code/Magento/Ui/Component/Layout/AbstractStructure.php create mode 100644 app/code/Magento/Ui/Component/Layout/Group.php create mode 100644 app/code/Magento/Ui/Component/Layout/Tabs.php create mode 100644 app/code/Magento/Ui/Component/Layout/Tabs/Nav.php create mode 100644 app/code/Magento/Ui/Component/Layout/Tabs/Tab.php create mode 100644 app/code/Magento/Ui/Component/Layout/Tabs/TabInterface.php create mode 100644 app/code/Magento/Ui/Component/Layout/Tabs/TabWrapper.php rename app/code/Magento/Ui/{Listing/View.php => Component/Listing.php} (75%) rename app/code/Magento/Ui/{DataProvider => Component/Listing}/OptionsFactory.php (95%) rename app/code/Magento/Ui/{DataProvider => Component/Listing}/OptionsInterface.php (96%) rename app/code/Magento/Ui/{DataProvider => Component/Listing}/RowInterface.php (96%) rename app/code/Magento/Ui/{DataProvider => Component/Listing}/RowPool.php (95%) rename app/code/Magento/Ui/{ListingContainer/Massaction/View.php => Component/MassAction.php} (67%) rename app/code/Magento/Ui/{Paging/View.php => Component/Paging.php} (61%) create mode 100644 app/code/Magento/Ui/Component/RenderLayoutInterface.php rename app/code/Magento/Ui/{FormElement/Select.php => Component/Search.php} (91%) rename app/code/Magento/Ui/{Sorting/View.php => Component/Sorting.php} (69%) rename app/code/Magento/Ui/ContentType/{Builders => Builder}/ConfigJson.php (97%) rename app/code/Magento/Ui/ContentType/{Builders => Builder}/ConfigStorageJson.php (73%) rename app/code/Magento/Ui/{ => Context}/Configuration.php (98%) rename app/code/Magento/Ui/{ => Context}/ConfigurationStorage.php (54%) rename app/code/Magento/Ui/Controller/Adminhtml/{Listing/Ajax.php => AbstractAction.php} (82%) create mode 100644 app/code/Magento/Ui/Controller/Adminhtml/Form/Fieldset.php create mode 100644 app/code/Magento/Ui/Controller/Adminhtml/Form/Save.php create mode 100644 app/code/Magento/Ui/Controller/Adminhtml/Form/Validate.php create mode 100644 app/code/Magento/Ui/Controller/Adminhtml/Index/Render.php rename setup/module/Magento/Config/src/SchemaLocatorInterface.php => app/code/Magento/Ui/Controller/UiActionInterface.php (82%) create mode 100644 app/code/Magento/Ui/DataProvider/Config/Converter.php rename app/code/Magento/{CatalogSearch/Model/Layer/Advanced/Context.php => Ui/DataProvider/Config/Data.php} (62%) create mode 100644 app/code/Magento/Ui/DataProvider/Config/FileResolver.php create mode 100644 app/code/Magento/Ui/DataProvider/Config/Reader.php rename app/code/Magento/{Tax/Service/V1/Data/TaxClassBuilder.php => Ui/DataProvider/Config/SchemaLocator.php} (58%) create mode 100644 app/code/Magento/Ui/DataProvider/DataProviderCollectionInterface.php create mode 100644 app/code/Magento/Ui/DataProvider/DataProviderEntityInterface.php rename app/code/Magento/{Sales/Service/V1/Action/OrderUnHold.php => Ui/DataProvider/Factory.php} (61%) create mode 100644 app/code/Magento/Ui/DataProvider/Manager.php create mode 100644 app/code/Magento/Ui/DataProvider/Metadata.php create mode 100644 app/code/Magento/Ui/README.md create mode 100644 app/code/Magento/Ui/etc/data_source.xsd rename app/code/Magento/Ui/view/base/templates/{form_element/textarea/content.phtml => container/content/default.phtml} (89%) delete mode 100644 app/code/Magento/Ui/view/base/templates/data_type/password/default.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/date/content.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/input/content.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/range/content.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/filter/type/select/label.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form/default.phtml create mode 100644 app/code/Magento/Ui/view/base/templates/form/fieldset/default.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/checkbox/content.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/checkbox/label.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/input/content.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/input/label.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/radio/content.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/radio/label.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/range/label.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/select/content.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/select/label.phtml delete mode 100644 app/code/Magento/Ui/view/base/templates/form_element/textarea/label.phtml rename app/code/Magento/Ui/view/base/templates/{filter/content.phtml => layout/group/default.phtml} (60%) rename app/code/Magento/Ui/view/base/templates/{data_type/date => layout/tabs}/default.phtml (82%) create mode 100644 app/code/Magento/Ui/view/base/templates/layout/tabs/nav/default.phtml create mode 100644 app/code/Magento/Ui/view/base/web/js/core/app.js create mode 100644 app/code/Magento/Ui/view/base/web/js/core/renderer/components/layout.js create mode 100644 app/code/Magento/Ui/view/base/web/js/core/renderer/components/types.js rename app/{design/frontend/Magento/blank/web/bootstrap.js => code/Magento/Ui/view/base/web/js/core/renderer/renderer.js} (66%) create mode 100644 app/code/Magento/Ui/view/base/web/js/form.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/adapter.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/client.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/component.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/components/area.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/components/collapsible.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/components/collection.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/components/collection/item.js rename dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/FileResolver/_files/app/code/Module/One/etc/module.xml => app/code/Magento/Ui/view/base/web/js/form/components/fieldset.js (61%) create mode 100644 app/code/Magento/Ui/view/base/web/js/form/components/group.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/components/html.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/components/tab.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/components/tab_group.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/element/abstract.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/element/boolean.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/element/multiselect.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/element/select.js rename lib/internal/Magento/Framework/RequireJs/paths-updater.js => app/code/Magento/Ui/view/base/web/js/form/element/textarea.js (67%) create mode 100644 app/code/Magento/Ui/view/base/web/js/form/provider.js create mode 100644 app/code/Magento/Ui/view/base/web/js/form/storages.js rename app/code/Magento/Ui/view/base/web/js/{listing/utils => lib}/data_provider.js (97%) create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/deferred_events.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/i18n.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/bind/class.js rename dev/tests/js/testsuite/mage/requirejs/paths-updater-test.js => app/code/Magento/Ui/view/base/web/js/lib/ko/bind/keyboard.js (51%) create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/bind/optgroup.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/ko/extender/observable_array.js rename app/code/Magento/Ui/view/base/web/js/{listing/utils => lib}/provider.js (94%) rename app/code/Magento/Ui/view/base/web/js/{listing/utils => lib}/request_builder.js (100%) rename app/code/Magento/Ui/view/base/web/js/{listing/utils => lib}/rest.js (100%) create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/storage/dump.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/validation/utils.js create mode 100644 app/code/Magento/Ui/view/base/web/js/lib/validation/validator.js create mode 100644 app/code/Magento/Ui/view/base/web/templates/area.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/collection.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/content/content.html rename app/code/Magento/Ui/view/base/{templates/filter/type/select/content.phtml => web/templates/fieldset/fieldset.html} (58%) create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/collection.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/components/collection.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/components/collection/item.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/components/collection/preview.html rename dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/FileResolver/_files/app/code/Module/Two/etc/module.xml => app/code/Magento/Ui/view/base/web/templates/form/element/checkbox.html (57%) create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/date.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/email.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/helper/tooltip.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/input.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/media.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/multiselect.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/price.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/select.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/form/element/textarea.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/group/field.html create mode 100644 app/code/Magento/Ui/view/base/web/templates/group/group.html rename app/code/Magento/Ui/view/base/{templates/form_element/range/content.phtml => web/templates/tab.html} (54%) delete mode 100644 app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-1.0.0.0.php create mode 100644 app/code/Magento/UrlRewrite/sql/urlrewrite_setup/install-2.0.0.php create mode 100644 app/code/Magento/User/view/adminhtml/requirejs-config.js rename app/code/Magento/{Ui/view/base/templates/filter/type/input/label.phtml => Weee/view/adminhtml/requirejs-config.js} (88%) create mode 100644 app/code/Magento/Weee/view/frontend/requirejs-config.js create mode 100644 app/code/Magento/Wishlist/Block/Adminhtml/WishlistTab.php create mode 100644 app/code/Magento/Wishlist/view/frontend/requirejs-config.js create mode 100644 app/design/adminhtml/Magento/backend/Magento_Ui/web/css/source/formelements.less create mode 100644 app/design/adminhtml/Magento/backend/Magento_Ui/web/images/choice_bkg.png delete mode 100644 app/design/adminhtml/Magento/backend/web/bootstrap.js create mode 100644 app/design/frontend/Magento/luma/Magento_Bundle/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Catalog/layout/catalog_product_view.xml create mode 100644 app/design/frontend/Magento/luma/Magento_Catalog/layout/default.xml create mode 100644 app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/listings.less create mode 100644 app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Catalog/web/css/source/toolbar.less create mode 100644 app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Checkout/layout/checkout_cart_index.xml create mode 100644 app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/cart.less create mode 100644 app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/minicart.less create mode 100644 app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module.less rename lib/web/css/source/extend.less => app/design/frontend/Magento/luma/Magento_Contact/web/css/source/module.less (98%) create mode 100644 app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml create mode 100644 app/design/frontend/Magento/luma/Magento_Customer/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Downloadable/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_GiftMessage/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_LayeredNavigation/templates/layer/state.phtml create mode 100644 app/design/frontend/Magento/luma/Magento_LayeredNavigation/templates/layer/view.phtml create mode 100644 app/design/frontend/Magento/luma/Magento_LayeredNavigation/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Paypal/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_RecurringPayment/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Review/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Sales/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Sendfriend/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Theme/layout/default.xml create mode 100644 app/design/frontend/Magento/luma/Magento_Theme/web/css/source/collapsible_navigation.less create mode 100644 app/design/frontend/Magento/luma/Magento_Theme/web/css/source/module.less create mode 100644 app/design/frontend/Magento/luma/Magento_Wishlist/web/css/source/module.less rename app/design/frontend/Magento/{plushe => luma}/composer.json (53%) create mode 100644 app/design/frontend/Magento/luma/etc/view.xml create mode 100644 app/design/frontend/Magento/luma/i18n/en_US.csv create mode 100644 app/design/frontend/Magento/luma/media/preview.jpg rename app/design/frontend/Magento/{plushe => luma}/theme.xml (94%) create mode 100644 app/design/frontend/Magento/luma/web/css/source/abstract.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/actions-toolbar.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/breadcrumbs.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/buttons.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/forms.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/lib/variables.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/pages.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/popups.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/sections.less create mode 100644 app/design/frontend/Magento/luma/web/css/source/tables.less create mode 100644 app/design/frontend/Magento/luma/web/fonts/Luma-Icons.eot create mode 100644 app/design/frontend/Magento/luma/web/fonts/Luma-Icons.svg create mode 100644 app/design/frontend/Magento/luma/web/fonts/Luma-Icons.ttf create mode 100644 app/design/frontend/Magento/luma/web/fonts/Luma-Icons.woff create mode 100644 app/design/frontend/Magento/luma/web/fonts/selection.json create mode 100644 app/design/frontend/Magento/luma/web/images/logo.png create mode 100644 app/design/frontend/Magento/luma/web/images/select-bg.svg delete mode 100644 app/design/frontend/Magento/plushe/media/preview.jpg delete mode 100644 app/etc/local.xml.template create mode 100644 dev/shell/user_config_data.php rename dev/tests/functional/lib/Mtf/Client/Driver/Selenium/Element/{GlobalSearchElement.php => GlobalsearchElement.php} (52%) delete mode 100644 dev/tests/functional/tests/app/Magento/Backend/Test/TestCase/UserTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Catalog/Test/Fixture/CatalogProductSimple/Fpt.php create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/Block/Cart.php create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/Block/Cart/CartItem.php create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/Block/Cart/CartItem/Fpt.php rename app/code/Magento/Tax/Service/V1/Data/TaxRateTitleBuilder.php => dev/tests/functional/tests/app/Magento/Weee/Test/Block/Cart/Totals.php (62%) create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/Block/Cart/Totals/Fpt.php create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/Fpt.php create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/ListProduct.php rename app/code/Magento/Tax/Service/V1/Data/TaxClassKeyBuilder.php => dev/tests/functional/tests/app/Magento/Weee/Test/Block/Product/View.php (60%) create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/Constraint/AssertFptApplied.php rename dev/tests/{unit/testsuite/Magento/Framework/Module/Declaration/FileResolver/_files/app/etc/custom/module.xml => functional/tests/app/Magento/Weee/Test/Page/Category/CatalogCategoryView.xml} (73%) create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/Page/CheckoutCart.xml rename dev/tests/{integration/testsuite/Magento/Widget/Model/Config/_files/code/Magento/Test/etc/module.xml => functional/tests/app/Magento/Weee/Test/Page/Product/CatalogProductView.xml} (75%) create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest.php create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/TestCase/CreateTaxWithFptTest/test.csv create mode 100644 dev/tests/functional/tests/app/Magento/Weee/Test/etc/constraint.xml delete mode 100644 dev/tests/integration/framework/Magento/TestFramework/App/Arguments/Proxy.php delete mode 100644 dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/App/Arguments/ProxyTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/Model/Product/PriceTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/product_with_tier_pricing.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Layer/Filter/ItemTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFileTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfoTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Catalog/Service/V1/Category/MetadataServiceTest.php rename app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.10-1.6.0.0.11.php => dev/tests/integration/testsuite/Magento/Catalog/_files/category_attribute.php (73%) rename app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.8-1.6.0.0.9.php => dev/tests/integration/testsuite/Magento/Catalog/_files/category_attribute_rollback.php (59%) rename app/code/Magento/Bundle/data/bundle_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php => dev/tests/integration/testsuite/Magento/Catalog/_files/empty_attribute_group.php (65%) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/empty_attribute_group_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/products_related_multiple.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/products_related_multiple_rollback.php rename app/code/Magento/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0.4-1.6.0.0.5.php => dev/tests/integration/testsuite/Magento/Catalog/_files/validate_image.php (56%) rename app/code/Magento/Eav/sql/eav_setup/upgrade-1.6.0.1-1.6.0.2.php => dev/tests/integration/testsuite/Magento/Catalog/_files/validate_image_info.php (57%) create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/validate_image_info_rollback.php create mode 100644 dev/tests/integration/testsuite/Magento/Catalog/_files/validate_image_rollback.php rename app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.5-1.6.0.0.6.php => dev/tests/integration/testsuite/Magento/Catalog/controllers/_files/attribute_system_popup.php (79%) create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/Model/Indexer/BatchIndexTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogRule/_files/two_rules.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Layer/Filter/AttributeTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Layer/Filter/CategoryTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Layer/Filter/DecimalTest.php create mode 100644 dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Layer/Filter/PriceTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/View/AccordionTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/TabsTest.php rename dev/tests/integration/testsuite/Magento/Customer/{Service/V1/AddressMetadataServiceTest.php => Model/AddressMetadataTest.php} (87%) rename dev/tests/integration/testsuite/Magento/Customer/{Service/V1/CustomerMetadataServiceTest.php => Model/CustomerMetadataTest.php} (84%) rename dev/tests/integration/testsuite/Magento/Customer/{Service/V1 => Model}/FileResolverStub.php (93%) rename app/code/Magento/CatalogInventory/sql/cataloginventory_setup/upgrade-1.6.0.0-1.6.0.0.1.php => dev/tests/integration/testsuite/Magento/Customer/_files/attribute_user_defined_address_custom_attribute_rollback.php (71%) rename app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.19-1.6.0.0.20.php => dev/tests/integration/testsuite/Magento/Eav/_files/empty_attribute_set.php (63%) rename app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.27-1.6.0.0.28.php => dev/tests/integration/testsuite/Magento/Eav/_files/empty_attribute_set_rollback.php (72%) create mode 100644 dev/tests/integration/testsuite/Magento/Framework/App/Resource/ConnectionFactoryTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Code/_files/ClassToFind.php rename dev/tests/{unit/testsuite/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink/ProductEntity/ConverterPoolTests.php => integration/testsuite/Magento/Framework/Model/Resource/Type/Db/ConnectionFactoryTest.php} (52%) create mode 100644 dev/tests/integration/testsuite/Magento/Framework/Model/Resource/Type/Db/Pdo/MysqlTest.php rename dev/tests/integration/testsuite/Magento/Framework/Module/{SetupTest.php => DataSetupTest.php} (91%) rename dev/tests/integration/testsuite/Magento/Framework/Object/Copy/Config/_files/{Magento/Test/etc => }/fieldset.xml (95%) delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Block/Adminhtml/Rule/Edit/FormTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Model/Calculation/Rate/ConverterTest.php rename dev/tests/integration/testsuite/Magento/Tax/{Service/V1/TaxRateServiceTest.php => Model/Calculation/RateRepositoryTest.php} (60%) rename dev/tests/integration/testsuite/Magento/Tax/{Service/V1/TaxCalculationServiceTest.php => Model/TaxCalculationTest.php} (96%) create mode 100644 dev/tests/integration/testsuite/Magento/Tax/Model/TaxClass/ManagementTest.php rename dev/tests/integration/testsuite/Magento/Tax/{Service/V1/TaxClassServiceTest.php => Model/TaxClass/RepositoryTest.php} (50%) rename dev/tests/integration/testsuite/Magento/Tax/{Service/V1/Collection => Model}/TaxRateCollectionTest.php (91%) create mode 100644 dev/tests/integration/testsuite/Magento/Tax/Model/TaxRateManagementTest.php rename dev/tests/integration/testsuite/Magento/Tax/{Service/V1/Collection => Model}/TaxRuleCollectionTest.php (83%) rename dev/tests/integration/testsuite/Magento/Tax/{Service/V1 => Model}/TaxRuleFixtureFactory.php (77%) create mode 100644 dev/tests/integration/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetails/ItemBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/QuoteDetailsBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/AppliedTaxBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetails/ItemBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxDetailsBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRateSearchResultsBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/Data/TaxRuleSearchResultsBuilderTest.php delete mode 100644 dev/tests/integration/testsuite/Magento/Tax/Service/V1/TaxRuleServiceTest.php rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/GeneratorTest.php (93%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/expected/with_context.csv (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/expected/without_context.csv (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/app/code/Magento/FirstModule/Helper/Helper.php (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/app/code/Magento/FirstModule/Model/Model.php (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/app/code/Magento/FirstModule/view/frontend/default.xml (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/app/code/Magento/FirstModule/view/frontend/file.js (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/app/code/Magento/FirstModule/view/frontend/template.phtml (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/app/code/Magento/SecondModule/Model/Model.php (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/app/design/adminhtml/default/backend/default.xml (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/app/design/adminhtml/default/backend/template.phtml (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/lib/web/mage/file.js (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/lib/web/varien/file.js (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/not_magento_dir/Model.php (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/not_magento_dir/file.js (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/_files/source/not_magento_dir/template.phtml (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Pack/GeneratorTest.php (94%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Pack/_files/expected/app/code/Magento/FirstModule/i18n/de_DE.csv (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Pack/_files/expected/app/code/Magento/SecondModule/i18n/de_DE.csv (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Pack/_files/expected/app/design/adminhtml/default/i18n/de_DE.csv (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Pack/_files/expected/lib/web/i18n/de_DE.csv (100%) rename dev/tests/integration/testsuite/Magento/Test/Tools/I18n/{Code => }/Pack/_files/source.csv (100%) delete mode 100644 dev/tests/integration/testsuite/Magento/Widget/Model/Config/FileResolverTest.php rename dev/tests/integration/testsuite/Magento/Widget/Model/Config/_files/{widgetFirst.xml => catalog_new_products_list.xml} (100%) delete mode 100644 dev/tests/integration/testsuite/Magento/Widget/Model/Config/_files/design/frontend/Test/etc/widget.xml rename dev/tests/integration/testsuite/Magento/Widget/Model/Config/_files/{code/Magento/Test/etc/widget.xml => orders_and_returns.xml} (98%) rename dev/tests/integration/testsuite/Magento/Widget/Model/Config/_files/{widgetSecond.xml => orders_and_returns_customized.xml} (100%) delete mode 100644 dev/tests/unit/filename delete mode 100644 dev/tests/unit/filename.csv delete mode 100644 dev/tests/unit/filename.invalid_type create mode 100644 dev/tests/unit/testsuite/Magento/Backend/App/UserConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Model/Plugin/BundleOptionsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Model/Plugin/ProductTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Bundle/Pricing/Price/BundleRegularPriceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Block/Adminhtml/Category/Edit/FormTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Controller/Adminhtml/Category/SaveTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Category/AttributeRepositoryTest.php rename dev/tests/unit/testsuite/Magento/Catalog/{Service/V1/Data => Model}/Category/TreeTest.php (63%) create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/CategoryLinkManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/CategoryLinkRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/CategoryManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/CategoryRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/AttributeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/CategoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/CategoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/DecimalTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/DataProvider/PriceTest.php rename dev/tests/unit/testsuite/Magento/{GroupedProduct/Service/V1/Product/Link/Data/ProductLink/DataMapper/GroupedProductTest.php => Catalog/Model/Layer/Filter/Item/DataBuilderTest.php} (50%) create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Layer/Filter/PriceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/ManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/OptionManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/RepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/SetManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/SetRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Attribute/TypesListTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Gallery/GalleryManagementTest.php rename dev/tests/unit/testsuite/Magento/Catalog/{Service/V1/Product/GroupPriceServiceTest.php => Model/Product/GroupPriceManagementTest.php} (64%) create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/LinkTypeProviderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Media/AttributeManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Product/Option/RepositoryTest.php rename dev/tests/unit/testsuite/Magento/Catalog/{Service/V1/Product/TierPriceServiceTest.php => Model/Product/TierPriceManagementTest.php} (68%) create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/ProductAttributeGroupRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/ProductLink/ManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/ProductLink/RepositoryTest.php rename dev/tests/unit/testsuite/Magento/Catalog/{Service/V1/ProductTypeServiceTest.php => Model/ProductTypeListTest.php} (61%) create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/Product/Attribute/Backend/MediaTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Model/Resource/ProductTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Category/CategoryLoaderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Category/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Category/Tree/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Category/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/Category/MapperTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ConverterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataBuilderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadataTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/Eav/OptionTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductBuilderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Data/ProductMapperTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/MetadataServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/GalleryEntryContentValidatorTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/Data/_files/magento_image.jpg delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/GalleryEntryResolverTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Media/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Option/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/Option/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Attribute/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeGroup/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeGroup/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeSet/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/AttributeSet/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/ConverterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/CompositeTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/DefaultConverterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Converter/SelectTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Reader/DefaultReaderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/Reader/SelectTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata/ReaderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/CustomOptions/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink/CollectionProvider/CrosssellTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink/CollectionProvider/RelatedTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink/CollectionProvider/UpsellTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink/CollectionProviderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink/DataMapper/CompositeTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink/ProductEntity/DefaultConverterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/LinkTypeResolverTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/ReadServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/Link/WriteServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/MetadataServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/ProductLoadProcessorCompositeTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/ProductLoaderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/Product/ProductSaveProcessorCompositeTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Catalog/Service/V1/ProductServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Adapter/Mysql/Filter/PreprocessorTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Catalog/ItemCollectionProviderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Filter/AttributeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Filter/CategoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Filter/DecimalTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Filter/PriceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Layer/Search/AvailabilityFlag/PluginTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Resource/EngineProviderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/CatalogSearch/Model/Search/IndexBuilderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/ConfigurableProduct/Model/Resource/Product/Type/Configurable/AttributeTest.php create mode 100644 dev/tests/unit/testsuite/Magento/ConfigurableProduct/Plugin/Model/Resource/ProductTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/Attribute/GroupRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/AttributeManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/AttributeSetManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/AttributeSetRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Eav/Model/Entity/Attribute/OptionManagementTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/DataBuilderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/MapperTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/SearchResultsBuilderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Api/Code/Generator/SearchResultsTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/Arguments/LoaderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/Arguments/_files/local.xml delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/Arguments/_files/other/local_developer.xml delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/ArgumentsTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/BackendConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/CacheConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/DbConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/EncryptConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/InstallConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/ReaderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/ResourceConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/SessionConfigTest.php rename setup/module/Magento/Config/src/GlobWrapper.php => dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/Writer/PhpFormatterTest.php (61%) create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/WriterTest.php rename setup/module/Magento/Config/src/Resolver.php => dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/_files/config.php (74%) rename setup/module/Magento/Config/src/Sorter.php => dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfig/_files/custom.php (74%) create mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/DeploymentConfigTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/App/Resource/ConnectionFactoryTest.php rename dev/tests/unit/testsuite/Magento/Framework/App/{Arguments/_files/local.php => _files/config.php} (89%) rename dev/tests/unit/testsuite/Magento/Framework/App/{Arguments => }/_files/other/local_developer.php (87%) rename dev/tests/unit/testsuite/Magento/Framework/App/{Arguments => }/_files/other/local_developer_merged.php (87%) create mode 100644 dev/tests/unit/testsuite/Magento/Framework/DB/Logger/FileTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Filesystem/Driver/HttpsTest.php rename app/code/Magento/Sales/Service/V1/Action/CreditmemoCancel.php => dev/tests/unit/testsuite/Magento/Framework/Model/Resource/Type/Db/ConnectionFactoryTest.php (57%) create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Model/Resource/Type/Db/Pdo/MysqlTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/FileResolverTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Module/Declaration/Reader/FilesystemTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Framework/Module/DependencyManagerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Module/ModuleList/DeploymentConfigTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Module/ModuleList/LoaderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Module/SetupTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Framework/Search/Dynamic/IntervalFactoryTest.php rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/AggregateInvokerTest.php (96%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/FilesTest.php (98%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/foo/bar/one.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/foo/bar/recursive/one.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/foo/bar/recursive/two.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/foo/bar/two.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/foo/baz/one.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/foo/baz/two.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/foo/one.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/foo/two.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/list_corrupted_dir.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/list_corrupted_file.txt (100%) rename dev/tests/{static/framework/tests/unit/testsuite/Magento/TestFramework => unit/testsuite/Magento/Framework/Test}/Utility/_files/list_good.txt (100%) create mode 100644 dev/tests/unit/testsuite/Magento/Msrp/Helper/DataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Multishipping/Model/Checkout/Type/Multishipping/PluginTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/OrderConverterTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Quote/Item/AbstractItemTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Service/CreditmemoServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Service/InvoiceServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Service/OrderServiceTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Sales/Model/Service/ShipmentServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/CreditmemoAddCommentTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/CreditmemoCancelTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/CreditmemoCommentsListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/CreditmemoCreateTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/CreditmemoEmailTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/CreditmemoGetTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/CreditmemoListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/InvoiceAddCommentTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/InvoiceCaptureTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/InvoiceCommentsListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/InvoiceCreateTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/InvoiceEmailTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/InvoiceGetTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/InvoiceListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/InvoiceVoidTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderAddressUpdateTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderCancelTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderCommentsListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderEmailTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderGetStatusTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderGetTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderHoldTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderStatusHistoryAddTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/OrderUnHoldTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentAddCommentTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentAddTrackTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentCommentsListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentCreateTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentEmailTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentGetTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentLabelGetTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentListTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Action/ShipmentRemoveTrackTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/CreditmemoReadTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/CreditmemoWriteTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CommentTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoConverterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoItemTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoMapperTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/CreditmemoTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceConverterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceItemTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceMapperTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/InvoiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderAddressTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderItemTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderMapperTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderPaymentTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderStatusHistoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/OrderTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentConverterTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentItemTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentMapperTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/ShipmentTrackTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/Data/TransactionMapperTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/InvoiceReadTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/InvoiceWriteTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderReadTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/OrderWriteTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/ShipmentReadTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/ShipmentWriteTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Sales/Service/V1/TransactionReadTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Controller/Adminhtml/Tax/IgnoreTaxNotificationTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Tax/Helper/DataTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Model/Calculation/RateRepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Model/Config/TaxClassTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Model/Sales/Order/TaxManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Model/TaxCalculationTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/ManagementTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Model/TaxClass/RepositoryTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Tax/Model/TaxRuleRepositoryTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Tax/Service/V1/OrderTaxServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxCalculationServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxClassServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxRateServiceTest.php delete mode 100644 dev/tests/unit/testsuite/Magento/Tax/Service/V1/TaxRuleServiceTest.php rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/ContextTest.php (95%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/GeneratorTest.php (76%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Loader/File/AbstractFileTest.php (79%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Options/ResolverFactoryTest.php (77%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Options/ResolverTest.php (92%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Options/_files/source/app/code/.gitignore (100%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Options/_files/source/app/design/.gitignore (100%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Options/_files/source/lib/web/mage/.gitignore (100%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Options/_files/source/lib/web/varien/.gitignore (100%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/PhraseTest.php (97%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Writer/Csv/StdoTest.php (88%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Writer/CsvTest.php (89%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Dictionary/Writer/_files/.gitignore (100%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/DictionaryTest.php (75%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/FactoryTest.php (83%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/FilesCollectorTest.php (90%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/LocaleTest.php (95%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Pack/GeneratorTest.php (78%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Parser/AbstractParserTest.php (90%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Parser/Adapter/AbstractAdapterTest.php (86%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Parser/Adapter/JsTest.php (91%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Parser/Adapter/PhpTest.php (86%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Parser/Adapter/XmlTest.php (92%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Parser/Adapter/_files/default.xml (100%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Parser/Adapter/_files/file.js (100%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/Parser/ParserTest.php (94%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/_files/files_collector/default.xml (100%) rename dev/tests/unit/testsuite/Magento/Test/Tools/I18n/{Code => }/_files/files_collector/file.js (100%) create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Component/Control/ActionPoolTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Component/Control/ButtonTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Component/Control/ContainerTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Component/FilterPoolTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Component/FilterTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Component/ListingTest.php rename dev/tests/unit/testsuite/Magento/Ui/{ListingContainer/Massaction/ViewTest.php => Component/MassActionTest.php} (84%) rename dev/tests/unit/testsuite/Magento/Ui/{Paging/ViewTest.php => Component/PagingTest.php} (68%) rename dev/tests/unit/testsuite/Magento/Ui/{Sorting/ViewTest.php => Component/SortingTest.php} (87%) rename dev/tests/unit/testsuite/Magento/Ui/ContentType/{Builders => Builder}/ConfigJsonTest.php (95%) rename dev/tests/unit/testsuite/Magento/Ui/ContentType/{Builders => Builder}/ConfigStorageJsonTest.php (83%) create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Context/ConfigurationStorageTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Context/ConfigurationTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Ui/Controller/Adminhtml/Index/RenderTest.php create mode 100644 dev/tests/unit/testsuite/Magento/Widget/Model/Config/FileResolverTest.php rename dev/tools/Magento/Tools/I18n/{Code => }/Context.php (98%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary.php (90%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Generator.php (90%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Loader/File/AbstractFile.php (91%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Loader/File/Csv.php (92%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Loader/FileInterface.php (91%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Options/Resolver.php (98%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Options/ResolverFactory.php (92%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Options/ResolverInterface.php (95%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Phrase.php (99%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Writer/Csv.php (94%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/Writer/Csv/Stdo.php (91%) rename dev/tools/Magento/Tools/I18n/{Code => }/Dictionary/WriterInterface.php (96%) rename dev/tools/Magento/Tools/I18n/{Code => }/Factory.php (87%) rename dev/tools/Magento/Tools/I18n/{Code => }/FilesCollector.php (98%) rename dev/tools/Magento/Tools/I18n/{Code => }/Locale.php (98%) rename dev/tools/Magento/Tools/I18n/{Code => }/Pack/Generator.php (83%) rename dev/tools/Magento/Tools/I18n/{Code => }/Pack/Writer/File/AbstractFile.php (91%) rename dev/tools/Magento/Tools/I18n/{Code => }/Pack/Writer/File/Csv.php (92%) rename dev/tools/Magento/Tools/I18n/{Code => }/Pack/WriterInterface.php (85%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/AbstractParser.php (87%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Adapter/AbstractAdapter.php (95%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Adapter/Js.php (97%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Adapter/Php.php (83%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Adapter/Php/Tokenizer.php (94%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Adapter/Php/Tokenizer/PhraseCollector.php (92%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Adapter/Php/Tokenizer/Token.php (98%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Adapter/Php/Tokenizer/Translate/MethodCollector.php (89%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Adapter/Xml.php (97%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/AdapterInterface.php (96%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Contextual.php (86%) rename dev/tools/Magento/Tools/I18n/{Code => }/Parser/Parser.php (97%) rename dev/tools/Magento/Tools/I18n/{Code => }/ParserInterface.php (97%) rename dev/tools/Magento/Tools/I18n/{Code => }/ServiceLocator.php (84%) delete mode 100644 lib/internal/Magento/Framework/App/Arguments.php delete mode 100644 lib/internal/Magento/Framework/App/Arguments/Loader.php create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig.php create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/AbstractSegment.php create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/BackendConfig.php create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/CacheConfig.php create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/DbConfig.php rename setup/module/Magento/Setup/src/Module/ModuleList.php => lib/internal/Magento/Framework/App/DeploymentConfig/EncryptConfig.php (50%) rename setup/module/Magento/Setup/src/Module/Setup/ConfigFactory.php => lib/internal/Magento/Framework/App/DeploymentConfig/InstallConfig.php (61%) create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/Reader.php create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/ResourceConfig.php rename setup/module/Magento/Locale/src/Data/ListInterface.php => lib/internal/Magento/Framework/App/DeploymentConfig/SegmentInterface.php (61%) create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/SessionConfig.php create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/Writer.php rename setup/module/Magento/Config/src/FileResolverInterface.php => lib/internal/Magento/Framework/App/DeploymentConfig/Writer/FormatterInterface.php (66%) create mode 100644 lib/internal/Magento/Framework/App/DeploymentConfig/Writer/PhpFormatter.php create mode 100644 lib/internal/Magento/Framework/DB/Logger/File.php create mode 100644 lib/internal/Magento/Framework/DB/Logger/LoggerAbstract.php create mode 100644 lib/internal/Magento/Framework/DB/Logger/Null.php create mode 100644 lib/internal/Magento/Framework/DB/LoggerInterface.php rename app/code/Magento/CatalogSearch/Model/Layer/Advanced/ItemCollectionProvider.php => lib/internal/Magento/Framework/Model/Resource/Type/Db/ConnectionFactory.php (51%) create mode 100644 lib/internal/Magento/Framework/Model/Resource/Type/Db/ConnectionFactoryInterface.php create mode 100644 lib/internal/Magento/Framework/Module/DataSetup.php delete mode 100644 lib/internal/Magento/Framework/Module/Declaration/FileResolver.php delete mode 100644 lib/internal/Magento/Framework/Module/Declaration/Reader/Filesystem.php delete mode 100644 lib/internal/Magento/Framework/Module/DependencyManager.php delete mode 100644 lib/internal/Magento/Framework/Module/DependencyManagerInterface.php create mode 100644 lib/internal/Magento/Framework/Module/ModuleList/DeploymentConfig.php create mode 100644 lib/internal/Magento/Framework/Module/ModuleList/Loader.php create mode 100644 lib/internal/Magento/Framework/Object/KeyValueObjectInterface.php create mode 100644 lib/internal/Magento/Framework/ObjectManager/Code/Generator/Persistor.php create mode 100644 lib/internal/Magento/Framework/Search/Adapter/Mysql/Aggregation/Interval.php rename app/code/Magento/CatalogSearch/Model/Resource/EngineFactory.php => lib/internal/Magento/Framework/Search/Adapter/Mysql/Aggregation/IntervalFactory.php (62%) create mode 100644 lib/internal/Magento/Framework/Search/Adapter/Mysql/IndexBuilderInterface.php create mode 100644 lib/internal/Magento/Framework/Search/Dynamic/Algorithm/AbstractAlgorithm.php create mode 100644 lib/internal/Magento/Framework/Search/Dynamic/Algorithm/AlgorithmInterface.php create mode 100644 lib/internal/Magento/Framework/Search/Dynamic/Algorithm/Auto.php create mode 100644 lib/internal/Magento/Framework/Search/Dynamic/Algorithm/Improved.php create mode 100644 lib/internal/Magento/Framework/Search/Dynamic/Algorithm/Manual.php create mode 100644 lib/internal/Magento/Framework/Search/Dynamic/Algorithm/Repository.php rename {dev/tests/static/framework/Magento/TestFramework => lib/internal/Magento/Framework/Test}/Utility/AggregateInvoker.php (98%) rename {dev/tests/static/framework/Magento/TestFramework => lib/internal/Magento/Framework/Test}/Utility/Classes.php (96%) rename {dev/tests/static/framework/Magento/TestFramework => lib/internal/Magento/Framework/Test}/Utility/Files.php (99%) rename setup/module/Magento/Setup/src/Module/ModuleListInterface.php => lib/internal/Magento/Framework/View/Element/UiComponent/DataProviderInterface.php (78%) create mode 100644 lib/internal/Magento/Framework/View/Element/UiElementFactory.php delete mode 100644 lib/web/css/docs/navigation.html create mode 100644 lib/web/css/docs/responsive.html create mode 100644 lib/web/css/docs/source/js/dropdown.js delete mode 100644 lib/web/css/docs/source/navigation.less create mode 100644 lib/web/css/docs/source/responsive.less create mode 100644 lib/web/css/docs/source/utilities.less create mode 100644 lib/web/css/docs/utilities.html delete mode 100644 lib/web/mage/backend/components.js delete mode 100644 lib/web/mage/components.js create mode 100644 lib/web/mage/ie-class-fixer.js create mode 100644 lib/web/mage/utils.js create mode 100644 package.json delete mode 100644 setup/module/Magento/Config/phpunit.xml.dist delete mode 100644 setup/module/Magento/Config/src/Converter/ConverterInterface.php delete mode 100644 setup/module/Magento/Config/src/Reader/Filesystem.php delete mode 100644 setup/module/Magento/Config/src/Reader/ReaderInterface.php delete mode 100644 setup/module/Magento/Config/src/Resolver/ByPattern.php delete mode 100644 setup/module/Magento/Config/tests/Resolver/ByPatternTest.php delete mode 100644 setup/module/Magento/Locale/src/Data/Country.php delete mode 100644 setup/module/Magento/Locale/src/Data/Currency.php delete mode 100644 setup/module/Magento/Locale/src/Data/Language.php delete mode 100644 setup/module/Magento/Locale/src/Data/Locale.php delete mode 100644 setup/module/Magento/Locale/src/Data/Timezone.php rename setup/module/Magento/{Locale/src => Setup/src/Model}/Lists.php (56%) rename setup/module/Magento/Setup/src/Model/{UserConfigurationData.php => UserConfigurationDataMapper.php} (73%) create mode 100644 setup/module/Magento/Setup/src/Module/ConnectionFactory.php delete mode 100644 setup/module/Magento/Setup/src/Module/Converter/Dom.php delete mode 100644 setup/module/Magento/Setup/src/Module/Dependency/Manager.php delete mode 100644 setup/module/Magento/Setup/src/Module/Dir.php delete mode 100644 setup/module/Magento/Setup/src/Module/FileResolver.php delete mode 100644 setup/module/Magento/Setup/src/Module/Reader/Filesystem.php delete mode 100644 setup/module/Magento/Setup/src/Module/Resource/Resource.php rename setup/module/Magento/Setup/src/Module/{Setup/ConnectionFactory.php => ResourceFactory.php} (59%) delete mode 100644 setup/module/Magento/Setup/src/Module/Setup/Config.php create mode 100644 setup/module/Magento/Setup/src/Module/Setup/ConfigMapper.php create mode 100644 setup/module/Magento/Setup/src/Module/Setup/ResourceConfig.php delete mode 100644 setup/module/Magento/Setup/src/Module/Updater/SetupInterface.php diff --git a/.gitignore b/.gitignore index 99db0d9803846..fb602cac912ed 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,7 @@ atlassian* /.idea /.gitattributes /app/config_sandbox -/app/etc/local.xml -/app/etc/*/module.xml +/app/etc/config.php /lib/internal/flex/uploader/.actionScriptProperties /lib/internal/flex/uploader/.flexProperties /lib/internal/flex/uploader/.project @@ -19,6 +18,7 @@ atlassian* /lib/internal/flex/varien/.flexLibProperties /lib/internal/flex/varien/.project /lib/internal/flex/varien/.settings +/node_modules /pub/media/*.* !/pub/media/.htaccess diff --git a/.htaccess b/.htaccess index a0e18f2633dd9..f1ef8719ba1a8 100644 --- a/.htaccess +++ b/.htaccess @@ -188,4 +188,3 @@ ## http://developer.yahoo.com/performance/rules.html#etags #FileETag none - diff --git a/CHANGELOG.md b/CHANGELOG.md index d3b08fe76afdf..b6189e1692c2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,90 @@ +0.1.0-alpha106 +============= +* Various improvements: + * Refactored Service Layer of the Magento_Tax Module + * Stabilized functional tests for the Backend module + * Stabilized functional tests for the CatalogRule module + * Stabilized functional tests for the Checkout module + * Stabilized functional tests for the CurrencySymbol module + * Stabilized functional tests for the Shipping module + * Stabilized functional tests for the Tax module + * Stabilized functional tests for the User module +* Added Readme.md files to the following modules: + * Magento\RequireJs + * Magento\Ui +* Fixed bugs: + * Fixed an issue where product image assignment to a store view was not considered when displaying a product + * Fixed shipping address area blinking when billing address is filled during checkout with a virtual product + * Fixed an issue where filter_store.html was not found + * Fixed an issue where the customer account access menu did not expand on the storefront + * Fixed an issue where CMS blocks did not open when clicking from a grid + * Fixed an issue where the Create Product page was completely blocked after closing the New Attribute pop-up + * Fixed an issue where Stock Status was disabled for Bundle and Grouped products + * Fixed an issue where a product could not be saved without filling a not required bundle option + * Fixed broken "per page" selectors on the Customer's account pages + * Fixed the wrong behavior of JS loaders on the storefront pages + * Fixed Shopping cart price rule form validation + * Fixed an issue where the 'Please wait' spinner persisted when creating a customer custom attribute with existing code + * Fixed a Google Chrome specific issue where subcategories were not displayed correctly on the first hover for category item + * Fixed an issue where the 'Please wait' spinner did not disappear when creating customer with invalid email + * Fixed an issue where the Username field auto-focus on admin login page revealed password in case of fast typing + * Fixed an issue where Bundle Product original Price was not displayed in case of discount + * Fixed wrong discount calculation for bundle options + * Fixed an issue where wrong discount and total amounts were displayed on the order creation page when reordering an order with a bundle product in the Admin panel + * Fixed an issue where admin tax notifications did not appear/disappear unless cache was flushed or disabled + * Fixed an issue where catalog price and shopping cart price did not match when display currency was different from the base currency + * Fixed an issue where Tax classes did not allow 'None' as a valid 'product tax class' + * Fixed an issue where token-based authentication did not work if compilation was enabled + * Fixed the sample code in index.php illustrating multi websites set up + * Fixed commands in Setup CLI to match the ones displayed in help + * Fixed an issue where searching by a part of a product name in Advanced Search did not give correct results + * Fixed an issue where 404 page is displayed after Search Term mass deletion + * Fixed an issue where Popular Search Terms were not displayed on the storefront + * Fixed an issue where it was impossible to add Gift Message during one page checkout + * Fixed an issue where the optional Postal code setting did not work correctly + * Fixed an issue where product price details were missing in summary block in the shopping cart when the Back to shopping cart link was clicked on multishipping page + * Fixed an issue where the 404 error page was displayed instead of the Index Management page after saving mass update + * Fixed an issue where the "Out of Stock" message was not displayed for a bundle product when there was not enough of one of the associated products in stock + * Fixed an issue with the Newsletters Report page in the Admin panel + * Fixed an issue where Catalog price rule was not applying correct rates on specific products + * Fixed an issue where a fatal error was thrown after clicking a link to a downloadable product + * Fixed an issue a warning page for Grouped product with enabled MAP + * Fixed an issue where a configurable product was not displayed in catalog product grid after updating with "Add configurable attributes to the new set based on current" + * Fixed the inconsistent behavior in the integration tests for the Indexer functionality + * Fixed an issue where the What's this? information tip link was not presented on product page with configured Minimum Advertised Price (MAP) +* Processed GitHub requests: + * [#742](https://github.com/magento/magento2/issues/742) -- Admin notifications count overflow + * [#720](https://github.com/magento/magento2/issues/720) -- https filedriver is not working + * [#686](https://github.com/magento/magento2/issues/686) -- Product save validation errors in the admin don't hide the overlay + * [#702](https://github.com/magento/magento2/issues/702) -- Base table or view not found + * [#652](https://github.com/magento/magento2/issues/652) -- Multishipping checkout not to change the Billing address js issue + * [#648](https://github.com/magento/magento2/issues/648) -- An equal (=) sign in the hash of the product page to to break the tabs functionality +* Service Contracts: + * Refactored usage of new API of the Customer module + * Implemented Service Contracts for the Sales module + * Refactored Service Contracts for the Catalog module + * Refactored Service Contracts for the Grouped module +* UI Improvements: + * Implemented the Form component in Magento UI Library + * Removed extra JS loaders for category saving + * Improved the behavior of Categories management in the Admin panel + * Implemented the keyboard navigation through HTML elements + * Improved the HTML structure and UI of the Catalog Category Link, Catalog Product Link and CMS Static Block widgets + * Added UI Library documentation + * Fixed Blank & Luma themes UI bugs + * Fixed footer alignment + * Published the Luma theme and removed the Plushe theme +* Framework Improvements: + * Added the ability to configure the list of loaded modules before installation + * Merged SQL and Data Upgrades + * Moved \Magento\TestFramework\Utility\Files to Magento Framework +* Setup tool improvements: + * Removed duplication with Framework + * Deployment configuration is refactored from XML format in local.xml to associated array in config.php + * Improved performance +* Search improvements: + * Integrated the Full Text Search library into the Layered Navigation functionality + 0.1.0-alpha105 ============= * Various improvements: @@ -1891,7 +1978,7 @@ * LESS styles library added in pub/lib/css/ * A new Blank theme set as default * GitHub requests: - * [#491](https://github.com/magento/magento2/pull/491) -- Fixed bug, incorrect auto-generation Category URL for some groups of symbols (idish, cirrilic, é, ä, and other). + * [#491](https://github.com/magento/magento2/pull/491) -- Fixed bug, incorrect auto-generation Category URL for some groups of symbols (idish, cirrilic, e, a, and other). * [#480](https://github.com/magento/magento2/pull/480) -- Fixing a bug for loading config from local.xml * [#472](https://github.com/magento/magento2/issues/472) -- Params passed in pub/index.php being overwritten * [#461](https://github.com/magento/magento2/pull/461) -- Use translates for Quote\Address\Total\Shipping diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000000000..05d2fbf33b5aa --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,105 @@ +// # Globbing +// for performance reasons we're only matching one level down: +// 'test/spec/{,*/}*.js' +// If you want to recursively match all subfolders, use: +// 'test/spec/**/*.js' + +module.exports = function (grunt) { + + // Time how long tasks take. Can help when optimizing build times + require('time-grunt')(grunt); + + // Load grunt tasks automatically + require('load-grunt-tasks')(grunt); + + // Configurable paths and file names + var config = { + pub: 'pub', + var: 'var', + doc: { + path: 'lib/web/css/docs', + styleName: 'docs' + } + }; + + // Define the configuration for all the tasks + grunt.initConfig({ + + // Project settings + config: config, + + // Empties folders to start fresh + clean: { + var: { + files: [{ + dot: true, + src: [ + '<%= config.var %>/cache/*', + '<%= config.var %>/generation/*', + '<%= config.var %>/log/*', + '<%= config.var %>/maps/*', + '<%= config.var %>/page_cache/*', + '<%= config.var %>/tmp/*', + '<%= config.var %>/view/*', + '<%= config.var %>/view_preprocessed/*' + ] + }] + }, + pub: { + files: [{ + dot: true, + src: [ + '<%= config.pub %>/static/frontend/*', + '<%= config.pub %>/static/adminhtml/*' + ] + }] + } + }, + + // Compiles Less to CSS and generates necessary files if requested + less: { + documentation: { + options: { + sourceMap: false, + ieCompat: false, + paths: ['<%= config.doc.path %>/source/'] + }, + files: { + '<%= config.doc.path %>/<%= config.doc.styleName %>.css': "<%= config.doc.path %>/source/<%= config.doc.styleName %>.less" + } + } + }, + + styledocco: { + documentation: { + options: { + name: 'Magento UI Library', + verbose: true, + include: [ + '<%= config.doc.path %>/<%= config.doc.styleName %>.css', + 'lib/web/jquery/jquery.min.js', + 'lib/web/jquery/jquery-ui.min', + '<%= config.doc.path %>/source/js/dropdown.js' + ] + }, + files: { + '<%= config.doc.path %>': '<%= config.doc.path %>/source' + } + } + } + + }); + + grunt.registerTask('default', []); + + grunt.registerTask('cleanup', [ + 'clean:var', + 'clean:pub' + ]); + + grunt.registerTask('documentation', [ + 'less:documentation', + 'styledocco:documentation', + 'cleanup' + ]); +}; diff --git a/app/code/Magento/AdminNotification/Model/Feed.php b/app/code/Magento/AdminNotification/Model/Feed.php index 49fa68a72d149..9cf50c65f43c6 100644 --- a/app/code/Magento/AdminNotification/Model/Feed.php +++ b/app/code/Magento/AdminNotification/Model/Feed.php @@ -62,11 +62,11 @@ class Feed extends \Magento\Framework\Model\AbstractModel protected $curlFactory; /** - * Application arguments + * Deployment configuration * - * @var \Magento\Framework\App\Arguments + * @var \Magento\Framework\App\DeploymentConfig */ - protected $_args; + protected $_deploymentConfig; /** * @param \Magento\Framework\Model\Context $context @@ -74,7 +74,7 @@ class Feed extends \Magento\Framework\Model\AbstractModel * @param \Magento\Backend\App\ConfigInterface $backendConfig * @param \Magento\AdminNotification\Model\InboxFactory $inboxFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource - * @param \Magento\Framework\App\Arguments $args + * @param \Magento\Framework\App\DeploymentConfig $deploymentConfig * @param \Magento\Framework\Data\Collection\Db $resourceCollection * @param \Magento\Framework\HTTP\Adapter\curlFactory $curlFactory * @param array $data @@ -85,7 +85,7 @@ public function __construct( \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\AdminNotification\Model\InboxFactory $inboxFactory, \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory, - \Magento\Framework\App\Arguments $args, + \Magento\Framework\App\DeploymentConfig $deploymentConfig, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() @@ -94,7 +94,7 @@ public function __construct( $this->_backendConfig = $backendConfig; $this->_inboxFactory = $inboxFactory; $this->curlFactory = $curlFactory; - $this->_args = $args; + $this->_deploymentConfig = $deploymentConfig; } /** @@ -135,7 +135,7 @@ public function checkUpdate() $feedXml = $this->getFeedData(); - $installDate = strtotime($this->_args->get('install_date')); + $installDate = strtotime($this->_deploymentConfig->get('install/date')); if ($feedXml && $feedXml->channel && $feedXml->channel->item) { foreach ($feedXml->channel->item as $item) { diff --git a/app/code/Magento/AdminNotification/Model/System/Message/Security.php b/app/code/Magento/AdminNotification/Model/System/Message/Security.php index be4632352156b..4480962609fcb 100644 --- a/app/code/Magento/AdminNotification/Model/System/Message/Security.php +++ b/app/code/Magento/AdminNotification/Model/System/Message/Security.php @@ -35,7 +35,7 @@ class Security implements \Magento\Framework\Notification\MessageInterface * * @var string */ - private $_filePath = 'app/etc/local.xml'; + private $_filePath = 'app/etc/config.php'; /** * Time out for HTTP verification request diff --git a/app/code/Magento/AdminNotification/composer.json b/app/code/Magento/AdminNotification/composer.json index 4a6da5988567d..51359c783f75d 100644 --- a/app/code/Magento/AdminNotification/composer.json +++ b/app/code/Magento/AdminNotification/composer.json @@ -3,15 +3,15 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha105", - "magento/module-core": "0.1.0-alpha105", - "magento/module-backend": "0.1.0-alpha105", - "magento/framework": "0.1.0-alpha105", + "magento/module-store": "0.1.0-alpha106", + "magento/module-core": "0.1.0-alpha106", + "magento/module-backend": "0.1.0-alpha106", + "magento/framework": "0.1.0-alpha106", "lib-libxml": "*", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha105", + "version": "0.1.0-alpha106", "extra": { "map": [ [ diff --git a/app/code/Magento/AdminNotification/etc/module.xml b/app/code/Magento/AdminNotification/etc/module.xml index 68a4115f67c14..812434fd201d3 100644 --- a/app/code/Magento/AdminNotification/etc/module.xml +++ b/app/code/Magento/AdminNotification/etc/module.xml @@ -24,7 +24,7 @@ */ --> - + diff --git a/app/code/Magento/AdminNotification/view/adminhtml/requirejs-config.js b/app/code/Magento/AdminNotification/view/adminhtml/requirejs-config.js new file mode 100644 index 0000000000000..7c52d5f8b21f7 --- /dev/null +++ b/app/code/Magento/AdminNotification/view/adminhtml/requirejs-config.js @@ -0,0 +1,33 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +var config = { + map: { + '*': { + systemMessageDialog: 'Magento_AdminNotification/system/notification' + } + }, + deps: [ + "Magento_AdminNotification/toolbar_entry" + ] +}; \ No newline at end of file diff --git a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml index c61adb990efbf..58706c81bf36f 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml +++ b/app/code/Magento/AdminNotification/view/adminhtml/templates/toolbar_entry.phtml @@ -26,7 +26,7 @@ getUnreadNotificationCount(); ?>
0) : ?> - + escapeHtml($notificationCount); ?> diff --git a/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js b/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js index b5710b6b02861..0a654fbe503b6 100644 --- a/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js +++ b/app/code/Magento/AdminNotification/view/adminhtml/web/system/notification.js @@ -63,4 +63,5 @@ define([ }); }); + return $.mage.systemMessageDialog; }); diff --git a/app/code/Magento/Authorization/Model/Resource/Setup.php b/app/code/Magento/Authorization/Model/Resource/Setup.php index e66ee4ec3dd32..617a49cd97a78 100644 --- a/app/code/Magento/Authorization/Model/Resource/Setup.php +++ b/app/code/Magento/Authorization/Model/Resource/Setup.php @@ -29,7 +29,7 @@ * @SuppressWarnings(PHPMD.LongVariable) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Setup extends \Magento\Framework\Module\Setup +class Setup extends \Magento\Framework\Module\DataSetup { /** * Role model factory diff --git a/app/code/Magento/Authorization/composer.json b/app/code/Magento/Authorization/composer.json index a6e58fc3c4dda..f3f935306863f 100644 --- a/app/code/Magento/Authorization/composer.json +++ b/app/code/Magento/Authorization/composer.json @@ -3,12 +3,12 @@ "description": "Authorization module provides access to Magento ACL functionality.", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-backend": "0.1.0-alpha105", - "magento/framework": "0.1.0-alpha105", + "magento/module-backend": "0.1.0-alpha106", + "magento/framework": "0.1.0-alpha106", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha105", + "version": "0.1.0-alpha106", "extra": { "map": [ [ diff --git a/app/code/Magento/Authorization/etc/module.xml b/app/code/Magento/Authorization/etc/module.xml index 4224828dc06f4..5103ef19308c8 100644 --- a/app/code/Magento/Authorization/etc/module.xml +++ b/app/code/Magento/Authorization/etc/module.xml @@ -24,7 +24,7 @@ */ --> - + diff --git a/app/code/Magento/Authorizenet/Model/Authorizenet.php b/app/code/Magento/Authorizenet/Model/Authorizenet.php index 599e5b3a3edeb..76d305bfdae9a 100644 --- a/app/code/Magento/Authorizenet/Model/Authorizenet.php +++ b/app/code/Magento/Authorizenet/Model/Authorizenet.php @@ -1377,6 +1377,7 @@ protected function _getRequest() */ protected function _buildRequest(\Magento\Framework\Object $payment) { + /** @var \Magento\Sales\Model\Order $order */ $order = $payment->getOrder(); $this->setStore($order->getStoreId()); @@ -1439,7 +1440,7 @@ protected function _buildRequest(\Magento\Framework\Object $payment) )->setXCompany( $billing->getCompany() )->setXAddress( - $billing->getStreet(1) + $billing->getStreetLine(1) )->setXCity( $billing->getCity() )->setXState( @@ -1476,7 +1477,7 @@ protected function _buildRequest(\Magento\Framework\Object $payment) )->setXShipToCompany( $shipping->getCompany() )->setXShipToAddress( - $shipping->getStreet(1) + $shipping->getStreetLine(1) )->setXShipToCity( $shipping->getCity() )->setXShipToState( diff --git a/app/code/Magento/Authorizenet/Model/Directpost/Request.php b/app/code/Magento/Authorizenet/Model/Directpost/Request.php index 1a817b845df76..6648c9f6a0f07 100644 --- a/app/code/Magento/Authorizenet/Model/Directpost/Request.php +++ b/app/code/Magento/Authorizenet/Model/Directpost/Request.php @@ -144,7 +144,7 @@ public function setDataFromOrder( )->setXCompany( strval($billing->getCompany()) )->setXAddress( - strval($billing->getStreet(1)) + strval($billing->getStreetLine(1)) )->setXCity( strval($billing->getCity()) )->setXState( @@ -181,7 +181,7 @@ public function setDataFromOrder( )->setXShipToCompany( strval($shipping->getCompany()) )->setXShipToAddress( - strval($shipping->getStreet(1)) + strval($shipping->getStreetLine(1)) )->setXShipToCity( strval($shipping->getCity()) )->setXShipToState( diff --git a/app/code/Magento/Authorizenet/composer.json b/app/code/Magento/Authorizenet/composer.json index d1dc6d32c91f8..e6356ba34317c 100644 --- a/app/code/Magento/Authorizenet/composer.json +++ b/app/code/Magento/Authorizenet/composer.json @@ -3,18 +3,18 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-sales": "0.1.0-alpha105", - "magento/module-checkout": "0.1.0-alpha105", - "magento/module-backend": "0.1.0-alpha105", - "magento/module-core": "0.1.0-alpha105", - "magento/module-payment": "0.1.0-alpha105", - "magento/module-centinel": "0.1.0-alpha105", - "magento/module-catalog": "0.1.0-alpha105", - "magento/framework": "0.1.0-alpha105", + "magento/module-sales": "0.1.0-alpha106", + "magento/module-checkout": "0.1.0-alpha106", + "magento/module-backend": "0.1.0-alpha106", + "magento/module-core": "0.1.0-alpha106", + "magento/module-payment": "0.1.0-alpha106", + "magento/module-centinel": "0.1.0-alpha106", + "magento/module-catalog": "0.1.0-alpha106", + "magento/framework": "0.1.0-alpha106", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha105", + "version": "0.1.0-alpha106", "extra": { "map": [ [ diff --git a/app/code/Magento/Authorizenet/etc/module.xml b/app/code/Magento/Authorizenet/etc/module.xml index dd8f3d7b1bb01..24da9bc21c871 100644 --- a/app/code/Magento/Authorizenet/etc/module.xml +++ b/app/code/Magento/Authorizenet/etc/module.xml @@ -24,7 +24,7 @@ */ --> - + diff --git a/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js b/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js new file mode 100644 index 0000000000000..40ac5ab24372a --- /dev/null +++ b/app/code/Magento/Authorizenet/view/frontend/requirejs-config.js @@ -0,0 +1,31 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +var config = { + map: { + '*': { + authorizenetAuthenticate: 'Magento_Authorizenet/authorizenet-authenticate', + directpost: 'Magento_Authorizenet/js/direct-post' + } + } +}; \ No newline at end of file diff --git a/app/code/Magento/Authorizenet/view/frontend/templates/directpost/form.phtml b/app/code/Magento/Authorizenet/view/frontend/templates/directpost/form.phtml index ae67dc82f2218..1303d70ba716f 100644 --- a/app/code/Magento/Authorizenet/view/frontend/templates/directpost/form.phtml +++ b/app/code/Magento/Authorizenet/view/frontend/templates/directpost/form.phtml @@ -54,7 +54,7 @@ $_orderUrl = $this->helper('Magento\Authorizenet\Helper\Data')->getPlaceOrderFro
- +
@@ -88,7 +88,7 @@ $_orderUrl = $this->helper('Magento\Authorizenet\Helper\Data')->getPlaceOrderFro
- + getViewFileUrl('Magento_Checkout::cvv.gif').'\" alt=\"'.__('Card Verification Number Visual Reference').'\" title=\"'.__('Card Verification Number Visual Reference').'\" />'; ?>
diff --git a/app/code/Magento/Authorizenet/view/frontend/web/authorizenet-authenticate.js b/app/code/Magento/Authorizenet/view/frontend/web/authorizenet-authenticate.js index 2a1df028436f0..1096024d97122 100644 --- a/app/code/Magento/Authorizenet/view/frontend/web/authorizenet-authenticate.js +++ b/app/code/Magento/Authorizenet/view/frontend/web/authorizenet-authenticate.js @@ -83,4 +83,5 @@ define([ } }); + return $.mage.authorizenetAuthenticate; }); \ No newline at end of file diff --git a/app/code/Magento/Authorizenet/view/frontend/web/js/direct-post.js b/app/code/Magento/Authorizenet/view/frontend/web/js/direct-post.js index dfc73e6c538e6..fbafe7ad1ed13 100644 --- a/app/code/Magento/Authorizenet/view/frontend/web/js/direct-post.js +++ b/app/code/Magento/Authorizenet/view/frontend/web/js/direct-post.js @@ -147,5 +147,5 @@ define([ } }); - + return $.mage.directpost; }); \ No newline at end of file diff --git a/app/code/Magento/Backend/App/Area/FrontNameResolver.php b/app/code/Magento/Backend/App/Area/FrontNameResolver.php index 6befd8b275d95..863e2f7b4d8e9 100644 --- a/app/code/Magento/Backend/App/Area/FrontNameResolver.php +++ b/app/code/Magento/Backend/App/Area/FrontNameResolver.php @@ -25,13 +25,15 @@ */ namespace Magento\Backend\App\Area; +use Magento\Framework\App\DeploymentConfig; + class FrontNameResolver implements \Magento\Framework\App\Area\FrontNameResolverInterface { const XML_PATH_USE_CUSTOM_ADMIN_PATH = 'admin/url/use_custom_path'; const XML_PATH_CUSTOM_ADMIN_PATH = 'admin/url/custom_path'; - const PARAM_BACKEND_FRONT_NAME = 'backend.frontName'; + const PARAM_BACKEND_FRONT_NAME = 'backend/frontName'; /** * Backend area code @@ -41,21 +43,28 @@ class FrontNameResolver implements \Magento\Framework\App\Area\FrontNameResolver /** * @var string */ - protected $_defaultFrontName; + protected $defaultFrontName; /** * @var \Magento\Backend\App\ConfigInterface */ - protected $_config; + protected $config; + + /** + * Deployment configuration + * + * @var DeploymentConfig + */ + protected $deploymentConfig; /** * @param \Magento\Backend\App\Config $config - * @param string $defaultFrontName + * @param DeploymentConfig $deploymentConfig */ - public function __construct(\Magento\Backend\App\Config $config, $defaultFrontName) + public function __construct(\Magento\Backend\App\Config $config, DeploymentConfig $deploymentConfig) { - $this->_config = $config; - $this->_defaultFrontName = $defaultFrontName; + $this->config = $config; + $this->defaultFrontName = $deploymentConfig->get(self::PARAM_BACKEND_FRONT_NAME); } /** @@ -65,10 +74,10 @@ public function __construct(\Magento\Backend\App\Config $config, $defaultFrontNa */ public function getFrontName() { - $isCustomPathUsed = (bool)(string)$this->_config->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_PATH); + $isCustomPathUsed = (bool)(string)$this->config->getValue(self::XML_PATH_USE_CUSTOM_ADMIN_PATH); if ($isCustomPathUsed) { - return (string)$this->_config->getValue(self::XML_PATH_CUSTOM_ADMIN_PATH); + return (string)$this->config->getValue(self::XML_PATH_CUSTOM_ADMIN_PATH); } - return $this->_defaultFrontName; + return $this->defaultFrontName; } } diff --git a/app/code/Magento/Backend/App/UserConfig.php b/app/code/Magento/Backend/App/UserConfig.php new file mode 100644 index 0000000000000..810218bc24661 --- /dev/null +++ b/app/code/Magento/Backend/App/UserConfig.php @@ -0,0 +1,106 @@ +response = $response; + $this->request = $request; + $this->configFactory = $configFactory; + } + + /** + * Run application + * + * @return \Magento\Framework\App\ResponseInterface + */ + public function launch() + { + $this->response->terminateOnSend(false); + $this->updateUserConfigData(); + return $this->response; + } + + /** + * Inserts provided user configuration data into database + * + * @return void + */ + private function updateUserConfigData() + { + foreach ($this->request as $key => $val) { + $configModel = $this->configFactory->create(); + $configModel->setDataByPath($key, $val); + $configModel->save(); + } + } + + /** + * {@inheritdoc} + */ + public function catchException(Bootstrap $bootstrap, \Exception $exception) + { + return false; + } +} diff --git a/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php b/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php index 4eaac1716b277..b41f7f8be6090 100644 --- a/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php +++ b/app/code/Magento/Backend/Block/System/Config/Form/Fieldset/Modules/DisableOutput.php @@ -75,7 +75,7 @@ public function render(\Magento\Framework\Data\Form\Element\AbstractElement $ele { $html = $this->_getHeaderHtml($element); - $modules = array_keys($this->_moduleList->getModules()); + $modules = $this->_moduleList->getNames(); $dispatchResult = new \Magento\Framework\Object($modules); $this->_eventManager->dispatch( diff --git a/app/code/Magento/Backend/Helper/Dashboard/Data.php b/app/code/Magento/Backend/Helper/Dashboard/Data.php index 83e1283e64568..666f5f6cb378d 100644 --- a/app/code/Magento/Backend/Helper/Dashboard/Data.php +++ b/app/code/Magento/Backend/Helper/Dashboard/Data.php @@ -23,6 +23,8 @@ */ namespace Magento\Backend\Helper\Dashboard; +use \Magento\Framework\App\DeploymentConfig; + /** * Data helper for dashboard */ @@ -38,13 +40,18 @@ class Data extends \Magento\Core\Helper\Data */ protected $_installDate; + /** + * Configuration key to installation date + */ + const INSTALL_DATE = 'install/date'; + /** * @param \Magento\Framework\App\Helper\Context $context * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\App\State $appState * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency - * @param string $installDate + * @param DeploymentConfig $deploymentConfig * @param bool $dbCompatibleMode */ public function __construct( @@ -53,7 +60,7 @@ public function __construct( \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Framework\App\State $appState, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, - $installDate, + DeploymentConfig $deploymentConfig, $dbCompatibleMode = true ) { parent::__construct( @@ -64,7 +71,7 @@ public function __construct( $priceCurrency, $dbCompatibleMode ); - $this->_installDate = $installDate; + $this->_installDate = $deploymentConfig->get(self::INSTALL_DATE); } /** diff --git a/app/code/Magento/Backend/Model/Config.php b/app/code/Magento/Backend/Model/Config.php index 08a06b81626c6..78fdda3bd0a7d 100644 --- a/app/code/Magento/Backend/Model/Config.php +++ b/app/code/Magento/Backend/Model/Config.php @@ -361,6 +361,41 @@ public function extendConfig($path, $full = true, $oldConfig = array()) return $extended; } + /** + * Add data by path section/group/field + * + * @param string $path + * @param mixed $value + * @return void + * @throws \UnexpectedValueException + */ + public function setDataByPath($path, $value) + { + $path = trim($path); + if ($path === '') { + throw new \UnexpectedValueException('Path must not be empty'); + } + $pathParts = explode('/', $path); + $keyDepth = count($pathParts); + if ($keyDepth !== 3) { + throw new \UnexpectedValueException( + "Allowed depth of configuration is 3 (
//). Your configuration depth is " + . $keyDepth . " for path '$path'" + ); + } + $data = [ + 'section' => $pathParts[0], + 'groups' => [ + $pathParts[1] => [ + 'fields' => [ + $pathParts[2] => ['value' => $value], + ], + ], + ], + ]; + $this->addData($data); + } + /** * Get scope name and scopeId * @todo refactor to scope resolver diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php index 822b65cb2f22d..88f9ff4178979 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custom.php @@ -78,7 +78,7 @@ public function __construct( * * @return $this */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); @@ -95,7 +95,7 @@ protected function _beforeSave() * * @return $this */ - public function _afterSave() + public function afterSave() { $useCustomUrl = $this->getData('groups/url/fields/use_custom/value'); $value = $this->getValue(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php index 6f2639a95cdb5..b4591ae192ddb 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Custompath.php @@ -36,7 +36,7 @@ class Custompath extends \Magento\Framework\App\Config\Value * * @return $this */ - protected function _beforeSave() + public function beforeSave() { if ($this->getOldValue() != $this->getValue()) { $this->_registry->register('custom_admin_path_redirect', true, true); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Password/Link/Expirationperiod.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Password/Link/Expirationperiod.php index 077b2cbaae84d..3a0ae9bd3189b 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Password/Link/Expirationperiod.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Password/Link/Expirationperiod.php @@ -36,9 +36,9 @@ class Expirationperiod extends \Magento\Framework\App\Config\Value * * @return $this */ - protected function _beforeSave() + public function beforeSave() { - parent::_beforeSave(); + parent::beforeSave(); $expirationPeriod = (int)$this->getValue(); if ($expirationPeriod < 1) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php index 7612bc3734aca..b68290918f98c 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Robots.php @@ -96,12 +96,12 @@ protected function _afterLoad() * * @return $this */ - protected function _afterSave() + public function afterSave() { if ($this->getValue()) { $this->_directory->writeFile($this->_file, $this->getValue()); } - return parent::_afterSave(); + return parent::afterSave(); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php index 31a1218e8144c..b7c4438043401 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usecustom.php @@ -65,7 +65,7 @@ public function __construct( * @return $this * @throws \Magento\Framework\Model\Exception */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); if ($value == 1) { @@ -83,7 +83,7 @@ protected function _beforeSave() * * @return $this */ - protected function _afterSave() + public function afterSave() { $value = $this->getValue(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php index 85601783b7b35..d8e998117e8de 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Admin/Usesecretkey.php @@ -59,7 +59,7 @@ public function __construct( /** * @return $this */ - protected function _afterSave() + public function afterSave() { $this->_backendUrl->renewSecretUrls(); return $this; diff --git a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php index 37405568eebe3..a5b7988782c46 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Baseurl.php @@ -58,7 +58,7 @@ public function __construct( * @return void * @throws \Magento\Framework\Model\Exception */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); try { @@ -218,7 +218,7 @@ private function _isFullyQualifiedUrl($value) * * @return void */ - protected function _afterSave() + public function afterSave() { if ($this->isValueChanged()) { switch ($this->getPath()) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Cache.php b/app/code/Magento/Backend/Model/Config/Backend/Cache.php index d14e8f2dbf651..083f17da2d239 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Cache.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Cache.php @@ -42,7 +42,7 @@ class Cache extends \Magento\Framework\App\Config\Value * * @return void */ - protected function _afterSave() + public function afterSave() { if ($this->isValueChanged()) { $this->_cacheManager->clean($this->_cacheTags); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Cookie/Domain.php b/app/code/Magento/Backend/Model/Config/Backend/Cookie/Domain.php index 60f950e8a7daa..c6a61e219e557 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Cookie/Domain.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Cookie/Domain.php @@ -61,7 +61,7 @@ public function __construct( * @return void * @throws \Magento\Framework\Model\Exception */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Cookie/Lifetime.php b/app/code/Magento/Backend/Model/Config/Backend/Cookie/Lifetime.php index 157942607d538..05e58c2319ae3 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Cookie/Lifetime.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Cookie/Lifetime.php @@ -61,7 +61,7 @@ public function __construct( * @return void * @throws \Magento\Framework\Model\Exception */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Cookie/Path.php b/app/code/Magento/Backend/Model/Config/Backend/Cookie/Path.php index 731f2f37aab85..4d84e88f05879 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Cookie/Path.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Cookie/Path.php @@ -61,7 +61,7 @@ public function __construct( * @return void * @throws \Magento\Framework\Model\Exception */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php index 449fc5ed4601a..f114996b49a36 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Allow.php @@ -66,7 +66,7 @@ public function __construct( * @return $this * @throws \Magento\Framework\Model\Exception */ - protected function _afterSave() + public function afterSave() { $exceptions = array(); foreach ($this->_getAllowedCurrencies() as $currencyCode) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php index 878153d5c0ab9..285ebbcc892fc 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Base.php @@ -36,7 +36,7 @@ class Base extends AbstractCurrency * @return $this * @throws \Magento\Framework\Model\Exception */ - protected function _afterSave() + public function afterSave() { if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { throw new \Magento\Framework\Model\Exception(__('Sorry, we haven\'t installed the base currency you selected.')); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php index 3aa3f59bd3204..500ebc4494040 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/Cron.php @@ -62,7 +62,7 @@ public function __construct( * @return void * @throws \Exception */ - protected function _afterSave() + public function afterSave() { $time = $this->getData('groups/import/fields/time/value'); $frequency = $this->getData('groups/import/fields/frequency/value'); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php b/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php index 32dfbfe3e8598..55387b89dbd4b 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Currency/DefaultCurrency.php @@ -37,7 +37,7 @@ class DefaultCurrency extends AbstractCurrency * @return $this * @throws \Magento\Framework\Model\Exception */ - protected function _afterSave() + public function afterSave() { if (!in_array($this->getValue(), $this->_getInstalledCurrencies())) { throw new \Magento\Framework\Model\Exception( diff --git a/app/code/Magento/Backend/Model/Config/Backend/Datashare.php b/app/code/Magento/Backend/Model/Config/Backend/Datashare.php index a26a0f72683eb..07b1ca8960ce1 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Datashare.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Datashare.php @@ -34,7 +34,7 @@ class Datashare extends \Magento\Framework\App\Config\Value /** * @return void */ - protected function _afterSave() + public function afterSave() { } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php index 63e8fc0695b38..8a7cf54ac7b67 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Address.php @@ -35,7 +35,7 @@ class Address extends \Magento\Framework\App\Config\Value * @return $this * @throws Exception */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); if (!\Zend_Validate::is($value, 'EmailAddress')) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Logo.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Logo.php index 7db80f69a8797..ead250de9d559 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Logo.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Logo.php @@ -70,7 +70,7 @@ protected function _addWhetherScopeInfo() * * @return $this */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); $deleteFlag = is_array($value) && !empty($value['delete']); @@ -79,6 +79,6 @@ protected function _beforeSave() if ($this->getOldValue() && ($fileTmpName || $deleteFlag)) { $this->_mediaDirectory->delete(self::UPLOAD_DIR . '/' . $this->getOldValue()); } - return parent::_beforeSave(); + return parent::beforeSave(); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php b/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php index 4bb32ad17efe2..6f7a26dd2198a 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Email/Sender.php @@ -35,7 +35,7 @@ class Sender extends \Magento\Framework\App\Config\Value * @return $this * @throws \Magento\Framework\Model\Exception */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); if (!preg_match("/^[\S ]+$/", $value)) { diff --git a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php index 7a1186310282c..1d3f99379532e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Encrypted.php @@ -94,7 +94,7 @@ protected function _afterLoad() * * @return void */ - protected function _beforeSave() + public function beforeSave() { $value = (string)$this->getValue(); // don't change value, if an obscured value came diff --git a/app/code/Magento/Backend/Model/Config/Backend/File.php b/app/code/Magento/Backend/Model/Config/Backend/File.php index 12cffc5be8ada..c2e34dbd6dbcb 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/File.php +++ b/app/code/Magento/Backend/Model/Config/Backend/File.php @@ -95,7 +95,7 @@ public function __construct( * @return $this * @throws \Magento\Framework\Model\Exception */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); $tmpName = $this->_requestData->getTmpName($this->getPath()); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Filename.php b/app/code/Magento/Backend/Model/Config/Backend/Filename.php index b56a9ea7290cf..aeef55c452d1a 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Filename.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Filename.php @@ -28,7 +28,7 @@ class Filename extends \Magento\Framework\App\Config\Value /** * @return $this */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); $value = basename($value); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php index 317e14fc41c28..06878ccfca63e 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Image/Adapter.php @@ -65,7 +65,7 @@ public function __construct( * @throws \Magento\Framework\Model\Exception If some of adapter dependencies was not loaded * @return \Magento\Backend\Model\Config\Backend\File */ - protected function _beforeSave() + public function beforeSave() { try { $this->_imageFactory->create($this->getValue()); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale.php b/app/code/Magento/Backend/Model/Config/Backend/Locale.php index ee48299ff9ae5..3134eb80a7d2f 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Locale.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Locale.php @@ -86,7 +86,7 @@ public function __construct( * @return $this * @throws \Magento\Framework\Model\Exception */ - protected function _afterSave() + public function afterSave() { /** @var $collection \Magento\Core\Model\Resource\Config\Data\Collection */ $collection = $this->_configsFactory->create(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php b/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php index 80c9a85df2615..d0d0f9af843c4 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Locale/Timezone.php @@ -35,7 +35,7 @@ class Timezone extends \Magento\Framework\App\Config\Value * @return $this * @throws Exception */ - protected function _beforeSave() + public function beforeSave() { if (!in_array($this->getValue(), \DateTimeZone::listIdentifiers(\DateTimeZone::ALL_WITH_BC))) { throw new Exception(__('Please correct the timezone.')); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php index 084e25f324c51..cb66a498bd853 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Log/Cron.php @@ -74,7 +74,7 @@ public function __construct( * @return void * @throws \Magento\Framework\Model\Exception */ - protected function _afterSave() + public function afterSave() { $enabled = $this->getData('groups/log/fields/enabled/value'); $time = $this->getData('groups/log/fields/time/value'); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Secure.php b/app/code/Magento/Backend/Model/Config/Backend/Secure.php index 1a9f69c7eef61..db23249602c39 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Secure.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Secure.php @@ -57,7 +57,7 @@ public function __construct( * * @return void */ - protected function _afterSave() + public function afterSave() { if ($this->isValueChanged()) { $this->_mergeService->cleanMergedJsCss(); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Serialized.php b/app/code/Magento/Backend/Model/Config/Backend/Serialized.php index 3f5af6147401a..2920fce044b23 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Serialized.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Serialized.php @@ -39,7 +39,7 @@ protected function _afterLoad() /** * @return void */ - protected function _beforeSave() + public function beforeSave() { if (is_array($this->getValue())) { $this->setValue(serialize($this->getValue())); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Serialized/ArraySerialized.php b/app/code/Magento/Backend/Model/Config/Backend/Serialized/ArraySerialized.php index 4d5d1e0872932..1afa3b7d1cdd1 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Serialized/ArraySerialized.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Serialized/ArraySerialized.php @@ -35,13 +35,13 @@ class ArraySerialized extends \Magento\Backend\Model\Config\Backend\Serialized * * @return void */ - protected function _beforeSave() + public function beforeSave() { $value = $this->getValue(); if (is_array($value)) { unset($value['__empty']); } $this->setValue($value); - parent::_beforeSave(); + parent::beforeSave(); } } diff --git a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php index ef50b9a3c7740..ec092cb429121 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Storage/Media/Database.php @@ -59,7 +59,7 @@ public function __construct( * * @return $this */ - protected function _afterSave() + public function afterSave() { $helper = $this->_coreFileStorage; $helper->getStorageModel(null, array('init' => true)); diff --git a/app/code/Magento/Backend/Model/Config/Backend/Store.php b/app/code/Magento/Backend/Model/Config/Backend/Store.php index 113fd56a290e3..f995f1a9e1724 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Store.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Store.php @@ -59,7 +59,7 @@ public function __construct( /** * @return void */ - protected function _afterSave() + public function afterSave() { $this->_mutableConfig->setValue( \Magento\Store\Model\Store::XML_PATH_STORE_IN_URL, diff --git a/app/code/Magento/Backend/Model/Config/Backend/Translate.php b/app/code/Magento/Backend/Model/Config/Backend/Translate.php index de93f8feee582..8a9629e08a9d8 100644 --- a/app/code/Magento/Backend/Model/Config/Backend/Translate.php +++ b/app/code/Magento/Backend/Model/Config/Backend/Translate.php @@ -80,7 +80,7 @@ public function __construct( * * @return $this */ - protected function _afterSave() + public function afterSave() { $types = array_keys( $this->_scopeConfig->getValue( diff --git a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php index f52d9f6fb9f56..b74de0e8aa13d 100644 --- a/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php +++ b/app/code/Magento/Backend/Model/Config/Source/Storage/Media/Database.php @@ -27,21 +27,22 @@ */ namespace Magento\Backend\Model\Config\Source\Storage\Media; -use Magento\Framework\App\Arguments; +use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\App\DeploymentConfig\ResourceConfig; class Database implements \Magento\Framework\Option\ArrayInterface { /** - * @var Arguments + * @var DeploymentConfig */ - protected $_arguments; + protected $_deploymentConfig; /** - * @param Arguments $arguments + * @param DeploymentConfig $deploymentConfig */ - public function __construct(Arguments $arguments) + public function __construct(DeploymentConfig $deploymentConfig) { - $this->_arguments = $arguments; + $this->_deploymentConfig = $deploymentConfig; } /** @@ -52,11 +53,15 @@ public function __construct(Arguments $arguments) public function toOptionArray() { $resourceOptions = array(); - foreach (array_keys($this->_arguments->getResources()) as $resourceName) { - $resourceOptions[] = array('value' => $resourceName, 'label' => $resourceName); + $resourceInfo = $this->_deploymentConfig->getSegment(ResourceConfig::CONFIG_KEY); + if (null !== $resourceInfo) { + $resourceConfig = new ResourceConfig($resourceInfo); + foreach (array_keys($resourceConfig->getData()) as $resourceName) { + $resourceOptions[] = array('value' => $resourceName, 'label' => $resourceName); + } + sort($resourceOptions); + reset($resourceOptions); } - sort($resourceOptions); - reset($resourceOptions); return $resourceOptions; } } diff --git a/app/code/Magento/Backend/Model/Config/Structure.php b/app/code/Magento/Backend/Model/Config/Structure.php index 7479b975f4a07..81b680edd3280 100644 --- a/app/code/Magento/Backend/Model/Config/Structure.php +++ b/app/code/Magento/Backend/Model/Config/Structure.php @@ -143,10 +143,13 @@ public function getElementByPathParts(array $pathParts) if (isset($this->_elements[$path])) { return $this->_elements[$path]; } - $children = $this->_data['sections']; + $children = []; + if ($this->_data) { + $children = $this->_data['sections']; + } $child = array(); foreach ($pathParts as $pathPart) { - if (array_key_exists($pathPart, $children)) { + if ($children && (array_key_exists($pathPart, $children))) { $child = $children[$pathPart]; $children = array_key_exists('children', $child) ? $child['children'] : array(); } else { diff --git a/app/code/Magento/Backend/Model/Menu/Item.php b/app/code/Magento/Backend/Model/Menu/Item.php index cf19b8c5283e4..3b999ac7ebf2d 100644 --- a/app/code/Magento/Backend/Model/Menu/Item.php +++ b/app/code/Magento/Backend/Model/Menu/Item.php @@ -427,7 +427,7 @@ protected function _isModuleDependenciesAvailable() { if ($this->_dependsOnModule) { $module = $this->_dependsOnModule; - return !!$this->_moduleList->getModule($module); + return $this->_moduleList->has($module); } return true; } diff --git a/app/code/Magento/Backend/Model/Search/Customer.php b/app/code/Magento/Backend/Model/Search/Customer.php index 2d5f256f804c6..e7b4159c2f4c2 100644 --- a/app/code/Magento/Backend/Model/Search/Customer.php +++ b/app/code/Magento/Backend/Model/Search/Customer.php @@ -48,19 +48,19 @@ class Customer extends \Magento\Framework\Object protected $_adminhtmlData = null; /** - * @var \Magento\Customer\Service\V1\CustomerAccountService + * @var \Magento\Customer\Api\CustomerRepositoryInterface */ - protected $_customerService; + protected $customerRepository; /** * @var \Magento\Framework\Api\SearchCriteriaBuilder */ - protected $_searchCriteriaBuilder; + protected $searchCriteriaBuilder; /** * @var \Magento\Framework\Api\FilterBuilder */ - protected $_filterBuilder; + protected $filterBuilder; /** * @var \Magento\Customer\Helper\View @@ -71,22 +71,22 @@ class Customer extends \Magento\Framework\Object * Initialize dependencies. * * @param \Magento\Backend\Helper\Data $adminhtmlData - * @param \Magento\Customer\Service\V1\CustomerAccountService $customerService + * @param \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository * @param \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder * @param \Magento\Framework\Api\FilterBuilder $filterBuilder * @param \Magento\Customer\Helper\View $customerViewHelper */ public function __construct( \Magento\Backend\Helper\Data $adminhtmlData, - \Magento\Customer\Service\V1\CustomerAccountService $customerService, + \Magento\Customer\Api\CustomerRepositoryInterface $customerRepository, \Magento\Framework\Api\SearchCriteriaBuilder $searchCriteriaBuilder, \Magento\Framework\Api\FilterBuilder $filterBuilder, \Magento\Customer\Helper\View $customerViewHelper ) { $this->_adminhtmlData = $adminhtmlData; - $this->_customerService = $customerService; - $this->_searchCriteriaBuilder = $searchCriteriaBuilder; - $this->_filterBuilder = $filterBuilder; + $this->customerRepository = $customerRepository; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->filterBuilder = $filterBuilder; $this->_customerViewHelper = $customerViewHelper; } @@ -103,39 +103,37 @@ public function load() return $this; } - $this->_searchCriteriaBuilder->setCurrentPage($this->getStart()); - $this->_searchCriteriaBuilder->setPageSize($this->getLimit()); + $this->searchCriteriaBuilder->setCurrentPage($this->getStart()); + $this->searchCriteriaBuilder->setPageSize($this->getLimit()); $searchFields = ['firstname', 'lastname', 'company']; $filters = []; foreach ($searchFields as $field) { - $filters[] = $this->_filterBuilder + $filters[] = $this->filterBuilder ->setField($field) ->setConditionType('like') ->setValue($this->getQuery() . '%') ->create(); } - $this->_searchCriteriaBuilder->addFilter($filters); - $searchCriteria = $this->_searchCriteriaBuilder->create(); - $searchResults = $this->_customerService->searchCustomers($searchCriteria); + $this->searchCriteriaBuilder->addFilter($filters); + $searchCriteria = $this->searchCriteriaBuilder->create(); + $searchResults = $this->customerRepository->getList($searchCriteria); - /** @var \Magento\Customer\Service\V1\Data\CustomerDetails $customerDetails */ - foreach ($searchResults->getItems() as $customerDetails) { - $customerData = $customerDetails->getCustomer(); - $customerAddresses = $customerDetails->getAddresses(); + foreach ($searchResults->getItems() as $customer) { + $customerAddresses = $customer->getAddresses(); /** Look for a company name defined in default billing address */ $company = null; foreach ($customerAddresses as $customerAddress) { - if ($customerAddress->isDefaultBilling()) { + if ($customerAddress->getId() == $customer->getDefaultBilling()) { $company = $customerAddress->getCompany(); break; } } $result[] = array( - 'id' => 'customer/1/' . $customerData->getId(), + 'id' => 'customer/1/' . $customer->getId(), 'type' => __('Customer'), - 'name' => $this->_customerViewHelper->getCustomerName($customerData), + 'name' => $this->_customerViewHelper->getCustomerName($customer), 'description' => $company, - 'url' => $this->_adminhtmlData->getUrl('customer/index/edit', array('id' => $customerData->getId())) + 'url' => $this->_adminhtmlData->getUrl('customer/index/edit', array('id' => $customer->getId())) ); } $this->setResults($result); diff --git a/app/code/Magento/Backend/Model/Session/AdminConfig.php b/app/code/Magento/Backend/Model/Session/AdminConfig.php index fff8c358482c9..207c5e16b8fd1 100644 --- a/app/code/Magento/Backend/Model/Session/AdminConfig.php +++ b/app/code/Magento/Backend/Model/Session/AdminConfig.php @@ -29,6 +29,7 @@ use Magento\Framework\Filesystem; use Magento\Framework\Session\Config; use Magento\Framework\UrlInterface; +use Magento\Framework\App\DeploymentConfig; /** * Magento Backend session configuration @@ -58,12 +59,10 @@ class AdminConfig extends Config * @param \Magento\Framework\Stdlib\String $stringHelper * @param \Magento\Framework\App\RequestInterface $request * @param Filesystem $filesystem + * @param DeploymentConfig $deploymentConfig * @param string $scopeType * @param FrontNameResolver $frontNameResolver * @param \Magento\Framework\StoreManagerInterface $storeManager - * @param string $saveMethod - * @param null|string $savePath - * @param null|string $cacheLimiter * @param string $lifetimePath * @param string $sessionName * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -74,12 +73,10 @@ public function __construct( \Magento\Framework\Stdlib\String $stringHelper, \Magento\Framework\App\RequestInterface $request, Filesystem $filesystem, + DeploymentConfig $deploymentConfig, $scopeType, FrontNameResolver $frontNameResolver, \Magento\Framework\StoreManagerInterface $storeManager, - $saveMethod = \Magento\Framework\Session\SaveHandlerInterface::DEFAULT_HANDLER, - $savePath = null, - $cacheLimiter = null, $lifetimePath = self::XML_PATH_COOKIE_LIFETIME, $sessionName = self::SESSION_NAME_ADMIN ) { @@ -89,10 +86,8 @@ public function __construct( $stringHelper, $request, $filesystem, + $deploymentConfig, $scopeType, - $saveMethod, - $savePath, - $cacheLimiter, $lifetimePath ); diff --git a/app/code/Magento/Backend/Model/Session/Quote.php b/app/code/Magento/Backend/Model/Session/Quote.php index 5239bed9d376e..2b93501e774ee 100644 --- a/app/code/Magento/Backend/Model/Session/Quote.php +++ b/app/code/Magento/Backend/Model/Session/Quote.php @@ -23,6 +23,9 @@ */ namespace Magento\Backend\Model\Session; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\GroupManagementInterface; + /** * Adminhtml quote session * @@ -67,9 +70,9 @@ class Quote extends \Magento\Framework\Session\SessionManager protected $_orderFactory; /** - * @var \Magento\Customer\Service\V1\CustomerAccountServiceInterface + * @var CustomerRepositoryInterface */ - protected $_customerService; + protected $customerRepository; /** * Sales quote repository @@ -84,9 +87,9 @@ class Quote extends \Magento\Framework\Session\SessionManager protected $_storeManager; /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var GroupManagementInterface */ - protected $_scopeConfig; + protected $groupManagement; /** * Constructor @@ -100,10 +103,10 @@ class Quote extends \Magento\Framework\Session\SessionManager * @param \Magento\Framework\Stdlib\CookieManagerInterface $cookieManager * @param \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory $cookieMetadataFactory * @param \Magento\Sales\Model\QuoteRepository $quoteRepository - * @param \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerService + * @param CustomerRepositoryInterface $customerRepository * @param \Magento\Sales\Model\OrderFactory $orderFactory * @param \Magento\Framework\StoreManagerInterface $storeManager - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param GroupManagementInterface $groupManagement */ public function __construct( \Magento\Framework\App\Request\Http $request, @@ -115,16 +118,16 @@ public function __construct( \Magento\Framework\Stdlib\CookieManagerInterface $cookieManager, \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory $cookieMetadataFactory, \Magento\Sales\Model\QuoteRepository $quoteRepository, - \Magento\Customer\Service\V1\CustomerAccountServiceInterface $customerService, + CustomerRepositoryInterface $customerRepository, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Framework\StoreManagerInterface $storeManager, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + GroupManagementInterface $groupManagement ) { $this->quoteRepository = $quoteRepository; - $this->_customerService = $customerService; + $this->customerRepository = $customerRepository; $this->_orderFactory = $orderFactory; $this->_storeManager = $storeManager; - $this->_scopeConfig = $scopeConfig; + $this->groupManagement = $groupManagement; parent::__construct( $request, $sidResolver, @@ -152,10 +155,7 @@ public function getQuote() $this->_quote = $this->quoteRepository->create(); if ($this->getStoreId()) { if (!$this->getQuoteId()) { - $customerGroupId = $this->_scopeConfig->getValue( - \Magento\Customer\Service\V1\CustomerGroupServiceInterface::XML_PATH_DEFAULT_ID, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + $customerGroupId = $this->groupManagement->getDefaultGroup()->getId(); $this->_quote->setCustomerGroupId($customerGroupId) ->setIsActive(false) ->setStoreId($this->getStoreId()); @@ -167,7 +167,7 @@ public function getQuote() } if ($this->getCustomerId()) { - $this->_quote->assignCustomer($this->_customerService->getCustomer($this->getCustomerId())); + $this->_quote->assignCustomer($this->customerRepository->getById($this->getCustomerId())); } } $this->_quote->setIgnoreOldQty(true); diff --git a/app/code/Magento/Backend/Service/V1/ModuleService.php b/app/code/Magento/Backend/Service/V1/ModuleService.php index ad8195afa9ba3..6f3cb759f4193 100644 --- a/app/code/Magento/Backend/Service/V1/ModuleService.php +++ b/app/code/Magento/Backend/Service/V1/ModuleService.php @@ -49,11 +49,6 @@ public function __construct( */ public function getModules() { - $result = []; - $modules = $this->moduleList->getModules(); - foreach ($modules as $module) { - $result[] = $module['name']; - } - return $result; + return $this->moduleList->getNames(); } } diff --git a/app/code/Magento/Backend/composer.json b/app/code/Magento/Backend/composer.json index af0fd86131c36..3345cd14a4efe 100644 --- a/app/code/Magento/Backend/composer.json +++ b/app/code/Magento/Backend/composer.json @@ -3,26 +3,26 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha105", - "magento/module-directory": "0.1.0-alpha105", - "magento/module-core": "0.1.0-alpha105", - "magento/module-eav": "0.1.0-alpha105", - "magento/module-cron": "0.1.0-alpha105", - "magento/module-theme": "0.1.0-alpha105", - "magento/module-reports": "0.1.0-alpha105", - "magento/module-sales": "0.1.0-alpha105", - "magento/module-catalog": "0.1.0-alpha105", - "magento/module-user": "0.1.0-alpha105", - "magento/module-backup": "0.1.0-alpha105", - "magento/module-email": "0.1.0-alpha105", - "magento/module-customer": "0.1.0-alpha105", - "magento/module-translation": "0.1.0-alpha105", - "magento/module-require-js": "0.1.0-alpha105", - "magento/framework": "0.1.0-alpha105", + "magento/module-store": "0.1.0-alpha106", + "magento/module-directory": "0.1.0-alpha106", + "magento/module-core": "0.1.0-alpha106", + "magento/module-eav": "0.1.0-alpha106", + "magento/module-cron": "0.1.0-alpha106", + "magento/module-theme": "0.1.0-alpha106", + "magento/module-reports": "0.1.0-alpha106", + "magento/module-sales": "0.1.0-alpha106", + "magento/module-catalog": "0.1.0-alpha106", + "magento/module-user": "0.1.0-alpha106", + "magento/module-backup": "0.1.0-alpha106", + "magento/module-email": "0.1.0-alpha106", + "magento/module-customer": "0.1.0-alpha106", + "magento/module-translation": "0.1.0-alpha106", + "magento/module-require-js": "0.1.0-alpha106", + "magento/framework": "0.1.0-alpha106", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha105", + "version": "0.1.0-alpha106", "extra": { "map": [ [ diff --git a/app/code/Magento/Backend/etc/di.xml b/app/code/Magento/Backend/etc/di.xml index faa8d7fc6cd3a..c4ee165192a4f 100644 --- a/app/code/Magento/Backend/etc/di.xml +++ b/app/code/Magento/Backend/etc/di.xml @@ -61,11 +61,6 @@ Magento\Backend\Model\Menu\Director\Director - - - Magento\Backend\App\Area\FrontNameResolver::PARAM_BACKEND_FRONT_NAME - - Magento\Backend\Model\UrlInterface\Proxy @@ -107,11 +102,6 @@ Magento\Backend\Helper\Data\Proxy - - - Magento\Framework\App\State::PARAM_INSTALL_DATE - - diff --git a/app/code/Magento/Backend/etc/module.xml b/app/code/Magento/Backend/etc/module.xml index 181be8d2cb604..d914257db8386 100644 --- a/app/code/Magento/Backend/etc/module.xml +++ b/app/code/Magento/Backend/etc/module.xml @@ -24,7 +24,7 @@ */ --> - + diff --git a/app/code/Magento/Backend/view/adminhtml/layout/default.xml b/app/code/Magento/Backend/view/adminhtml/layout/default.xml index 2916133e1079d..9b9951dd6a208 100644 --- a/app/code/Magento/Backend/view/adminhtml/layout/default.xml +++ b/app/code/Magento/Backend/view/adminhtml/layout/default.xml @@ -46,7 +46,6 @@ - diff --git a/app/code/Magento/Backend/view/adminhtml/requirejs-config.js b/app/code/Magento/Backend/view/adminhtml/requirejs-config.js new file mode 100644 index 0000000000000..279ff735897f8 --- /dev/null +++ b/app/code/Magento/Backend/view/adminhtml/requirejs-config.js @@ -0,0 +1,58 @@ +/** + * Magento + * + * NOTICE OF LICENSE + * + * This source file is subject to the Academic Free License (AFL 3.0) + * that is bundled with this package in the file LICENSE_AFL.txt. + * It is also available through the world-wide-web at this URL: + * http://opensource.org/licenses/afl-3.0.php + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@magentocommerce.com so we can send you a copy immediately. + * + * DISCLAIMER + * + * Do not edit or add to this file if you wish to upgrade Magento to newer + * versions in the future. If you wish to customize Magento for your + * needs please refer to http://www.magentocommerce.com for more information. + * + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + */ + +var config = { + map: { + '*': { + translateInline: 'mage/translate-inline', + form: 'mage/backend/form', + button: 'mage/backend/button', + accordion: 'mage/accordion', + actionLink: 'mage/backend/action-link', + validation: 'mage/backend/validation', + notification: 'mage/backend/notification', + loader: 'mage/loader_old', + loaderAjax: 'mage/loader_old', + floatingHeader: 'mage/backend/floating-header', + suggest: 'mage/backend/suggest', + mediabrowser: 'jquery/jstree/jquery.jstree', + tabs: 'mage/backend/tabs', + treeSuggest: 'mage/backend/tree-suggest', + calendar: 'mage/calendar', + dropdown: 'mage/dropdown_old', + collapsable: 'js/theme', + collapsible: 'mage/collapsible', + menu: 'mage/backend/menu', + jstree: 'jquery/jstree/jquery.jstree' + } + }, + deps: [ + 'Magento_Backend/system/validation-rules', + "js/theme", + "mage/dropdown_old", + "mage/backend/bootstrap" + ], + paths: { + "jquery/ui": "jquery/jquery-ui-1.9.2" + } +}; \ No newline at end of file diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml index 280bae9956b76..454b647aa3d47 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml @@ -39,7 +39,7 @@
- +
@@ -57,16 +57,27 @@
diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml index e95aabc891ad3..b7cee3e23bd8b 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/page.phtml @@ -69,9 +69,5 @@
getChildHtml('before_body_end') ?> - - \ No newline at end of file diff --git a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml index d5e6611b58080..55832a9da518f 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/page/header.phtml @@ -31,7 +31,7 @@
-
+ isCaseSensitive()) :?> +
+ Attention: Captcha is case sensitive.') ?> +
+
diff --git a/app/code/Magento/Captcha/view/frontend/web/captcha.js b/app/code/Magento/Captcha/view/frontend/web/captcha.js index 8d59eb7c0b1f5..b52589dc0bb41 100644 --- a/app/code/Magento/Captcha/view/frontend/web/captcha.js +++ b/app/code/Magento/Captcha/view/frontend/web/captcha.js @@ -21,9 +21,12 @@ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ /*jshint browser:true jquery:true*/ -define(["jquery","jquery/ui"], function($){ - +define([ + "jquery", + "jquery/ui" +], function($){ "use strict"; + $.widget('mage.captcha', { options: { refreshClass: 'refreshing', @@ -66,4 +69,6 @@ define(["jquery","jquery/ui"], function($){ }); } }); + + return $.mage.captcha; }); \ No newline at end of file diff --git a/app/code/Magento/Sales/Service/V1/TransactionReadInterface.php b/app/code/Magento/Catalog/Api/AttributeSetManagementInterface.php similarity index 70% rename from app/code/Magento/Sales/Service/V1/TransactionReadInterface.php rename to app/code/Magento/Catalog/Api/AttributeSetManagementInterface.php index c1e532e170925..83adf0485e5d9 100644 --- a/app/code/Magento/Sales/Service/V1/TransactionReadInterface.php +++ b/app/code/Magento/Catalog/Api/AttributeSetManagementInterface.php @@ -1,5 +1,6 @@ _set(ZipRange::KEY_FROM, $from); - return $this; - } + public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria); /** - * Set zip range ending point + * Retrieve specific attribute * - * @param int $to - * @return $this + * @param string $attributeCode + * @return \Magento\Catalog\Api\Data\CategoryAttributeInterface */ - public function setTo($to) - { - $this->_set(ZipRange::KEY_TO, $to); - return $this; - } + public function get($attributeCode); } diff --git a/app/code/Magento/Catalog/Api/CategoryLinkManagementInterface.php b/app/code/Magento/Catalog/Api/CategoryLinkManagementInterface.php new file mode 100644 index 0000000000000..ccd1357c8012f --- /dev/null +++ b/app/code/Magento/Catalog/Api/CategoryLinkManagementInterface.php @@ -0,0 +1,36 @@ +_set('is_wysiwyg_enabled', $isWysiwygEnabled); + return $this; + } + + /** + * @param bool|null $isHtmlAllowedOnFront + * @return $this + */ + public function setIsHtmlAllowedOnFront($isHtmlAllowedOnFront) + { + $this->_set('is_html_allowed_on_front', $isHtmlAllowedOnFront); + return $this; + } + + /** + * @param bool|null $usedForSortBy + * @return $this + */ + public function setUsedForSortBy($usedForSortBy) + { + $this->_set('used_for_sort_by', $usedForSortBy); + return $this; + } + + /** + * @param bool|null $isFilterable + * @return $this + */ + public function setIsFilterable($isFilterable) + { + $this->_set('is_filterable', $isFilterable); + return $this; + } + + /** + * @param bool|null $isFilterableInSearch + * @return $this + */ + public function setIsFilterableInSearch($isFilterableInSearch) + { + $this->_set('is_filterable_in_search', $isFilterableInSearch); + return $this; + } + + /** + * @param int|null $position + * @return $this + */ + public function setPosition($position) + { + $this->_set('position', $position); + return $this; + } + + /** + * @param string $applyTo + * @return $this + */ + public function setApplyTo($applyTo) + { + $this->_set('apply_to', $applyTo); + return $this; + } + + /** + * @param string|null $isConfigurable + * @return $this + */ + public function setIsConfigurable($isConfigurable) + { + $this->_set('is_configurable', $isConfigurable); + return $this; + } + + /** + * @param string|null $isSearchable + * @return $this + */ + public function setIsSearchable($isSearchable) + { + $this->_set('is_searchable', $isSearchable); + return $this; + } + + /** + * @param string|null $isVisibleInAdvancedSearch + * @return $this + */ + public function setIsVisibleInAdvancedSearch($isVisibleInAdvancedSearch) + { + $this->_set('is_visible_in_advanced_search', $isVisibleInAdvancedSearch); + return $this; + } + + /** + * @param string|null $isComparable + * @return $this + */ + public function setIsComparable($isComparable) + { + $this->_set('is_comparable', $isComparable); + return $this; + } + + /** + * @param string|null $isUsedForPromoRules + * @return $this + */ + public function setIsUsedForPromoRules($isUsedForPromoRules) + { + $this->_set('is_used_for_promo_rules', $isUsedForPromoRules); + return $this; + } + + /** + * @param string|null $isVisibleOnFront + * @return $this + */ + public function setIsVisibleOnFront($isVisibleOnFront) + { + $this->_set('is_visible_on_front', $isVisibleOnFront); + return $this; + } + + /** + * @param string|null $usedInProductListing + * @return $this + */ + public function setUsedInProductListing($usedInProductListing) + { + $this->_set('used_in_product_listing', $usedInProductListing); + return $this; + } + + /** + * @param bool|null $isVisible + * @return $this + */ + public function setIsVisible($isVisible) + { + $this->_set('is_visible', $isVisible); + return $this; + } + + /** + * @param string|null $scope + * @return $this + */ + public function setScope($scope) + { + $this->_set('scope', $scope); + return $this; + } + + /** + * @param int|null $attributeId + * @return $this + */ + public function setAttributeId($attributeId) + { + $this->_set('attribute_id', $attributeId); + return $this; + } + + /** + * @param string $attributeCode + * @return $this + */ + public function setAttributeCode($attributeCode) + { + $this->_set('attribute_code', $attributeCode); + return $this; + } + + /** + * @param string $frontendInput + * @return $this + */ + public function setFrontendInput($frontendInput) + { + $this->_set('frontend_input', $frontendInput); + return $this; + } + + /** + * @param string|null $entityTypeId + * @return $this + */ + public function setEntityTypeId($entityTypeId) + { + $this->_set('entity_type_id', $entityTypeId); + return $this; + } + + /** + * @param bool $isRequired + * @return $this + */ + public function setIsRequired($isRequired) + { + $this->_set('is_required', $isRequired); + return $this; + } + + /** + * @param \Magento\Eav\Api\Data\AttributeOptionInterface $options + * @return $this + */ + public function setOptions($options) + { + $this->_set('options', $options); + return $this; + } + + /** + * @param bool|null $isUserDefined + * @return $this + */ + public function setIsUserDefined($isUserDefined) + { + $this->_set('is_user_defined', $isUserDefined); + return $this; + } + + /** + * @param string $frontendLabel + * @return $this + */ + public function setDefaultFrontendLabel($frontendLabel) + { + $this->_set('frontend_label', $frontendLabel); + return $this; + } + + /** + * @param \Magento\Eav\Api\Data\AttributeFrontendLabelInterface[] + * $storeFrontendLabels + * @return $this + */ + public function setFrontendLabels($storeFrontendLabels) + { + $this->_set('frontend_labels', $storeFrontendLabels); + return $this; + } + + /** + * @param string|null $note + * @return $this + */ + public function setNote($note) + { + $this->_set('note', $note); + return $this; + } + + /** + * @param string|null $backendType + * @return $this + */ + public function setBackendType($backendType) + { + $this->_set('backend_type', $backendType); + return $this; + } + + /** + * @param string|null $backendModel + * @return $this + */ + public function setBackendModel($backendModel) + { + $this->_set('backend_model', $backendModel); + return $this; + } + + /** + * @param string|null $sourceModel + * @return $this + */ + public function setSourceModel($sourceModel) + { + $this->_set('source_model', $sourceModel); + return $this; + } + + /** + * @param string|null $defaultValue + * @return $this + */ + public function setDefaultValue($defaultValue) + { + $this->_set('default_value', $defaultValue); + return $this; + } + + /** + * @param string|null $isUnique + * @return $this + */ + public function setIsUnique($isUnique) + { + $this->_set('is_unique', $isUnique); + return $this; + } + + /** + * @param string|null $frontendClass + * @return $this + */ + public function setFrontendClass($frontendClass) + { + $this->_set('frontend_class', $frontendClass); + return $this; + } + + /** + * @param \Magento\Eav\Api\Data\AttributeValidationRuleInterface $validationRules + * @return $this + */ + public function setValidationRules($validationRules) + { + $this->_set('validation_rules', $validationRules); + return $this; + } + + /** + * {@inheritdoc} + */ + public function create() + { + /** TODO: temporary fix while problem with hasDataChanges flag not solved. MAGETWO-30324 */ + $object = parent::create(); + $object->setDataChanges(true); + return $object; + } +} diff --git a/app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php b/app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php new file mode 100644 index 0000000000000..d1fdc13ecf50e --- /dev/null +++ b/app/code/Magento/Catalog/Api/Data/ProductAttributeInterface.php @@ -0,0 +1,32 @@ +invoiceRepository = $invoiceRepository; - } + public function getLinkedItemsByType($productSku, $type); /** - * Invoke InvoiceCapture service + * Assign a product link to another product * - * @param int $id - * @return bool + * @param string $productSku + * @param string $type + * @param \Magento\Catalog\Api\Data\ProductLinkInterface[] $items * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\CouldNotSaveException + * @return bool */ - public function invoke($id) - { - return (bool)$this->invoiceRepository->get($id)->capture(); - } + public function setProductLinks($productSku, $type, array $items); } diff --git a/app/code/Magento/Sales/Service/V1/InvoiceWriteInterface.php b/app/code/Magento/Catalog/Api/ProductLinkRepositoryInterface.php similarity index 55% rename from app/code/Magento/Sales/Service/V1/InvoiceWriteInterface.php rename to app/code/Magento/Catalog/Api/ProductLinkRepositoryInterface.php index c0783c9add6c8..3cb0a0b8ee01b 100644 --- a/app/code/Magento/Sales/Service/V1/InvoiceWriteInterface.php +++ b/app/code/Magento/Catalog/Api/ProductLinkRepositoryInterface.php @@ -21,43 +21,41 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sales\Service\V1; -use Magento\Sales\Service\V1\Data\Comment; +namespace Magento\Catalog\Api; -interface InvoiceWriteInterface +/** + * Interface Product links handling interface + */ +interface ProductLinkRepositoryInterface { /** - * @param \Magento\Sales\Service\V1\Data\Comment $comment + * Save product link + * + * @param \Magento\Catalog\Api\Data\ProductLinkInterface $entity + * @throws \Magento\Framework\Exception\NoSuchEntityException + * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool - * @throws \Exception */ - public function addComment(Comment $comment); + public function save(\Magento\Catalog\Api\Data\ProductLinkInterface $entity); /** - * @param int $id - * @return bool + * Delete product link + * + * @param \Magento\Catalog\Api\Data\ProductLinkInterface $entity * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function void($id); - - /** - * @param int $id + * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool */ - public function email($id); + public function delete(\Magento\Catalog\Api\Data\ProductLinkInterface $entity); /** - * @param int $id - * @return bool + * @param string $productSku + * @param string $type + * @param string $linkedProductSku * @throws \Magento\Framework\Exception\NoSuchEntityException - */ - public function capture($id); - - /** - * @param \Magento\Sales\Service\V1\Data\Invoice $invoiceDataObject + * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool - * @throws \Exception */ - public function create(\Magento\Sales\Service\V1\Data\Invoice $invoiceDataObject); + public function deleteById($productSku, $type, $linkedProductSku); } diff --git a/app/code/Magento/Catalog/Api/ProductLinkTypeListInterface.php b/app/code/Magento/Catalog/Api/ProductLinkTypeListInterface.php new file mode 100644 index 0000000000000..77887f2f9b075 --- /dev/null +++ b/app/code/Magento/Catalog/Api/ProductLinkTypeListInterface.php @@ -0,0 +1,43 @@ + - */ namespace Magento\Catalog\Block\Adminhtml\Category; use Magento\Store\Model\Store; use Magento\Framework\Data\Tree\Node; +/** + * Class AbstractCategory + */ class AbstractCategory extends \Magento\Backend\Block\Template { /** @@ -68,7 +65,7 @@ public function __construct( \Magento\Catalog\Model\Resource\Category\Tree $categoryTree, \Magento\Framework\Registry $registry, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - array $data = array() + array $data = [] ) { $this->_categoryTree = $categoryTree; $this->_coreRegistry = $registry; @@ -254,8 +251,6 @@ public function getRootByIds($ids) public function getNode($parentNodeCategory, $recursionLevel = 2) { $nodeId = $parentNodeCategory->getId(); - $parentId = $parentNodeCategory->getParentId(); - $node = $this->_categoryTree->loadNode($nodeId); $node->loadChildren($recursionLevel); @@ -274,9 +269,9 @@ public function getNode($parentNodeCategory, $recursionLevel = 2) * @param array $args * @return string */ - public function getSaveUrl(array $args = array()) + public function getSaveUrl(array $args = []) { - $params = array('_current' => true); + $params = ['_current' => false, '_query' => false]; $params = array_merge($params, $args); return $this->getUrl('catalog/*/save', $params); } @@ -288,7 +283,7 @@ public function getEditUrl() { return $this->getUrl( 'catalog/category/edit', - array('_current' => true, 'store' => null, '_query' => false, 'id' => null, 'parent' => null) + ['store' => null, '_query' => false, 'id' => null, 'parent' => null] ); } @@ -301,7 +296,7 @@ public function getRootIds() { $ids = $this->getData('root_ids'); if (is_null($ids)) { - $ids = array(); + $ids = []; foreach ($this->_storeManager->getGroups() as $store) { $ids[] = $store->getRootCategoryId(); } diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php index 72bb3dc9f9675..c2478beb2c829 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Category/Edit/Form.php @@ -31,6 +31,9 @@ use Magento\Backend\Block\Template; +/** + * Class Form + */ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory { /** @@ -38,7 +41,7 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory * * @var array */ - protected $_additionalButtons = array(); + protected $_additionalButtons = []; /** * @var string @@ -51,6 +54,8 @@ class Form extends \Magento\Catalog\Block\Adminhtml\Category\AbstractCategory protected $_jsonEncoder; /** + * Constructor + * * @param Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Resource\Category\Tree $categoryTree @@ -64,7 +69,7 @@ public function __construct( \Magento\Framework\Registry $registry, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Framework\Json\EncoderInterface $jsonEncoder, - array $data = array() + array $data = [] ) { $this->_jsonEncoder = $jsonEncoder; parent::__construct($context, $categoryTree, $registry, $categoryFactory, $data); @@ -88,12 +93,12 @@ protected function _prepareLayout() if (!$category->isReadonly() && $this->hasStoreRootCategory()) { $this->addButton( 'save', - array( + [ 'id' => 'save', 'label' => __('Save Category'), 'onclick' => "categorySubmit('" . $this->getSaveUrl() . "', true)", 'class' => 'save primary save-category' - ) + ] ); } @@ -101,15 +106,15 @@ protected function _prepareLayout() if ($categoryId && !in_array($categoryId, $this->getRootIds()) && $category->isDeleteable()) { $this->addButton( 'delete', - array( + [ 'id' => 'delete', 'label' => __('Delete Category'), 'onclick' => "categoryDelete('" . $this->getUrl( 'catalog/*/delete', - array('_current' => true) + ['_current' => true] ) . "', true, {$categoryId})", 'class' => 'delete' - ) + ] ); } @@ -118,12 +123,12 @@ protected function _prepareLayout() $resetPath = $categoryId ? 'catalog/*/edit' : 'catalog/*/add'; $this->addButton( 'reset', - array( + [ 'id' => 'reset', 'label' => __('Reset'), - 'onclick' => "categoryReset('" . $this->getUrl($resetPath, array('_current' => true)) . "',true)", + 'onclick' => "categoryReset('" . $this->getUrl($resetPath, ['_current' => true]) . "',true)", 'class' => 'reset' - ) + ] ); } @@ -136,7 +141,7 @@ protected function _prepareLayout() public function getStoreConfigurationUrl() { $storeId = (int)$this->getRequest()->getParam('store'); - $params = array(); + $params = []; // $params = array('section'=>'catalog'); if ($storeId) { $store = $this->_storeManager->getStore($storeId); @@ -266,9 +271,9 @@ public function getHeader() * @param array $args * @return string */ - public function getDeleteUrl(array $args = array()) + public function getDeleteUrl(array $args = []) { - $params = array('_current' => true); + $params = ['_current' => true]; $params = array_merge($params, $args); return $this->getUrl('catalog/*/delete', $params); } @@ -279,9 +284,9 @@ public function getDeleteUrl(array $args = array()) * @param array $args * @return string */ - public function getRefreshPathUrl(array $args = array()) + public function getRefreshPathUrl(array $args = []) { - $params = array('_current' => true); + $params = ['_current' => true]; $params = array_merge($params, $args); return $this->getUrl('catalog/*/refreshPath', $params); } @@ -306,6 +311,26 @@ public function isAjax() return $this->_request->isXmlHttpRequest() || $this->_request->getParam('isAjax'); } + /** + * Get parent category id + * + * @return int + */ + public function getParentCategoryId() + { + return (int)$this->templateContext->getRequest()->getParam('parent'); + } + + /** + * Get category id + * + * @return int + */ + public function getCategoryId() + { + return (int)$this->templateContext->getRequest()->getParam('id'); + } + /** * Add button block as a child block or to global Page Toolbar block if available * diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php index 3a2319950632a..ddfc1ca6251b6 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Attribute/Edit/Tab/Front.php @@ -32,6 +32,7 @@ use Magento\Backend\Block\Widget\Form; use Magento\Backend\Block\Widget\Form\Generic; use Magento\Backend\Model\Config\Source\Yesno; +use Magento\Catalog\Model\Entity\Attribute; class Front extends Generic { @@ -64,6 +65,7 @@ public function __construct( */ protected function _prepareForm() { + /** @var Attribute $attributeObject */ $attributeObject = $this->_coreRegistry->registry('entity_attribute'); /** @var \Magento\Framework\Data\Form $form */ @@ -212,6 +214,19 @@ protected function _prepareForm() 'wysiwyg_enabled', '0' ) + ->addFieldMap( + "is_searchable", + 'searchable' + ) + ->addFieldMap( + "is_visible_in_advanced_search", + 'advanced_search' + ) + ->addFieldDependence( + 'advanced_search', + 'searchable', + '1' + ) ); $form->setValues($attributeObject->getData()); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php index 51891fbcac604..a7994ffd319be 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Js.php @@ -25,7 +25,7 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit; use Magento\Customer\Helper\Session\CurrentCustomer; -use Magento\Tax\Service\V1\TaxCalculationServiceInterface; +use Magento\Tax\Api\TaxCalculationInterface; use Magento\Tax\Model\TaxClass\Source\Product as ProductTaxClassSource; class Js extends \Magento\Backend\Block\Template @@ -38,7 +38,7 @@ class Js extends \Magento\Backend\Block\Template protected $coreRegistry = null; /** - * @var TaxCalculationServiceInterface + * @var TaxCalculationInterface */ protected $calculationService; @@ -66,7 +66,7 @@ class Js extends \Magento\Backend\Block\Template * @param \Magento\Framework\Registry $registry * @param CurrentCustomer $currentCustomer * @param \Magento\Core\Helper\Data $coreHelper - * @param TaxCalculationServiceInterface $calculationService + * @param TaxCalculationInterface $calculationService * @param ProductTaxClassSource $productTaxClassSource * @param array $data */ @@ -75,7 +75,7 @@ public function __construct( \Magento\Framework\Registry $registry, CurrentCustomer $currentCustomer, \Magento\Core\Helper\Data $coreHelper, - TaxCalculationServiceInterface $calculationService, + TaxCalculationInterface $calculationService, ProductTaxClassSource $productTaxClassSource, array $data = array() ) { diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php index 47185ec755077..853cb0881dee8 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Attributes.php @@ -136,6 +136,7 @@ protected function _prepareForm() } } } + $form->addValues($values); $form->setFieldNameSuffix('product'); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php index 84972e0c7c89c..c93762712b872 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Group/AbstractGroup.php @@ -24,7 +24,8 @@ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price\Group; use Magento\Backend\Block\Widget; -use Magento\Customer\Service\V1\CustomerGroupServiceInterface; +use Magento\Customer\Api\GroupManagementInterface; +use Magento\Customer\Api\GroupRepositoryInterface; use Magento\Framework\Data\Form\Element\Renderer\RendererInterface; /** @@ -73,30 +74,46 @@ abstract class AbstractGroup extends Widget implements RendererInterface protected $_directoryHelper; /** - * @var CustomerGroupServiceInterface + * @var GroupRepositoryInterface */ - protected $_groupService; + protected $_groupRepository; + + /** + * @var GroupManagementInterface + */ + protected $_groupManagement; + + /** + * @var \Magento\Framework\Api\SearchCriteriaDataBuilder + */ + protected $_searchCriteriaDataBuilder; /** * @param \Magento\Backend\Block\Template\Context $context - * @param CustomerGroupServiceInterface $groupService + * @param GroupRepositoryInterface $groupRepository * @param \Magento\Directory\Helper\Data $directoryHelper * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\Registry $registry + * @param GroupManagementInterface $groupManagement + * @param \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaDataBuilder * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, - CustomerGroupServiceInterface $groupService, + GroupRepositoryInterface $groupRepository, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\Registry $registry, + GroupManagementInterface $groupManagement, + \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaDataBuilder, array $data = array() ) { - $this->_groupService = $groupService; + $this->_groupRepository = $groupRepository; $this->_directoryHelper = $directoryHelper; $this->_catalogData = $catalogData; $this->_coreRegistry = $registry; + $this->_groupManagement = $groupManagement; + $this->_searchCriteriaDataBuilder = $searchCriteriaDataBuilder; parent::__construct($context, $data); } @@ -190,7 +207,8 @@ public function getCustomerGroups($groupId = null) if (!$this->_catalogData->isModuleEnabled('Magento_Customer')) { return array(); } - $groups = $this->_groupService->getGroups(); + /** @var \Magento\Customer\Api\Data\GroupInterface[] $groups */ + $groups = $this->_groupRepository->getList($this->_searchCriteriaDataBuilder->create()); $this->_customerGroups = $this->_getInitialCustomerGroups(); foreach ($groups as $group) { @@ -283,7 +301,7 @@ public function getWebsites() */ public function getDefaultCustomerGroup() { - return CustomerGroupServiceInterface::CUST_GROUP_ALL; + return $this->_groupManagement->getAllCustomersGroup()->getId(); } /** diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php index e5d093d295fef..2f90ca1046b72 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Tab/Price/Tier.php @@ -23,8 +23,6 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Tab\Price; -use Magento\Customer\Service\V1\CustomerGroupServiceInterface; - /** * Adminhtml tier price item renderer */ @@ -42,7 +40,7 @@ class Tier extends Group\AbstractGroup */ protected function _getInitialCustomerGroups() { - return array(CustomerGroupServiceInterface::CUST_GROUP_ALL => __('ALL GROUPS')); + return array($this->_groupManagement->getAllCustomersGroup()->getId() => __('ALL GROUPS')); } /** diff --git a/app/code/Magento/Catalog/Block/Category/View.php b/app/code/Magento/Catalog/Block/Category/View.php index fc94a7f9d076c..4f475dadbd77c 100644 --- a/app/code/Magento/Catalog/Block/Category/View.php +++ b/app/code/Magento/Catalog/Block/Category/View.php @@ -50,20 +50,20 @@ class View extends \Magento\Framework\View\Element\Template implements \Magento\ /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Catalog\Model\Layer\Category $catalogLayer + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param \Magento\Framework\Registry $registry * @param \Magento\Catalog\Helper\Category $categoryHelper * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Catalog\Model\Layer\Category $catalogLayer, + \Magento\Catalog\Model\Layer\Resolver $layerResolver, \Magento\Framework\Registry $registry, \Magento\Catalog\Helper\Category $categoryHelper, array $data = array() ) { $this->_categoryHelper = $categoryHelper; - $this->_catalogLayer = $catalogLayer; + $this->_catalogLayer = $layerResolver->get(); $this->_coreRegistry = $registry; parent::__construct($context, $data); } diff --git a/app/code/Magento/Catalog/Block/Navigation.php b/app/code/Magento/Catalog/Block/Navigation.php index f84ad94588949..7995eca2c0684 100644 --- a/app/code/Magento/Catalog/Block/Navigation.php +++ b/app/code/Magento/Catalog/Block/Navigation.php @@ -74,7 +74,7 @@ class Navigation extends \Magento\Framework\View\Element\Template implements \Ma /** * Catalog layer * - * @var \Magento\Catalog\Model\Layer\Category + * @var \Magento\Catalog\Model\Layer */ protected $_catalogLayer; @@ -94,7 +94,7 @@ class Navigation extends \Magento\Framework\View\Element\Template implements \Ma * @param \Magento\Framework\View\Element\Template\Context $context * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory - * @param \Magento\Catalog\Model\Layer\Category $catalogLayer + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param \Magento\Framework\App\Http\Context $httpContext * @param \Magento\Catalog\Helper\Category $catalogCategory * @param \Magento\Framework\Registry $registry @@ -105,7 +105,7 @@ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, - \Magento\Catalog\Model\Layer\Category $catalogLayer, + \Magento\Catalog\Model\Layer\Resolver $layerResolver, \Magento\Framework\App\Http\Context $httpContext, \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Framework\Registry $registry, @@ -113,14 +113,13 @@ public function __construct( array $data = array() ) { $this->_productCollectionFactory = $productCollectionFactory; - $this->_catalogLayer = $catalogLayer; + $this->_catalogLayer = $layerResolver->get(); $this->httpContext = $httpContext; $this->_catalogCategory = $catalogCategory; $this->_registry = $registry; $this->flatState = $flatState; $this->_categoryInstance = $categoryFactory->create(); parent::__construct($context, $data); - $this->_isScopePrivate = true; } /** diff --git a/app/code/Magento/Catalog/Block/Product/ListProduct.php b/app/code/Magento/Catalog/Block/Product/ListProduct.php index 3df003f81115b..201a8aa8b991f 100644 --- a/app/code/Magento/Catalog/Block/Product/ListProduct.php +++ b/app/code/Magento/Catalog/Block/Product/ListProduct.php @@ -72,18 +72,18 @@ class ListProduct extends AbstractProduct implements IdentityInterface * @param Context $context * @param \Magento\Core\Helper\PostData $postDataHelper * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Catalog\Model\Layer $catalogLayer + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param array $data */ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Core\Helper\PostData $postDataHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Catalog\Model\Layer $catalogLayer, + \Magento\Catalog\Model\Layer\Resolver $layerResolver, array $data = array() ) { $this->_categoryFactory = $categoryFactory; - $this->_catalogLayer = $catalogLayer; + $this->_catalogLayer = $layerResolver->get(); $this->_postDataHelper = $postDataHelper; parent::__construct( $context, diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php index 29ffef6917afa..371fcc4193840 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Promotion.php @@ -35,19 +35,11 @@ class Promotion extends \Magento\Catalog\Block\Product\ListProduct */ protected $_productCollectionFactory; - /** - * Layer factory - * - * @var \Magento\Catalog\Model\LayerFactory - */ - protected $_layerFactory; - /** * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Core\Helper\PostData $postDataHelper * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Catalog\Model\Layer\Category $catalogLayer - * @param \Magento\Catalog\Model\LayerFactory $layerFactory + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param CollectionFactory $productCollectionFactory * @param array $data */ @@ -55,18 +47,16 @@ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Core\Helper\PostData $postDataHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Catalog\Model\Layer\Category $catalogLayer, - \Magento\Catalog\Model\LayerFactory $layerFactory, + \Magento\Catalog\Model\Layer\Resolver $layerResolver, CollectionFactory $productCollectionFactory, array $data = array() ) { - $this->_layerFactory = $layerFactory; $this->_productCollectionFactory = $productCollectionFactory; parent::__construct( $context, $postDataHelper, $categoryFactory, - $catalogLayer, + $layerResolver, $data ); } @@ -79,7 +69,7 @@ protected function _getProductCollection() if (is_null($this->_productCollection)) { /** @var Collection $collection */ $collection = $this->_productCollectionFactory->create(); - $this->_layerFactory->create()->prepareProductCollection($collection); + $this->_catalogLayer->prepareProductCollection($collection); $collection->addAttributeToFilter('promotion', 1)->addStoreFilter(); diff --git a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php index 5eda5e9e95059..0539e34881330 100644 --- a/app/code/Magento/Catalog/Block/Product/ProductList/Random.php +++ b/app/code/Magento/Catalog/Block/Product/ProductList/Random.php @@ -37,19 +37,11 @@ class Random extends \Magento\Catalog\Block\Product\ListProduct */ protected $_productCollectionFactory; - /** - * Layer factory - * - * @var \Magento\Catalog\Model\LayerFactory - */ - protected $_layerFactory; - /** * @param \Magento\Catalog\Block\Product\Context $context * @param \Magento\Core\Helper\PostData $postDataHelper * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory - * @param \Magento\Catalog\Model\Layer\Category $catalogLayer - * @param \Magento\Catalog\Model\LayerFactory $layerFactory + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory * @param array $data */ @@ -57,18 +49,16 @@ public function __construct( \Magento\Catalog\Block\Product\Context $context, \Magento\Core\Helper\PostData $postDataHelper, \Magento\Catalog\Model\CategoryFactory $categoryFactory, - \Magento\Catalog\Model\Layer\Category $catalogLayer, - \Magento\Catalog\Model\LayerFactory $layerFactory, + \Magento\Catalog\Model\Layer\Resolver $layerResolver, \Magento\Catalog\Model\Resource\Product\CollectionFactory $productCollectionFactory, array $data = array() ) { - $this->_layerFactory = $layerFactory; $this->_productCollectionFactory = $productCollectionFactory; parent::__construct( $context, $postDataHelper, $categoryFactory, - $catalogLayer, + $layerResolver, $data ); } @@ -81,7 +71,7 @@ protected function _getProductCollection() if (is_null($this->_productCollection)) { /** @var \Magento\Catalog\Model\Resource\Product\Collection $collection */ $collection = $this->_productCollectionFactory->create(); - $this->_layerFactory->create()->prepareProductCollection($collection); + $this->_catalogLayer->prepareProductCollection($collection); $collection->getSelect()->order('rand()'); $collection->addStoreFilter(); $numProducts = $this->getNumProducts() ? $this->getNumProducts() : 0; diff --git a/app/code/Magento/Catalog/Block/Product/View.php b/app/code/Magento/Catalog/Block/Product/View.php index 6b447738a3e97..3bd14880284df 100644 --- a/app/code/Magento/Catalog/Block/Product/View.php +++ b/app/code/Magento/Catalog/Block/Product/View.php @@ -24,7 +24,7 @@ namespace Magento\Catalog\Block\Product; use Magento\Catalog\Model\Product; -use Magento\Tax\Service\V1\TaxCalculationServiceInterface; +use Magento\Tax\Api\TaxCalculationInterface; /** * Product View block @@ -76,7 +76,7 @@ class View extends AbstractProduct implements \Magento\Framework\View\Block\Iden protected $customerSession; /** - * @var TaxCalculationServiceInterface + * @var TaxCalculationInterface */ protected $taxCalculationService; @@ -90,7 +90,7 @@ class View extends AbstractProduct implements \Magento\Framework\View\Block\Iden * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig * @param \Magento\Framework\Locale\FormatInterface $localeFormat * @param \Magento\Customer\Model\Session $customerSession - * @param TaxCalculationServiceInterface $taxCalculationService + * @param TaxCalculationInterface $taxCalculationService * @param array $data */ public function __construct( @@ -103,7 +103,7 @@ public function __construct( \Magento\Catalog\Model\ProductTypes\ConfigInterface $productTypeConfig, \Magento\Framework\Locale\FormatInterface $localeFormat, \Magento\Customer\Model\Session $customerSession, - TaxCalculationServiceInterface $taxCalculationService, + TaxCalculationInterface $taxCalculationService, array $data = array() ) { $this->_productHelper = $productHelper; @@ -253,7 +253,7 @@ public function getJsonConfig() $tierPricesList = $product->getPriceInfo()->getPrice('tier_price')->getTierPriceList(); foreach ($tierPricesList as $tierPrice) { - $tierPrices[] = $this->_coreData->currency($tierPrice['price']->getValue(), false, false); + $tierPrices[] = $tierPrice['price']->getValue(); } $config = array( 'productId' => $product->getId(), @@ -261,26 +261,10 @@ public function getJsonConfig() 'includeTax' => $this->_taxData->priceIncludesTax() ? 'true' : 'false', 'showIncludeTax' => $this->_taxData->displayPriceIncludingTax(), 'showBothPrices' => $this->_taxData->displayBothPrices(), - 'productPrice' => $this->_coreData->currency( - $product->getPriceInfo()->getPrice('final_price')->getValue(), - false, - false - ), - 'productOldPrice' => $this->_coreData->currency( - $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(), - false, - false - ), - 'inclTaxPrice' => $this->_coreData->currency( - $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(), - false, - false - ), - 'exclTaxPrice' => $this->_coreData->currency( - $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount(), - false, - false - ), + 'productPrice' => $product->getPriceInfo()->getPrice('final_price')->getValue(), + 'productOldPrice' => $product->getPriceInfo()->getPrice('regular_price')->getAmount()->getValue(), + 'inclTaxPrice' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getValue(), + 'exclTaxPrice' => $product->getPriceInfo()->getPrice('final_price')->getAmount()->getBaseAmount(), 'defaultTax' => $defaultTax, 'currentTax' => $currentTax, 'idSuffix' => '_clone', diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php index 3bf1a84148000..a2a32616a7e92 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Category/Save.php @@ -1,6 +1,5 @@ resultRedirectFactory->create(); + $category = $this->_initCategory(); + if (!$category) { - /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */ - $resultRedirect = $this->resultRedirectFactory->create(); return $resultRedirect->setPath('catalog/*/', ['_current' => true, 'id' => null]); } $storeId = $this->getRequest()->getParam('store'); - $refreshTree = 'false'; + $refreshTree = false; $data = $this->getRequest()->getPost(); if ($data) { $category->addData($this->_filterCategoryPostData($data['general'])); @@ -133,7 +139,7 @@ public function execute() } $this->_eventManager->dispatch( 'catalog_category_prepare_save', - array('category' => $category, 'request' => $this->getRequest()) + ['category' => $category, 'request' => $this->getRequest()] ); /** @@ -172,39 +178,38 @@ public function execute() $category->save(); $this->messageManager->addSuccess(__('You saved the category.')); - $refreshTree = 'true'; + $refreshTree = true; } catch (\Exception $e) { $this->messageManager->addError($e->getMessage()); $this->_getSession()->setCategoryData($data); - $refreshTree = 'false'; + $refreshTree = false; } } if ($this->getRequest()->getPost('return_session_messages_only')) { $category->load($category->getId()); // to obtain truncated category name - /** @var $block \Magento\Framework\View\Element\Messages */ $block = $this->layoutFactory->create()->getMessagesBlock(); $block->setMessages($this->messageManager->getMessages(true)); /** @var \Magento\Framework\Controller\Result\JSON $resultJson */ $resultJson = $this->resultJsonFactory->create(); - return $resultJson->setData([ - 'messages' => $block->getGroupedHtml(), - 'error' => $refreshTree !== 'true', - 'category' => $category->toArray() - ]); - } else { - $url = $this->getUrl('catalog/*/edit', array('_current' => true, 'id' => $category->getId())); - $body = ''; + return $resultJson->setData( + [ + 'messages' => $block->getGroupedHtml(), + 'error' => !$refreshTree, + 'category' => $category->toArray() + ] + ); } - /** @var \Magento\Framework\Controller\Result\Raw $resultRaw */ - $resultRaw = $this->resultRawFactory->create(); - return $resultRaw->setContents($body); + + return $resultRedirect->setPath( + 'catalog/*/edit', + [ + '_current' => true, + 'id' => $category->getId() + ] + ); } } diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php index 3ac3ac4ec5c06..b20b1d7f210d9 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Action/Attribute/Save.php @@ -200,13 +200,6 @@ public function execute() } $this->_eventManager->dispatch('catalog_product_to_website_change', array('products' => $productIds)); - - $this->messageManager->addNotice( - __( - 'Please refresh "Product EAV" in System -> Index Management.', - $this->getUrl('adminhtml/process/list') - ) - ); } $this->messageManager->addSuccess( diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index 6eb21e6a00d43..c229dced7a040 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -24,19 +24,55 @@ */ namespace Magento\Catalog\Controller\Adminhtml\Product\Attribute; +use Magento\Catalog\Model\Product\AttributeSet\AlreadyExistsException; + class Save extends \Magento\Catalog\Controller\Adminhtml\Product\Attribute { + /** + * @var \Magento\Catalog\Model\Product\AttributeSet\BuildFactory + */ + protected $buildFactory; + + /** + * @var \Magento\Framework\Filter\FilterManager + */ + protected $filterManager; + + /** + * @var \Magento\Catalog\Helper\Product + */ + protected $productHelper; + + /** + * @var \Magento\Catalog\Model\Resource\Eav\AttributeFactory + */ + protected $attributeFactory; + + /** + * @var \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory + */ + protected $validatorFactory; + + /** + * @var \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory + */ + protected $groupCollectionFactory; + /** * @var \Magento\Backend\Model\View\Result\RedirectFactory */ protected $resultRedirectFactory; /** - * Constructor - * * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Framework\Cache\FrontendInterface $attributeLabelCache * @param \Magento\Framework\Registry $coreRegistry + * @param \Magento\Catalog\Model\Product\AttributeSet\BuildFactory $buildFactory + * @param \Magento\Catalog\Model\Resource\Eav\AttributeFactory $attributeFactory + * @param \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory $validatorFactory + * @param \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory + * @param \Magento\Framework\Filter\FilterManager $filterManager + * @param \Magento\Catalog\Helper\Product $productHelper * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory */ @@ -45,9 +81,21 @@ public function __construct( \Magento\Framework\Cache\FrontendInterface $attributeLabelCache, \Magento\Framework\Registry $coreRegistry, \Magento\Framework\View\Result\PageFactory $resultPageFactory, + \Magento\Catalog\Model\Product\AttributeSet\BuildFactory $buildFactory, + \Magento\Catalog\Model\Resource\Eav\AttributeFactory $attributeFactory, + \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\ValidatorFactory $validatorFactory, + \Magento\Eav\Model\Resource\Entity\Attribute\Group\CollectionFactory $groupCollectionFactory, + \Magento\Framework\Filter\FilterManager $filterManager, + \Magento\Catalog\Helper\Product $productHelper, \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory ) { parent::__construct($context, $attributeLabelCache, $coreRegistry, $resultPageFactory); + $this->buildFactory = $buildFactory; + $this->filterManager = $filterManager; + $this->productHelper = $productHelper; + $this->attributeFactory = $attributeFactory; + $this->validatorFactory = $validatorFactory; + $this->groupCollectionFactory = $groupCollectionFactory; $this->resultRedirectFactory = $resultRedirectFactory; } @@ -59,32 +107,24 @@ public function execute() $data = $this->getRequest()->getPost(); $resultRedirect = $this->resultRedirectFactory->create(); if ($data) { - /** @var $session \Magento\Backend\Model\Auth\Session */ - $session = $this->_objectManager->get('Magento\Backend\Model\Session'); + $setId = $this->getRequest()->getParam('set'); - $isNewAttributeSet = false; + $attributeSet = null; if (!empty($data['new_attribute_set_name'])) { - /** @var $attributeSet \Magento\Eav\Model\Entity\Attribute\Set */ - $attributeSet = $this->_objectManager->create('Magento\Eav\Model\Entity\Attribute\Set'); - $name = $this->_objectManager->get( - 'Magento\Framework\Filter\FilterManager' - )->stripTags( - $data['new_attribute_set_name'] - ); + $name = $this->filterManager->stripTags($data['new_attribute_set_name']); $name = trim($name); - $attributeSet->setEntityTypeId($this->_entityTypeId)->load($name, 'attribute_set_name'); - - if ($attributeSet->getId()) { + + try { + /** @var $attributeSet \Magento\Eav\Model\Entity\Attribute\Set */ + $attributeSet = $this->buildFactory->create() + ->setEntityTypeId($this->_entityTypeId) + ->setSkeletonId($setId) + ->setName($name) + ->getAttributeSet(); + } catch (AlreadyExistsException $alreadyExists) { $this->messageManager->addError(__('Attribute Set with name \'%1\' already exists.', $name)); $this->messageManager->setAttributeData($data); return $resultRedirect->setPath('catalog/*/edit', ['_current' => true]); - } - - try { - $attributeSet->setAttributeSetName($name)->validate(); - $attributeSet->save(); - $attributeSet->initFromSkeleton($this->getRequest()->getParam('set'))->save(); - $isNewAttributeSet = true; } catch (\Magento\Framework\Model\Exception $e) { $this->messageManager->addError($e->getMessage()); } catch (\Exception $e) { @@ -94,11 +134,9 @@ public function execute() $redirectBack = $this->getRequest()->getParam('back', false); /* @var $model \Magento\Catalog\Model\Resource\Eav\Attribute */ - $model = $this->_objectManager->create('Magento\Catalog\Model\Resource\Eav\Attribute'); - /* @var $helper \Magento\Catalog\Helper\Product */ - $helper = $this->_objectManager->get('Magento\Catalog\Helper\Product'); + $model = $this->attributeFactory->create(); - $id = $this->getRequest()->getParam('attribute_id'); + $attributeId = $this->getRequest()->getParam('attribute_id'); $attributeCode = $this->getRequest()->getParam('attribute_code'); $frontendLabel = $this->getRequest()->getParam('frontend_label'); @@ -113,7 +151,7 @@ public function execute() $attributeCode ) ); - return $resultRedirect->setPath('catalog/*/edit', ['attribute_id' => $id, '_current' => true]); + return $resultRedirect->setPath('catalog/*/edit', ['attribute_id' => $attributeId, '_current' => true]); } } $data['attribute_code'] = $attributeCode; @@ -121,19 +159,17 @@ public function execute() //validate frontend_input if (isset($data['frontend_input'])) { /** @var $inputType \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\Validator */ - $inputType = $this->_objectManager->create( - 'Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\Validator' - ); + $inputType = $this->validatorFactory->create(); if (!$inputType->isValid($data['frontend_input'])) { foreach ($inputType->getMessages() as $message) { $this->messageManager->addError($message); } - return $resultRedirect->setPath('catalog/*/edit', ['attribute_id' => $id, '_current' => true]); + return $resultRedirect->setPath('catalog/*/edit', ['attribute_id' => $attributeId, '_current' => true]); } } - if ($id) { - $model->load($id); + if ($attributeId) { + $model->load($attributeId); if (!$model->getId()) { $this->messageManager->addError(__('This attribute no longer exists.')); return $resultRedirect->setPath('catalog/*/'); @@ -141,7 +177,7 @@ public function execute() // entity type check if ($model->getEntityTypeId() != $this->_entityTypeId) { $this->messageManager->addError(__('You can\'t update your attribute.')); - $session->setAttributeData($data); + $this->_session->setAttributeData($data); return $resultRedirect->setPath('catalog/*/'); } @@ -152,8 +188,12 @@ public function execute() /** * @todo add to helper and specify all relations for properties */ - $data['source_model'] = $helper->getAttributeSourceModelByInputType($data['frontend_input']); - $data['backend_model'] = $helper->getAttributeBackendModelByInputType($data['frontend_input']); + $data['source_model'] = $this->productHelper->getAttributeSourceModelByInputType( + $data['frontend_input'] + ); + $data['backend_model'] = $this->productHelper->getAttributeBackendModelByInputType( + $data['frontend_input'] + ); } $data += array('is_filterable' => 0, 'is_filterable_in_search' => 0, 'apply_to' => array()); @@ -174,20 +214,18 @@ public function execute() $model->addData($data); - if (!$id) { + if (!$attributeId) { $model->setEntityTypeId($this->_entityTypeId); $model->setIsUserDefined(1); } $groupCode = $this->getRequest()->getParam('group'); - if ($this->getRequest()->getParam('set') && $groupCode) { + if ($setId && $groupCode) { // For creating product attribute on product page we need specify attribute set and group - $attributeSetId = $isNewAttributeSet ? $attributeSet->getId() : $this->getRequest()->getParam('set'); - $groupCollection = $isNewAttributeSet ? $attributeSet->getGroups() : $this->_objectManager->create( - 'Magento\Eav\Model\Resource\Entity\Attribute\Group\Collection' - )->setAttributeSetFilter( - $attributeSetId - )->load(); + $attributeSetId = $attributeSet ? $attributeSet->getId() : $setId; + $groupCollection = $attributeSet + ? $attributeSet->getGroups() + : $this->groupCollectionFactory->create()->setAttributeSetFilter($attributeSetId)->load(); foreach ($groupCollection as $group) { if ($group->getAttributeGroupCode() == $groupCode) { $attributeGroupId = $group->getAttributeGroupId(); @@ -203,15 +241,15 @@ public function execute() $this->messageManager->addSuccess(__('You saved the product attribute.')); $this->_attributeLabelCache->clean(); - $session->setAttributeData(false); + $this->_session->setAttributeData(false); if ($this->getRequest()->getParam('popup')) { $requestParams = array( - 'id' => $this->getRequest()->getParam('product'), + 'attributeId' => $this->getRequest()->getParam('product'), 'attribute' => $model->getId(), '_current' => true, 'product_tab' => $this->getRequest()->getParam('product_tab') ); - if ($isNewAttributeSet) { + if (!is_null($attributeSet)) { $requestParams['new_attribute_set_id'] = $attributeSet->getId(); } $resultRedirect->setPath('catalog/product/addAttribute', $requestParams); @@ -223,8 +261,8 @@ public function execute() return $resultRedirect; } catch (\Exception $e) { $this->messageManager->addError($e->getMessage()); - $session->setAttributeData($data); - return $resultRedirect->setPath('catalog/*/edit', ['attribute_id' => $id, '_current' => true]); + $this->_session->setAttributeData($data); + return $resultRedirect->setPath('catalog/*/edit', ['attribute_id' => $attributeId, '_current' => true]); } } return $resultRedirect->setPath('catalog/*/'); diff --git a/app/code/Magento/Catalog/Controller/Category/View.php b/app/code/Magento/Catalog/Controller/Category/View.php index 4f927a51e5c79..e119ac28c80a4 100644 --- a/app/code/Magento/Catalog/Controller/Category/View.php +++ b/app/code/Magento/Catalog/Controller/Category/View.php @@ -25,6 +25,7 @@ namespace Magento\Catalog\Controller\Category; use Magento\Framework\View\Result\PageFactory; +use Magento\Catalog\Model\Layer\Resolver; class View extends \Magento\Framework\App\Action\Action { @@ -71,6 +72,13 @@ class View extends \Magento\Framework\App\Action\Action */ protected $resultPageFactory; + /** + * Catalog Layer Resolver + * + * @var Resolver + */ + private $layerResolver; + /** * Constructor * @@ -81,6 +89,7 @@ class View extends \Magento\Framework\App\Action\Action * @param \Magento\Framework\Registry $coreRegistry * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator + * @param Resolver $layerResolver * @param \Magento\Framework\View\Result\PageFactory $resultPageFactory */ public function __construct( @@ -91,8 +100,10 @@ public function __construct( \Magento\Framework\Registry $coreRegistry, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator $categoryUrlPathGenerator, - PageFactory $resultPageFactory + PageFactory $resultPageFactory, + Resolver $layerResolver ) { + parent::__construct($context); $this->_storeManager = $storeManager; $this->_categoryFactory = $categoryFactory; $this->_catalogDesign = $catalogDesign; @@ -100,7 +111,7 @@ public function __construct( $this->_coreRegistry = $coreRegistry; $this->categoryUrlPathGenerator = $categoryUrlPathGenerator; $this->resultPageFactory = $resultPageFactory; - parent::__construct($context); + $this->layerResolver = $layerResolver; } /** @@ -153,6 +164,7 @@ public function execute() } $category = $this->_initCategory(); if ($category) { + $this->layerResolver->create(Resolver::CATALOG_LAYER_CATEGORY); $settings = $this->_catalogDesign->getDesignSettings($category); // apply custom design diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php index aa81392fb0a37..4aea9669cc42c 100644 --- a/app/code/Magento/Catalog/Helper/Data.php +++ b/app/code/Magento/Catalog/Helper/Data.php @@ -24,9 +24,7 @@ namespace Magento\Catalog\Helper; use Magento\Framework\Pricing\PriceCurrencyInterface; -use Magento\Tax\Service\V1\Data\QuoteDetailsBuilder; -use Magento\Tax\Service\V1\Data\QuoteDetails\ItemBuilder as QuoteDetailsItemBuilder; -use Magento\Tax\Service\V1\Data\TaxClassKey; +use Magento\Tax\Api\Data\TaxClassKeyInterface; use Magento\Customer\Model\Address\Converter as AddressConverter; use Magento\Customer\Model\Session as CustomerSession; use Magento\Tax\Model\Config; @@ -142,7 +140,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Tax class key builder * - * @var \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder + * @var \Magento\Tax\Api\Data\TaxClassKeyDataBuilder */ protected $_taxClassKeyBuilder; @@ -156,14 +154,14 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Quote details builder * - * @var QuoteDetailsBuilder + * @var \Magento\Tax\Api\Data\QuoteDetailsDataBuilder */ protected $_quoteDetailsBuilder; /** * Quote details item builder * - * @var QuoteDetailsItemBuilder + * @var \Magento\Tax\Api\Data\QuoteDetailsItemDataBuilder */ protected $_quoteDetailsItemBuilder; @@ -182,7 +180,7 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper /** * Tax calculation service interface * - * @var \Magento\Tax\Service\V1\TaxCalculationServiceInterface + * @var \Magento\Tax\Api\TaxCalculationInterface */ protected $_taxCalculationService; @@ -206,11 +204,11 @@ class Data extends \Magento\Framework\App\Helper\AbstractHelper * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory * @param string $templateFilterModel - * @param TaxClassKeyBuilder $taxClassKeyBuilder + * @param \Magento\Tax\Api\Data\TaxClassKeyDataBuilder $taxClassKeyBuilder * @param Config $taxConfig - * @param QuoteDetailsBuilder $quoteDetailsBuilder - * @param QuoteDetailsItemBuilder $quoteDetailsItemBuilder - * @param TaxCalculationServiceInterface $taxCalculationService + * @param \Magento\Tax\Api\Data\QuoteDetailsDataBuilder $quoteDetailsBuilder + * @param \Magento\Tax\Api\Data\QuoteDetailsItemDataBuilder $quoteDetailsItemBuilder + * @param \Magento\Tax\Api\TaxCalculationInterface $taxCalculationService * @param CustomerSession $customerSession * @param AddressConverter $addressConverter * @param PriceCurrencyInterface $priceCurrency @@ -228,11 +226,11 @@ public function __construct( \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Catalog\Model\Template\Filter\Factory $templateFilterFactory, $templateFilterModel, - \Magento\Tax\Service\V1\Data\TaxClassKeyBuilder $taxClassKeyBuilder, + \Magento\Tax\Api\Data\TaxClassKeyDataBuilder $taxClassKeyBuilder, \Magento\Tax\Model\Config $taxConfig, - QuoteDetailsBuilder $quoteDetailsBuilder, - QuoteDetailsItemBuilder $quoteDetailsItemBuilder, - \Magento\Tax\Service\V1\TaxCalculationServiceInterface $taxCalculationService, + \Magento\Tax\Api\Data\QuoteDetailsDataBuilder $quoteDetailsBuilder, + \Magento\Tax\Api\Data\QuoteDetailsItemDataBuilder $quoteDetailsItemBuilder, + \Magento\Tax\Api\TaxCalculationInterface $taxCalculationService, CustomerSession $customerSession, AddressConverter $addressConverter, PriceCurrencyInterface $priceCurrency @@ -532,8 +530,9 @@ public function getTaxPrice( ->setCode($product->getSku()) ->setShortDescription($product->getShortDescription()) ->setTaxClassKey( - $this->_taxClassKeyBuilder->setType(TaxClassKey::TYPE_ID) - ->setValue($product->getTaxClassId())->create() + $this->_taxClassKeyBuilder->setType(TaxClassKeyInterface::TYPE_ID) + ->setValue($product->getTaxClassId()) + ->create() )->setTaxIncluded($priceIncludesTax) ->setType('product') ->setUnitPrice($price) @@ -542,8 +541,9 @@ public function getTaxPrice( ->setShippingAddress($shippingAddressDataObject) ->setBillingAddress($billingAddressDataObject) ->setCustomerTaxClassKey( - $this->_taxClassKeyBuilder->setType(TaxClassKey::TYPE_ID) - ->setValue($ctc)->create() + $this->_taxClassKeyBuilder->setType(TaxClassKeyInterface::TYPE_ID) + ->setValue($ctc) + ->create() )->setItems([$item]) ->setCustomerId($this->_customerSession->getCustomerId()) ->create(); diff --git a/app/code/Magento/Catalog/Model/AbstractModel.php b/app/code/Magento/Catalog/Model/AbstractModel.php index 3a567565f1d7e..f511b009895b7 100644 --- a/app/code/Magento/Catalog/Model/AbstractModel.php +++ b/app/code/Magento/Catalog/Model/AbstractModel.php @@ -28,7 +28,7 @@ * * @author Magento Core Team */ -abstract class AbstractModel extends \Magento\Framework\Model\AbstractModel +abstract class AbstractModel extends \Magento\Framework\Model\AbstractExtensibleModel { /** * Attribute default values @@ -78,6 +78,7 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractModel /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry + * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -86,13 +87,14 @@ abstract class AbstractModel extends \Magento\Framework\Model\AbstractModel public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, + \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_storeManager = $storeManager; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $metadataService, $resource, $resourceCollection, $data); } /** @@ -328,10 +330,10 @@ public function getExistsStoreValueFlag($attributeCode) * * @return \Magento\Catalog\Model\AbstractModel */ - protected function _beforeSave() + public function beforeSave() { $this->unlockAttributes(); - return parent::_beforeSave(); + return parent::beforeSave(); } /** diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php index f7f2197b8b5eb..f95aac33243a4 100644 --- a/app/code/Magento/Catalog/Model/Category.php +++ b/app/code/Magento/Catalog/Model/Category.php @@ -27,6 +27,7 @@ use Magento\CatalogUrlRewrite\Model\CategoryUrlRewriteGenerator; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; use Magento\UrlRewrite\Model\UrlFinderInterface; +use Magento\Framework\Convert\ConvertArray; /** * Catalog category @@ -37,13 +38,15 @@ * @method int getMovedCategoryId() * @method Category setAffectedCategoryIds(array $categoryIds) * @method array getAffectedCategoryIds() - * @method string getUrlKey() * @method Category setUrlKey(string $urlKey) * @method Category setUrlPath(string $urlPath) * * @SuppressWarnings(PHPMD.LongVariable) */ -class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\Framework\Object\IdentityInterface +class Category extends \Magento\Catalog\Model\AbstractModel implements + \Magento\Framework\Object\IdentityInterface, + \Magento\Catalog\Api\Data\CategoryInterface, + \Magento\Catalog\Api\Data\CategoryTreeInterface { /** * Entity code. @@ -186,6 +189,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry + * @param \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService * @param \Magento\Framework\StoreManagerInterface $storeManager * @param Resource\Category\Tree $categoryTreeResource * @param Resource\Category\TreeFactory $categoryTreeFactory @@ -206,6 +210,7 @@ class Category extends \Magento\Catalog\Model\AbstractModel implements \Magento\ public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, + \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Resource\Category\Tree $categoryTreeResource, \Magento\Catalog\Model\Resource\Category\TreeFactory $categoryTreeFactory, @@ -235,7 +240,15 @@ public function __construct( $this->categoryUrlPathGenerator = $categoryUrlPathGenerator; $this->urlFinder = $urlFinder; $this->indexerRegistry = $indexerRegistry; - parent::__construct($context, $registry, $storeManager, $resource, $resourceCollection, $data); + parent::__construct( + $context, + $registry, + $metadataService, + $storeManager, + $resource, + $resourceCollection, + $data + ); } /** @@ -613,6 +626,10 @@ public function getParentCategory() */ public function getParentId() { + $parentId = $this->getData('parent_id'); + if (isset($parentId)) { + return $parentId; + } $parentIds = $this->getParentIds(); return intval(array_pop($parentIds)); } @@ -803,12 +820,12 @@ public function getName() * @throws \Magento\Framework\Model\Exception * @return $this */ - protected function _beforeDelete() + public function beforeDelete() { if ($this->getResource()->isForbiddenToDelete($this->getId())) { throw new \Magento\Framework\Model\Exception("Can't delete root category."); } - return parent::_beforeDelete(); + return parent::beforeDelete(); } /** @@ -990,9 +1007,9 @@ public function validate() * * @return \Magento\Catalog\Model\Category */ - protected function _afterSave() + public function afterSave() { - $result = parent::_afterSave(); + $result = parent::afterSave(); $this->_getResource()->addCommitCallback(array($this, 'reindex')); return $result; } @@ -1021,10 +1038,10 @@ public function reindex() * * @return \Magento\Framework\Model\AbstractModel */ - protected function _afterDeleteCommit() + public function afterDeleteCommit() { $this->reindex(); - return parent::_afterDeleteCommit(); + return parent::afterDeleteCommit(); } /** @@ -1042,4 +1059,139 @@ public function getIdentities() } return $identities; } + + /** + * @return string|null + */ + public function getPath() + { + return $this->getData('path'); + } + + /** + * @return int|null + */ + public function getPosition() + { + return $this->getData('position'); + } + + /** + * @return int + */ + public function getChildrenCount() + { + return $this->getData('children_count'); + } + + /** + * @return string|null + */ + public function getCreatedAt() + { + return $this->getData('created_at'); + } + + /** + * @return string|null + */ + public function getUpdatedAt() + { + return $this->getData('updated_at'); + } + + /** + * @return bool + */ + public function getIsActive() + { + return $this->getData('is_active'); + } + + /** + * @return int|null + */ + public function getCategoryId() + { + return $this->getData('category_id'); + } + + /** + * @return string|null + */ + public function getDisplayMode() + { + return $this->getData('display_mode'); + } + + /** + * @return bool|null + */ + public function getIncludeInMenu() + { + return $this->getData('include_in_menu'); + } + + /** + * @return string|null + */ + public function getUrlKey() + { + return $this->getData('url_key'); + } + + /** + * @return \Magento\Catalog\Api\Data\CategoryTreeInterface[]|null + */ + public function getChildrenData() + { + return $this->getData('children_data'); + } + + /** + * Return Data Object data in array format. + * + * @return array + */ + public function __toArray() + { + $data = $this->_data; + $hasToArray = function ($model) { + return is_object($model) && method_exists($model, '__toArray') && is_callable([$model, '__toArray']); + }; + foreach ($data as $key => $value) { + if ($hasToArray($value)) { + $data[$key] = $value->__toArray(); + } elseif (is_array($value)) { + foreach ($value as $nestedKey => $nestedValue) { + if ($hasToArray($nestedValue)) { + $value[$nestedKey] = $nestedValue->__toArray(); + } + } + $data[$key] = $value; + } + } + return $data; + } + + /** + * Convert Category model into flat array. + * + * @return array + */ + public function toFlatArray() + { + $dataArray = $this->__toArray(); + //process custom attributes if present + if (array_key_exists('custom_attributes', $dataArray) && !empty($dataArray['custom_attributes'])) { + /** @var \Magento\Framework\Api\AttributeInterface[] $customAttributes */ + $customAttributes = $dataArray['custom_attributes']; + unset ($dataArray['custom_attributes']); + foreach ($customAttributes as $attributeValue) { + $dataArray[$attributeValue[\Magento\Framework\Api\AttributeInterface::ATTRIBUTE_CODE]] + = $attributeValue[\Magento\Framework\Api\AttributeInterface::VALUE]; + } + } + return ConvertArray::toFlatArray($dataArray); + } } diff --git a/app/code/Magento/Catalog/Model/Category/Attribute.php b/app/code/Magento/Catalog/Model/Category/Attribute.php new file mode 100644 index 0000000000000..9311884aa500f --- /dev/null +++ b/app/code/Magento/Catalog/Model/Category/Attribute.php @@ -0,0 +1,166 @@ +getData('apply_to')) { + if (is_array($this->getData('apply_to'))) { + return $this->getData('apply_to'); + } + return explode(',', $this->getData('apply_to')); + } else { + return array(); + } + } + + /** + * {@inheritdoc} + */ + public function getIsHtmlAllowedOnFront() + { + return $this->getData(self::IS_HTML_ALLOWED_ON_FRONT); + } + + /** + * {@inheritdoc} + */ + public function getUsedForSortBy() + { + return $this->getData(self::USED_FOR_SORT_BY); + } + + /** + * {@inheritdoc} + */ + public function getIsWysiwygEnabled() + { + return $this->getData(self::IS_WYSIWYG_ENABLED); + } + + /** + * {@inheritdoc} + */ + public function getIsFilterable() + { + return $this->getData(self::IS_FILTERABLE); + } + + /** + * {@inheritdoc} + */ + public function getIsFilterableInSearch() + { + return $this->getData(self::IS_FILTERABLE_IN_SEARCH); + } + + /** + * {@inheritdoc} + */ + public function getPosition() + { + return $this->getData(self::POSITION); + } + + /** + * {@inheritdoc} + */ + public function getIsSearchable() + { + return $this->getData(self::IS_SEARCHABLE); + } + + /** + * {@inheritdoc} + */ + public function getIsConfigurable() + { + return $this->getData(self::IS_CONFIGURABLE); + } + + /** + * {@inheritdoc} + */ + public function getIsVisibleInAdvancedSearch() + { + return $this->getData(self::IS_VISIBLE_IN_ADVANCED_SEARCH); + } + + /** + * {@inheritdoc} + */ + public function getIsComparable() + { + return $this->getData(self::IS_COMPARABLE); + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return $this->isScopeGlobal() ? 'global' : ($this->isScopeWebsite() ? 'website' : 'store'); + } + + /** + * {@inheritdoc} + */ + public function getIsVisibleOnFront() + { + return $this->getData(self::IS_VISIBLE_ON_FRONT); + } + + /** + * {@inheritdoc} + */ + public function getIsUsedForPromoRules() + { + return $this->getData(self::IS_USED_FOR_PROMO_RULES); + } + + /** + * {@inheritdoc} + */ + public function getUsedInProductListing() + { + return $this->getData(self::USED_IN_PRODUCT_LISTING); + } + + /** + * {@inheritdoc} + */ + public function getIsVisible() + { + return $this->getData(self::IS_VISIBLE); + } +} diff --git a/app/code/Magento/Sales/Service/V1/Action/OrderAddressUpdate.php b/app/code/Magento/Catalog/Model/Category/Attribute/OptionManagement.php similarity index 57% rename from app/code/Magento/Sales/Service/V1/Action/OrderAddressUpdate.php rename to app/code/Magento/Catalog/Model/Category/Attribute/OptionManagement.php index b9300b7231d44..33c9ec7023856 100644 --- a/app/code/Magento/Sales/Service/V1/Action/OrderAddressUpdate.php +++ b/app/code/Magento/Catalog/Model/Category/Attribute/OptionManagement.php @@ -21,40 +21,37 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Sales\Service\V1\Action; +namespace Magento\Catalog\Model\Category\Attribute; -use Magento\Sales\Model\Order\AddressConverter; -use Magento\Sales\Service\V1\Data\OrderAddress; /** - * Class OrderAddressUpdate + * Product options management class */ -class OrderAddressUpdate +class OptionManagement implements \Magento\Catalog\Api\CategoryAttributeOptionManagementInterface { /** - * @var AddressConverter + * @var \Magento\Eav\Api\AttributeOptionManagementInterface */ - protected $addressConverter; + protected $eavOptionManagement; /** - * @param AddressConverter $addressConverter + * @param \Magento\Eav\Api\AttributeOptionManagementInterface $eavOptionManagement */ public function __construct( - AddressConverter $addressConverter + \Magento\Eav\Api\AttributeOptionManagementInterface $eavOptionManagement ) { - $this->addressConverter = $addressConverter; + $this->eavOptionManagement = $eavOptionManagement; } /** - * Invoke order address update service - * - * @param \Magento\Sales\Service\V1\Data\OrderAddress $orderAddress - * @return bool + * {@inheritdoc} + * @codeCoverageIgnore */ - public function invoke(OrderAddress $orderAddress) + public function getItems($attributeCode) { - $orderAddressModel = $this->addressConverter->getModel($orderAddress); - $orderAddressModel->save(); - return true; + return $this->eavOptionManagement->getItems( + \Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE, + $attributeCode + ); } } diff --git a/app/code/Magento/Catalog/Model/Category/AttributeRepository.php b/app/code/Magento/Catalog/Model/Category/AttributeRepository.php new file mode 100644 index 0000000000000..1e87efc19a3a3 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Category/AttributeRepository.php @@ -0,0 +1,107 @@ +metadataConfig = $metadataConfig; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->filterBuilder = $filterBuilder; + $this->eavAttributeRepository = $eavAttributeRepository; + } + + /** + * {@inheritdoc} + */ + public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) + { + return $this->eavAttributeRepository->getList( + \Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE, + $searchCriteria + ); + } + + /** + * {@inheritdoc} + */ + public function get($attributeCode) + { + return $this->eavAttributeRepository->get( + \Magento\Catalog\Api\Data\CategoryAttributeInterface::ENTITY_TYPE_CODE, + $attributeCode + ); + } + + /** + * {@inheritdoc} + */ + public function getCustomAttributesMetadata($dataObjectClassName = null) + { + $searchCriteria = $this->searchCriteriaBuilder->addFilter( + [ + $this->filterBuilder + ->setField('attribute_set_id') + ->setValue(\Magento\Catalog\Api\Data\CategoryAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID) + ->create() + ] + ); + + $customAttributes = []; + $entityAttributes = $this->getList($searchCriteria->create())->getItems(); + + foreach ($entityAttributes as $attributeMetadata) { + $customAttributes[] = $attributeMetadata; + } + return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName)); + } +} diff --git a/app/code/Magento/Catalog/Model/Category/Tree.php b/app/code/Magento/Catalog/Model/Category/Tree.php new file mode 100644 index 0000000000000..fa6aa5bb98bb0 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Category/Tree.php @@ -0,0 +1,165 @@ +categoryTree = $categoryTree; + $this->storeManager = $storeManager; + $this->categoryCollection = $categoryCollection; + $this->treeBuilder = $treeBuilder; + } + + /** + * @param \Magento\Catalog\Model\Category|null $category + * @return Node|null + */ + public function getRootNode($category = null) + { + if (!is_null($category) && $category->getId()) { + return $this->getNode($category); + } + + $store = $this->storeManager->getStore(); + $rootId = $store->getRootCategoryId(); + + $tree = $this->categoryTree->load(null); + $this->prepareCollection(); + $tree->addCollectionData($this->categoryCollection); + $root = $tree->getNodeById($rootId); + return $root; + } + + /** + * @param \Magento\Catalog\Model\Category $category + * @return Node + */ + protected function getNode(\Magento\Catalog\Model\Category $category) + { + $nodeId = $category->getId(); + $node = $this->categoryTree->loadNode($nodeId); + $node->loadChildren(); + $this->prepareCollection(); + $this->categoryTree->addCollectionData($this->categoryCollection); + return $node; + } + + /** + * @return void + */ + protected function prepareCollection() + { + $storeId = $this->storeManager->getStore()->getId(); + $this->categoryCollection->addAttributeToSelect( + 'name' + )->addAttributeToSelect( + 'is_active' + )->setProductStoreId( + $storeId + )->setLoadProductCount( + true + )->setStoreId( + $storeId + ); + } + + /** + * @param \Magento\Framework\Data\Tree\Node $node + * @param int $depth + * @param int $currentLevel + * @return \Magento\Catalog\Api\Data\CategoryTreeInterface[] + */ + public function getTree($node, $depth = null, $currentLevel = 0) + { + /** @var \Magento\Catalog\Api\Data\CategoryTreeInterface[] $children */ + $children = $this->getChildren($node, $depth, $currentLevel); + $this->treeBuilder->setId($node->getId()) + ->setParentId($node->getParentId()) + ->setName($node->getName()) + ->setPosition($node->getPosition()) + ->setLevel($node->getLevel()) + ->setIsActive($node->getIsActive()) + ->setProductCount($node->getProductCount()) + ->setChildrenData($children); + return $this->treeBuilder->create(); + } + + /** + * @param \Magento\Framework\Data\Tree\Node $node + * @param int $depth + * @param int $currentLevel + * @return \Magento\Catalog\Api\Data\CategoryTreeInterface[]|[] + */ + protected function getChildren($node, $depth, $currentLevel) + { + if ($node->hasChildren()) { + $children = array(); + foreach ($node->getChildren() as $child) { + if (!is_null($depth) && $depth <= $currentLevel) { + break; + } + $children[] = $this->getTree($child, $depth, $currentLevel + 1); + } + return $children; + } + return []; + } +} diff --git a/app/code/Magento/Catalog/Model/CategoryLinkManagement.php b/app/code/Magento/Catalog/Model/CategoryLinkManagement.php new file mode 100644 index 0000000000000..a287a49044cb3 --- /dev/null +++ b/app/code/Magento/Catalog/Model/CategoryLinkManagement.php @@ -0,0 +1,77 @@ +categoryRepository = $categoryRepository; + $this->productLinkBuilder = $productLinkInterfaceBuilder; + } + + /** + * {@inheritdoc} + */ + public function getAssignedProducts($categoryId) + { + $category = $this->categoryRepository->get($categoryId); + $productsPosition = $category->getProductsPosition(); + + /** @var \Magento\Framework\Data\Collection\Db $products */ + $products = $category->getProductCollection(); + + /** @var \Magento\Catalog\Api\Data\CategoryProductLinkInterface[] $links */ + $links = []; + + /** @var \Magento\Catalog\Model\Product $product */ + foreach ($products->getItems() as $productId => $product) { + $links[] = $this->productLinkBuilder->populateWithArray( + [ + 'sku' => $product->getSku(), + 'position' => $productsPosition[$productId], + 'category_id' => $category->getId() + ] + )->create(); + } + return $links; + } +} diff --git a/app/code/Magento/Catalog/Model/CategoryLinkRepository.php b/app/code/Magento/Catalog/Model/CategoryLinkRepository.php new file mode 100644 index 0000000000000..b18e86cacc129 --- /dev/null +++ b/app/code/Magento/Catalog/Model/CategoryLinkRepository.php @@ -0,0 +1,118 @@ +categoryRepository = $categoryRepository; + $this->productRepository = $productRepository; + } + + /** + * {@inheritdoc} + */ + public function save(\Magento\Catalog\Api\Data\CategoryProductLinkInterface $productLink) + { + $category = $this->categoryRepository->get($productLink->getCategoryId()); + $product = $this->productRepository->get($productLink->getSku()); + $productPositions = $category->getProductsPosition(); + $productPositions[$product->getId()] = $productLink->getPosition(); + $category->setPostedProducts($productPositions); + try { + $category->save(); + } catch (\Exception $e) { + throw new CouldNotSaveException( + 'Could not save product "%product_id" with position %position to category %category_id', + [ + 'product_id' => $product->getId(), + 'position' => $productLink->getPosition(), + 'category_id' => $category->getId() + ], + $e + ); + } + return true; + } + + /** + * {@inheritdoc} + */ + public function delete(\Magento\Catalog\Api\Data\CategoryProductLinkInterface $productLink) + { + return $this->deleteByIds($productLink->getCategoryId(), $productLink->getSku()); + } + + /** + * {@inheritdoc} + */ + public function deleteByIds($categoryId, $productSku) + { + $category = $this->categoryRepository->get($categoryId); + $product = $this->productRepository->get($productSku); + $productPositions = $category->getProductsPosition(); + + $productID = $product->getId(); + if (!isset($productPositions[$productID])) { + throw new InputException('Category does not contain specified product'); + } + unset($productPositions[$productID]); + + $category->setPostedProducts($productPositions); + try { + $category->save(); + } catch (\Exception $e) { + throw new CouldNotSaveException( + 'Could not save product "%product_id" with position %position to category %category_id', + [ + 'product_id' => $product->getId(), + 'category_id' => $category->getId() + ], + $e + ); + } + return true; + } +} diff --git a/app/code/Magento/Catalog/Model/CategoryManagement.php b/app/code/Magento/Catalog/Model/CategoryManagement.php new file mode 100644 index 0000000000000..d69ffaaf09681 --- /dev/null +++ b/app/code/Magento/Catalog/Model/CategoryManagement.php @@ -0,0 +1,93 @@ +categoryRepository = $categoryRepository; + $this->categoryTree = $categoryTree; + } + + /** + * {@inheritdoc} + */ + public function getTree($rootCategoryId = null, $depth = null) + { + $category = null; + if (!is_null($rootCategoryId)) { + /** @var \Magento\Catalog\Model\Category $category */ + $category = $this->categoryRepository->get($rootCategoryId); + } + $result = $this->categoryTree->getTree($this->categoryTree->getRootNode($category), $depth); + return $result; + } + + /** + * {@inheritdoc} + */ + public function move($categoryId, $parentId, $afterId = null) + { + $model = $this->categoryRepository->get($categoryId); + $parentCategory = $this->categoryRepository->get($parentId); + + if ($parentCategory->hasChildren()) { + $parentChildren = $parentCategory->getChildren(); + $categoryIds = explode(',', $parentChildren); + $lastId = array_pop($categoryIds); + $afterId = (is_null($afterId) || $afterId > $lastId) ? $lastId : $afterId; + } + + if (strpos($parentCategory->getPath(), $model->getPath()) === 0) { + throw new \Magento\Framework\Model\Exception( + "Operation do not allow to move a parent category to any of children category" + ); + } + try { + $model->move($parentId, $afterId); + } catch (\Exception $e) { + throw new \Magento\Framework\Model\Exception('Could not move category'); + } + return true; + } +} diff --git a/app/code/Magento/Catalog/Model/CategoryProductLink.php b/app/code/Magento/Catalog/Model/CategoryProductLink.php new file mode 100644 index 0000000000000..f743b15eadcfd --- /dev/null +++ b/app/code/Magento/Catalog/Model/CategoryProductLink.php @@ -0,0 +1,53 @@ +_get('sku'); + } + + /** + * {@inheritdoc} + */ + public function getPosition() + { + return $this->_get('position'); + } + + /** + * {@inheritdoc} + */ + public function getCategoryId() + { + return $this->_get('category_id'); + } +} diff --git a/app/code/Magento/Catalog/Model/CategoryRepository.php b/app/code/Magento/Catalog/Model/CategoryRepository.php new file mode 100644 index 0000000000000..cee13223fa879 --- /dev/null +++ b/app/code/Magento/Catalog/Model/CategoryRepository.php @@ -0,0 +1,185 @@ +categoryFactory = $categoryFactory; + $this->categoryResource = $categoryResource; + $this->storeManager = $storeManager; + $this->categoryBuilder = $dataBuilder; + } + + /** + * {@inheritdoc} + */ + public function save(\Magento\Catalog\Api\Data\CategoryInterface $category) + { + $existingData = $category->toFlatArray(); + if ($category->getId()) { + $existingCategory = $this->get($category->getId()); + if (isset($existingData['image']) && is_array($existingData['image'])) { + $existingData['image_additional_data'] = $existingData['image']; + unset($existingData['image']); + } + $existingData['id'] = $existingCategory->getId(); + $existingData['parent_id'] = $existingCategory->getParentId(); + $existingData['path'] = $existingCategory->getPath(); + $existingData['is_active'] = $existingCategory->getIsActive(); + $existingData['include_in_menu'] = + isset($existingData['include_in_menu']) ? (bool)$existingData['include_in_menu'] : false; + $category->setData($existingData); + } else { + $parentId = $category->getParentId() ?: $this->storeManager->getStore()->getRootCategoryId(); + $parentCategory = $this->get($parentId); + /** @var $category Category */ + $category->setData($existingData); + $category->setPath($parentCategory->getPath()); + } + try { + $this->validateCategory($category); + $this->categoryResource->save($category); + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not save category: %message', ['message' => $e->getMessage()], $e); + } + return $category; + } + + /** + * {@inheritdoc} + */ + public function get($categoryId) + { + /** @var Category $category */ + $category = $this->categoryFactory->create(); + $category->load($categoryId); + if (!$category->getId()) { + throw NoSuchEntityException::singleField('id', $categoryId); + } + return $category; + } + + /** + * {@inheritdoc} + */ + public function delete(\Magento\Catalog\Api\Data\CategoryInterface $category) + { + try { + $this->categoryResource->delete($category); + } catch (\Exception $e) { + throw new StateException( + 'Cannot delete category with id %category_id', + [ + 'category_id' => $category->getId() + ], + $e + ); + } + return true; + } + + /** + * {@inheritdoc} + */ + public function deleteByIdentifier($categoryId) + { + $category = $this->get($categoryId); + return $this->delete($category); + } + + /** + * Validate category process + * + * @param Category $category + * @return void + * @throws \Magento\Framework\Model\Exception + */ + protected function validateCategory(Category $category) + { + $useConfigFields = []; + foreach ($this->useConfigFields as $field) { + if (!$category->getData($field)) { + $useConfigFields[] = $field; + } + } + $category->setData('use_post_data_config', $useConfigFields); + $validate = $category->validate(); + if ($validate !== true) { + foreach ($validate as $code => $error) { + if ($error === true) { + $attribute = $this->categoryResource->getAttribute($code)->getFrontend()->getLabel(); + throw new \Magento\Framework\Model\Exception(__('Attribute "%1" is required.', $attribute)); + } else { + throw new \Magento\Framework\Model\Exception($error); + } + } + } + $category->unsetData('use_post_data_config'); + } +} diff --git a/app/code/Magento/Catalog/Model/Config/Backend/Category.php b/app/code/Magento/Catalog/Model/Config/Backend/Category.php index 39f201e669de0..deefdfe1ef0fe 100644 --- a/app/code/Magento/Catalog/Model/Config/Backend/Category.php +++ b/app/code/Magento/Catalog/Model/Config/Backend/Category.php @@ -64,7 +64,7 @@ public function __construct( /** * {@inheritdoc} */ - protected function _afterSave() + public function afterSave() { if ($this->getScope() == 'stores') { $rootId = $this->getValue(); diff --git a/app/code/Magento/Catalog/Model/Config/Source/Price/Step.php b/app/code/Magento/Catalog/Model/Config/Source/Price/Step.php index 7aa4dde94c53a..9e3c30891b743 100644 --- a/app/code/Magento/Catalog/Model/Config/Source/Price/Step.php +++ b/app/code/Magento/Catalog/Model/Config/Source/Price/Step.php @@ -23,7 +23,10 @@ */ namespace Magento\Catalog\Model\Config\Source\Price; -class Step implements \Magento\Framework\Option\ArrayInterface +use Magento\Catalog\Model\Layer\Filter\Dynamic\AlgorithmFactory; +use Magento\Framework\Option\ArrayInterface; + +class Step implements ArrayInterface { /** * {@inheritdoc} @@ -34,15 +37,15 @@ public function toOptionArray() { return array( array( - 'value' => \Magento\Catalog\Model\Layer\Filter\Price::RANGE_CALCULATION_AUTO, + 'value' => AlgorithmFactory::RANGE_CALCULATION_AUTO, 'label' => __('Automatic (equalize price ranges)') ), array( - 'value' => \Magento\Catalog\Model\Layer\Filter\Price::RANGE_CALCULATION_IMPROVED, + 'value' => AlgorithmFactory::RANGE_CALCULATION_IMPROVED, 'label' => __('Automatic (equalize product counts)') ), array( - 'value' => \Magento\Catalog\Model\Layer\Filter\Price::RANGE_CALCULATION_MANUAL, + 'value' => AlgorithmFactory::RANGE_CALCULATION_MANUAL, 'label' => __('Manual') ) ); diff --git a/app/code/Magento/Catalog/Model/Entity/Attribute.php b/app/code/Magento/Catalog/Model/Entity/Attribute.php index 1a88eda64605f..74492bbb0432c 100644 --- a/app/code/Magento/Catalog/Model/Entity/Attribute.php +++ b/app/code/Magento/Catalog/Model/Entity/Attribute.php @@ -50,15 +50,11 @@ * @method \Magento\Catalog\Model\Entity\Attribute setIsUsedForPriceRules(int $value) * @method int getIsFilterableInSearch() * @method \Magento\Catalog\Model\Entity\Attribute setIsFilterableInSearch(int $value) - * @method int getUsedInProductListing() * @method \Magento\Catalog\Model\Entity\Attribute setUsedInProductListing(int $value) - * @method int getUsedForSortBy() * @method \Magento\Catalog\Model\Entity\Attribute setUsedForSortBy(int $value) - * @method string getApplyTo() * @method \Magento\Catalog\Model\Entity\Attribute setApplyTo(string $value) * @method int getIsVisibleInAdvancedSearch() * @method \Magento\Catalog\Model\Entity\Attribute setIsVisibleInAdvancedSearch(int $value) - * @method int getPosition() * @method \Magento\Catalog\Model\Entity\Attribute setPosition(int $value) * @method int getIsWysiwygEnabled() * @method \Magento\Catalog\Model\Entity\Attribute setIsWysiwygEnabled(int $value) @@ -91,12 +87,14 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry + * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory + * @param \Magento\Eav\Api\Data\AttributeOptionDataBuilder $optionDataBuilder * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList * @param \Magento\Framework\Locale\ResolverInterface $localeResolver @@ -108,12 +106,14 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, + \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, + \Magento\Eav\Api\Data\AttributeOptionDataBuilder $optionDataBuilder, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Framework\Locale\ResolverInterface $localeResolver, @@ -126,12 +126,14 @@ public function __construct( parent::__construct( $context, $registry, + $metadataService, $coreData, $eavConfig, $eavTypeFactory, $storeManager, $resourceHelper, $universalFactory, + $optionDataBuilder, $localeDate, $reservedAttributeList, $localeResolver, @@ -147,7 +149,7 @@ public function __construct( * @return \Magento\Framework\Model\AbstractModel * @throws \Magento\Eav\Exception */ - protected function _beforeSave() + public function beforeSave() { try { $this->attrLockValidator->validate($this); @@ -156,7 +158,7 @@ protected function _beforeSave() } $this->setData('modulePrefix', self::MODULE_NAME); - return parent::_beforeSave(); + return parent::beforeSave(); } /** @@ -164,12 +166,12 @@ protected function _beforeSave() * * @return \Magento\Framework\Model\AbstractModel */ - protected function _afterSave() + public function afterSave() { /** * Fix saving attribute in admin */ $this->_eavConfig->clear(); - return parent::_afterSave(); + return parent::afterSave(); } } diff --git a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php index 42e5c3be7395e..17feb5a70d48f 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php +++ b/app/code/Magento/Catalog/Model/Indexer/Category/Flat/System/Config/Mode.php @@ -64,7 +64,7 @@ public function __construct( * * @return $this */ - protected function _afterSave() + public function afterSave() { $this->_getResource()->addCommitCallback(array($this, 'processValue')); return $this; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php index 0a58e97f2bce6..d6038f80e39bc 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/System/Config/Mode.php @@ -68,7 +68,7 @@ public function __construct( * * @return $this */ - protected function _afterSave() + public function afterSave() { $this->_getResource()->addCommitCallback(array($this, 'processValue')); return $this; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php index 5e11522d526b6..16d203d4bc52b 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/Plugin/CustomerGroup.php @@ -23,33 +23,33 @@ */ namespace Magento\Catalog\Model\Indexer\Product\Price\Plugin; -use Magento\Customer\Service\V1\CustomerGroupServiceInterface; +use Magento\Customer\Api\GroupRepositoryInterface; class CustomerGroup extends AbstractPlugin { /** - * Invalidate the indexer after the group is created. + * Invalidate the indexer after the group is saved. * - * @param CustomerGroupServiceInterface $subject - * @param string $result + * @param GroupRepositoryInterface $subject + * @param string $result * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterCreateGroup(CustomerGroupServiceInterface $subject, $result) + public function afterSave(GroupRepositoryInterface $subject, $result) { $this->invalidateIndexer(); return $result; } /** - * Invalidate the indexer after the group is updated. + * Invalidate the indexer after the group is deleted. * - * @param CustomerGroupServiceInterface $subject - * @param string $result + * @param GroupRepositoryInterface $subject + * @param string $result * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterUpdateGroup(CustomerGroupServiceInterface $subject, $result) + public function afterDelete(GroupRepositoryInterface $subject, $result) { $this->invalidateIndexer(); return $result; @@ -58,12 +58,12 @@ public function afterUpdateGroup(CustomerGroupServiceInterface $subject, $result /** * Invalidate the indexer after the group is deleted. * - * @param CustomerGroupServiceInterface $subject - * @param string $result + * @param GroupRepositoryInterface $subject + * @param string $result * @return string * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function afterDeleteGroup(CustomerGroupServiceInterface $subject, $result) + public function afterDeleteById(GroupRepositoryInterface $subject, $result) { $this->invalidateIndexer(); return $result; diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php index 5c0235eb97a57..5bba2f9c0b9fd 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Price/System/Config/PriceScope.php @@ -58,7 +58,7 @@ public function __construct( * * @return \Magento\Catalog\Model\Indexer\Product\Price\System\Config\PriceScope */ - protected function _afterSave() + public function afterSave() { $this->_getResource()->addCommitCallback(array($this, 'processValue')); return $this; diff --git a/app/code/Magento/Catalog/Model/Layer/Category.php b/app/code/Magento/Catalog/Model/Layer/Category.php index b77a6357be266..fcdf88142b127 100644 --- a/app/code/Magento/Catalog/Model/Layer/Category.php +++ b/app/code/Magento/Catalog/Model/Layer/Category.php @@ -25,14 +25,13 @@ namespace Magento\Catalog\Model\Layer; use Magento\Catalog\Model\CategoryFactory; -use Magento\Catalog\Model\Layer; use Magento\Catalog\Model\Resource; -use Magento\Framework\Object; +use Magento\Catalog\Model\Layer\ContextInterface; class Category extends \Magento\Catalog\Model\Layer { /** - * @param Category\Context $context + * @param ContextInterface $context * @param StateFactory $layerStateFactory * @param CategoryFactory $categoryFactory * @param Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory @@ -42,7 +41,7 @@ class Category extends \Magento\Catalog\Model\Layer * @param array $data */ public function __construct( - Category\Context $context, + ContextInterface $context, StateFactory $layerStateFactory, CategoryFactory $categoryFactory, Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, diff --git a/app/code/Magento/Catalog/Model/Layer/Category/Context.php b/app/code/Magento/Catalog/Model/Layer/Category/Context.php deleted file mode 100644 index 47b742c0537df..0000000000000 --- a/app/code/Magento/Catalog/Model/Layer/Category/Context.php +++ /dev/null @@ -1,41 +0,0 @@ -collectionFactory = $collectionFactory; $this->storeManager = $storeManager; - $this->layer = $layer; + $this->layer = $layerResolver->get(); } /** diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php index c760506c2c0ee..d6797f327aa1f 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/AbstractFilter.php @@ -25,11 +25,11 @@ /** * Layer category filter abstract model - * - * @author Magento Core Team */ -abstract class AbstractFilter extends \Magento\Framework\Object +abstract class AbstractFilter extends \Magento\Framework\Object implements FilterInterface { + const ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS = 1; + /** * Request variable name with filter value * @@ -65,23 +65,34 @@ abstract class AbstractFilter extends \Magento\Framework\Object */ protected $_filterItemFactory; + /** + * Item Data Builder + * + * @var \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder + */ + protected $itemDataBuilder; + /** * Constructor * * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer + * @param \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder * @param array $data + * @throws \Magento\Framework\Model\Exception */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, + \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder, array $data = array() ) { $this->_filterItemFactory = $filterItemFactory; $this->_storeManager = $storeManager; $this->_catalogLayer = $layer; + $this->itemDataBuilder = $itemDataBuilder; parent::__construct($data); if ($this->hasAttributeModel()) { $this->_requestVar = $this->getAttributeModel()->getAttributeCode(); @@ -133,10 +144,10 @@ public function getCleanValue() /** * Apply filter to collection * - * @param \Zend_Controller_Request_Abstract $request + * @param \Magento\Framework\App\RequestInterface $request * @return $this */ - public function apply(\Zend_Controller_Request_Abstract $request) + public function apply(\Magento\Framework\App\RequestInterface $request) { return $this; } @@ -164,6 +175,18 @@ public function getItems() return $this->_items; } + /** + * Set all filter items + * + * @param array $items + * @return $this + */ + public function setItems(array $items) + { + $this->_items = $items; + return $this; + } + /** * Get data array for building filter items * @@ -224,15 +247,11 @@ public function getLayer() */ protected function _createItem($label, $value, $count = 0) { - return $this->_filterItemFactory->create()->setFilter( - $this - )->setLabel( - $label - )->setValue( - $value - )->setCount( - $count - ); + return $this->_filterItemFactory->create() + ->setFilter($this) + ->setLabel($label) + ->setValue($value) + ->setCount($count); } /** @@ -287,6 +306,7 @@ public function getAttributeModel() * Get filter text label * * @return string + * @throws \Magento\Framework\Model\Exception */ public function getName() { @@ -352,4 +372,27 @@ public function getClearLinkText() { return false; } + + /** + * Get option text from frontend model by option id + * + * @param int $optionId + * @throws \Magento\Framework\Model\Exception + * @return string|bool + */ + protected function getOptionText($optionId) + { + return $this->getAttributeModel()->getFrontend()->getOption($optionId); + } + + /** + * Check whether specified attribute can be used in LN + * + * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute + * @return int + */ + protected function getAttributeIsFilterable($attribute) + { + return $attribute->getIsFilterable(); + } } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php b/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php index d365147d7a47c..8d7e467103268 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Attribute.php @@ -30,8 +30,6 @@ */ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter { - const OPTIONS_ONLY_WITH_RESULTS = 1; - /** * Resource instance * @@ -55,6 +53,7 @@ class Attribute extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter * @param ItemFactory $filterItemFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer + * @param \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder * @param \Magento\Catalog\Model\Resource\Layer\Filter\AttributeFactory $filterAttributeFactory * @param \Magento\Framework\Stdlib\String $string * @param \Magento\Framework\Filter\StripTags $tagFilter @@ -64,6 +63,7 @@ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, + \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder, \Magento\Catalog\Model\Resource\Layer\Filter\AttributeFactory $filterAttributeFactory, \Magento\Framework\Stdlib\String $string, \Magento\Framework\Filter\StripTags $tagFilter, @@ -73,7 +73,7 @@ public function __construct( $this->string = $string; $this->_requestVar = 'attribute'; $this->tagFilter = $tagFilter; - parent::__construct($filterItemFactory, $storeManager, $layer, $data); + parent::__construct($filterItemFactory, $storeManager, $layer, $itemDataBuilder, $data); } /** @@ -86,52 +86,31 @@ protected function _getResource() return $this->_resource; } - /** - * Get option text from frontend model by option id - * - * @param int $optionId - * @return string|bool - */ - protected function _getOptionText($optionId) - { - return $this->getAttributeModel()->getFrontend()->getOption($optionId); - } - /** * Apply attribute option filter to product collection * - * @param \Zend_Controller_Request_Abstract $request + * @param \Magento\Framework\App\RequestInterface $request * @return $this */ - public function apply(\Zend_Controller_Request_Abstract $request) + public function apply(\Magento\Framework\App\RequestInterface $request) { $filter = $request->getParam($this->_requestVar); if (is_array($filter)) { return $this; } - $text = $this->_getOptionText($filter); + $text = $this->getOptionText($filter); if ($filter && strlen($text)) { $this->_getResource()->applyFilterToCollection($this, $filter); $this->getLayer()->getState()->addFilter($this->_createItem($text, $filter)); - $this->_items = array(); + $this->_items = []; } return $this; } - /** - * Check whether specified attribute can be used in LN - * - * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute - * @return bool - */ - protected function _getIsFilterableAttribute($attribute) - { - return $attribute->getIsFilterable(); - } - /** * Get data array for building attribute filter items * + * @throws \Magento\Framework\Model\Exception * @return array */ protected function _getItemsData() @@ -141,31 +120,30 @@ protected function _getItemsData() $options = $attribute->getFrontend()->getSelectOptions(); $optionsCount = $this->_getResource()->getCount($this); - $data = array(); foreach ($options as $option) { if (is_array($option['value'])) { continue; } if ($this->string->strlen($option['value'])) { // Check filter type - if ($this->_getIsFilterableAttribute($attribute) == self::OPTIONS_ONLY_WITH_RESULTS) { + if ($this->getAttributeIsFilterable($attribute) == self::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS) { if (!empty($optionsCount[$option['value']])) { - $data[] = array( - 'label' => $this->tagFilter->filter($option['label']), - 'value' => $option['value'], - 'count' => $optionsCount[$option['value']] + $this->itemDataBuilder->addItemData( + $this->tagFilter->filter($option['label']), + $option['value'], + $optionsCount[$option['value']] ); } } else { - $data[] = array( - 'label' => $this->tagFilter->filter($option['label']), - 'value' => $option['value'], - 'count' => isset($optionsCount[$option['value']]) ? $optionsCount[$option['value']] : 0 + $this->itemDataBuilder->addItemData( + $this->tagFilter->filter($option['label']), + $option['value'], + isset($optionsCount[$option['value']]) ? $optionsCount[$option['value']] : 0 ); } } } - return $data; + return $this->itemDataBuilder->build(); } } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Category.php b/app/code/Magento/Catalog/Model/Layer/Filter/Category.php index be76e54f90fa1..fa54cadaddcd3 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Category.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Category.php @@ -29,8 +29,12 @@ */ namespace Magento\Catalog\Model\Layer\Filter; +use Magento\Catalog\Model\Layer\Filter\DataProvider\CategoryFactory; +use Magento\Catalog\Model\Layer\Filter\DataProvider\Category as CategoryDataProvider; + class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter { + /** * Active Category Id * @@ -66,31 +70,35 @@ class Category extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ protected $_categoryFactory; + /** + * @var CategoryDataProvider + */ + private $dataProvider; + /** * Construct * * @param \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer - * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory + * @param \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder * @param \Magento\Framework\Escaper $escaper - * @param \Magento\Framework\Registry $coreRegistry + * @param CategoryFactory $categoryDataProviderFactory * @param array $data */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, - \Magento\Catalog\Model\CategoryFactory $categoryFactory, + \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder, \Magento\Framework\Escaper $escaper, - \Magento\Framework\Registry $coreRegistry, - array $data = array() + CategoryFactory $categoryDataProviderFactory, + array $data = [] ) { - $this->_categoryFactory = $categoryFactory; $this->_escaper = $escaper; - $this->_coreRegistry = $coreRegistry; - parent::__construct($filterItemFactory, $storeManager, $layer, $data); + parent::__construct($filterItemFactory, $storeManager, $layer, $itemDataBuilder, $data); $this->_requestVar = 'cat'; + $this->dataProvider = $categoryDataProviderFactory->create(['layer' => $this->getLayer()]); } /** @@ -100,69 +108,33 @@ public function __construct( */ public function getResetValue() { - if ($this->_appliedCategory) { - /** - * Revert path ids - */ - $pathIds = array_reverse($this->_appliedCategory->getPathIds()); - $curCategoryId = $this->getLayer()->getCurrentCategory()->getId(); - if (isset($pathIds[1]) && $pathIds[1] != $curCategoryId) { - return $pathIds[1]; - } - } - return null; + return $this->dataProvider->getResetValue(); } /** * Apply category filter to layer * - * @param \Zend_Controller_Request_Abstract $request + * @param \Magento\Framework\App\RequestInterface $request * @return $this */ - public function apply(\Zend_Controller_Request_Abstract $request) + public function apply(\Magento\Framework\App\RequestInterface $request) { - $filter = (int)$request->getParam($this->getRequestVar()); - if (!$filter) { + $categoryId = (int)$request->getParam($this->getRequestVar()); + if (!$categoryId) { return $this; } - $this->_categoryId = $filter; - $this->_coreRegistry->register('current_category_filter', $this->getCategory(), true); - $this->_appliedCategory = $this->_categoryFactory->create()->setStoreId( - $this->_storeManager->getStore()->getId() - )->load( - $filter - ); + $this->dataProvider->setCategoryId($categoryId); - if ($this->_isValidCategory($this->_appliedCategory)) { - $this->getLayer()->getProductCollection()->addCategoryFilter($this->_appliedCategory); - - $this->getLayer()->getState()->addFilter($this->_createItem($this->_appliedCategory->getName(), $filter)); + if ($this->dataProvider->isValid()) { + $category = $this->dataProvider->getCategory(); + $this->getLayer()->getProductCollection()->addCategoryFilter($category); + $this->getLayer()->getState()->addFilter($this->_createItem($category->getName(), $categoryId)); } return $this; } - /** - * Validate category for be using as filter - * - * @param \Magento\Catalog\Model\Category $category - * @return mixed - */ - protected function _isValidCategory($category) - { - if ($category->getId()) { - while ($category->getLevel() != 0) { - if (!$category->getIsActive()) { - return false; - } - $category = $category->getParentCategory(); - } - return true; - } - return false; - } - /** * Get filter name * @@ -173,23 +145,6 @@ public function getName() return __('Category'); } - /** - * Get selected category object - * - * @return \Magento\Catalog\Model\Category - */ - public function getCategory() - { - if (!is_null($this->_categoryId)) { - /** @var \Magento\Catalog\Model\Category $category */ - $category = $this->_categoryFactory->create()->load($this->_categoryId); - if ($category->getId()) { - return $category; - } - } - return $this->getLayer()->getCurrentCategory(); - } - /** * Get data array for building category filter items * @@ -197,23 +152,22 @@ public function getCategory() */ protected function _getItemsData() { - $category = $this->getCategory(); + $category = $this->dataProvider->getCategory(); $categories = $category->getChildrenCategories(); $this->getLayer()->getProductCollection()->addCountToCategories($categories); - $data = array(); if ($category->getIsActive()) { foreach ($categories as $category) { if ($category->getIsActive() && $category->getProductCount()) { - $data[] = array( - 'label' => $this->_escaper->escapeHtml($category->getName()), - 'value' => $category->getId(), - 'count' => $category->getProductCount() + $this->itemDataBuilder->addItemData( + $this->_escaper->escapeHtml($category->getName()), + $category->getId(), + $category->getProductCount() ); } } } - return $data; + return $this->itemDataBuilder->build(); } } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Category.php b/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Category.php new file mode 100644 index 0000000000000..4264d4724ba62 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Category.php @@ -0,0 +1,185 @@ +coreRegistry = $coreRegistry; + $this->layer = $layer; + $this->categoryFactory = $categoryFactory; + } + + /** + * Validate category for using as filter + * + * @return mixed + */ + public function isValid() + { + $category = $this->getCategory(); + if ($category->getId()) { + while ($category->getLevel() != 0) { + if (!$category->getIsActive()) { + return false; + } + $category = $category->getParentCategory(); + } + + return true; + } + + return false; + } + + /** + * @param int $categoryId + * @return $this + */ + public function setCategoryId($categoryId) + { + $this->isApplied = true; + $this->category = null; + $this->categoryId = $categoryId; + + return $this; + } + + /** + * @return boolean + */ + private function isApplied() + { + return $this->isApplied; + } + + /** + * Get selected category object + * + * @return CategoryModel + */ + public function getCategory() + { + if (is_null($this->category)) { + /** @var CategoryModel|null $category */ + $category = null; + if (!is_null($this->categoryId)) { + $category = $this->categoryFactory->create() + ->setStoreId( + $this->getLayer() + ->getCurrentStore() + ->getId() + ) + ->load($this->categoryId); + } + + if (is_null($category) || !$category->getId()) { + $category = $this->getLayer() + ->getCurrentCategory(); + } + + $this->coreRegistry->register('current_category_filter', $category, true); + $this->category = $category; + } + + return $this->category; + } + + /** + * Get filter value for reset current filter state + * + * @return mixed|null + */ + public function getResetValue() + { + if ($this->isApplied()) { + /** + * Revert path ids + */ + $category = $this->getCategory(); + $pathIds = array_reverse($category->getPathIds()); + $curCategoryId = $this->getLayer() + ->getCurrentCategory() + ->getId(); + if (isset($pathIds[1]) && $pathIds[1] != $curCategoryId) { + return $pathIds[1]; + } + } + + return null; + } + + /** + * @return Layer + */ + private function getLayer() + { + return $this->layer; + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Decimal.php b/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Decimal.php new file mode 100644 index 0000000000000..6c4ed1724dcc3 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Decimal.php @@ -0,0 +1,165 @@ +resource = $resource; + } + + /** + * @param FilterInterface $filter + * @return int + */ + public function getRange(FilterInterface $filter) + { + $range = $this->range; + if (!$range) { + $maxValue = $this->getMaxValue($filter); + $index = 1; + do { + $range = pow(10, strlen(floor($maxValue)) - $index); + $items = $this->getRangeItemCounts($range, $filter); + $index++; + } while ($range > self::MIN_RANGE_POWER && count($items) < 2); + $this->range = $range; + } + + return $range; + } + + /** + * @param int $range + * @return void + */ + public function setRange($range) + { + $this->range = $range; + } + + /** + * Retrieve maximum value from layer products set + * + * @param FilterInterface $filter + * @return float + */ + public function getMaxValue(FilterInterface $filter) + { + if (is_null($this->max)) { + $this->loadValues($filter); + } + + return $this->max; + } + + /** + * Retrieve minimal value from layer products set + * + * @param FilterInterface $filter + * @return float + */ + public function getMinValue(FilterInterface $filter) + { + if (is_null($this->min)) { + $this->loadValues($filter); + } + + return $this->min; + } + + /** + * Retrieve information about products count in range + * + * @param int $range + * @param FilterInterface $filter + * @return mixed + */ + public function getRangeItemCounts($range, FilterInterface $filter) + { + $count = array_key_exists($range, $this->rangeItemsCount) ? $this->rangeItemsCount[$range] : null; + if (is_null($count)) { + $count = $this->getResource() + ->getCount($filter, $range); + $this->rangeItemsCount[$range] = $count; + } + + return $count; + } + + /** + * @return \Magento\Catalog\Model\Resource\Layer\Filter\Decimal + */ + public function getResource() + { + return $this->resource; + } + + /** + * @param FilterInterface $filter + * @return mixed + */ + private function loadValues(FilterInterface $filter) + { + list($min, $max) = $this->getResource() + ->getMinMax($filter); + $this->min = $min; + $this->max = $max; + + return $this; + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Price.php b/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Price.php new file mode 100644 index 0000000000000..fe3ddc639c60c --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/DataProvider/Price.php @@ -0,0 +1,400 @@ +layer = $layer; + $this->coreRegistry = $coreRegistry; + $this->scopeConfig = $scopeConfig; + $this->resource = $resource; + } + + /** + * @return array + */ + public function getInterval() + { + return $this->interval; + } + + /** + * @param array $interval + * @return void + */ + public function setInterval($interval) + { + $this->interval = $interval; + } + + /** + * @return mixed + */ + public function getRangeCalculationValue() + { + return $this->scopeConfig->getValue( + self::XML_PATH_RANGE_CALCULATION, + ScopeInterface::SCOPE_STORE + ); + } + + /** + * @return mixed + */ + public function getRangeStepValue() + { + return $this->scopeConfig->getValue( + self::XML_PATH_RANGE_STEP, + ScopeInterface::SCOPE_STORE + ); + } + + /** + * @return mixed + */ + public function getOnePriceIntervalValue() + { + return $this->scopeConfig->getValue( + self::XML_PATH_ONE_PRICE_INTERVAL, + ScopeInterface::SCOPE_STORE + ); + } + + /** + * Get interval division limit + * + * @return int + */ + public function getIntervalDivisionLimitValue() + { + return $this->scopeConfig->getValue( + self::XML_PATH_INTERVAL_DIVISION_LIMIT, + ScopeInterface::SCOPE_STORE + ); + } + + /** + * Get maximum number of intervals + * + * @return mixed + */ + public function getRangeMaxIntervalsValue() + { + return $this->scopeConfig->getValue( + self::XML_PATH_RANGE_MAX_INTERVALS, + ScopeInterface::SCOPE_STORE + ); + } + + /** + * @return Layer + */ + public function getLayer() + { + return $this->layer; + } + + /** + * Get price range for building filter steps + * + * @return int + */ + public function getPriceRange() + { + $range = $this->priceRange; + if (!$range) { + $currentCategory = $this->coreRegistry->registry('current_category_filter'); + if ($currentCategory) { + $range = $currentCategory->getFilterPriceRange(); + } else { + $range = $this->getLayer() + ->getCurrentCategory() + ->getFilterPriceRange(); + } + + if (!$range) { + $maxPrice = $this->getMaxPrice(); + $calculation = $this->getRangeCalculationValue(); + if ($calculation == self::RANGE_CALCULATION_AUTO) { + $index = 1; + do { + $range = pow(10, strlen(floor($maxPrice)) - $index); + $items = $this->getRangeItemCounts($range); + $index++; + } while ($range > self::MIN_RANGE_POWER && count($items) < 2); + } else { + $range = (double)$this->getRangeStepValue(); + } + } + + $this->priceRange = $range; + } + + return $range; + } + + /** + * Get information about products count in range + * + * @param int $range + * @return int + */ + public function getRangeItemCounts($range) + { + $items = array_key_exists($range, $this->rangeItemCounts) ? $this->rangeItemCounts[$range] : null; + if (is_null($items)) { + $items = $this->resource->getCount($range); + // checking max number of intervals + $i = 0; + $lastIndex = null; + $maxIntervalsNumber = $this->getRangeMaxIntervalsValue(); + $calculation = $this->getRangeCalculationValue(); + foreach ($items as $k => $v) { + ++$i; + if ($calculation == self::RANGE_CALCULATION_MANUAL && $i > 1 && $i > $maxIntervalsNumber) { + $items[$lastIndex] += $v; + unset($items[$k]); + } else { + $lastIndex = $k; + } + } + $this->rangeItemCounts[$range] = $items; + } + + return $items; + } + + /** + * Get maximum price from layer products set + * + * @return float + */ + public function getMaxPrice() + { + $maxPrice = $this->maxPrice; + if (is_null($maxPrice)) { + $maxPrice = $this->getLayer() + ->getProductCollection() + ->getMaxPrice(); + $maxPrice = floor($maxPrice); + $this->maxPrice = $maxPrice; + } + + return $maxPrice; + } + + /** + * @param string $filterParams + * @return array + */ + public function getPriorFilters($filterParams) + { + $priorFilters = []; + for ($i = 1; $i < count($filterParams); ++$i) { + $priorFilter = $this->validateFilter($filterParams[$i]); + if ($priorFilter) { + $priorFilters[] = $priorFilter; + } else { + //not valid data + $priorFilters = []; + break; + } + } + + return $priorFilters; + } + + /** + * Validate and parse filter request param + * + * @param string $filter + * @return array|bool + */ + public function validateFilter($filter) + { + $filter = explode('-', $filter); + if (count($filter) != 2) { + return false; + } + foreach ($filter as $v) { + if ($v !== '' && $v !== '0' && (double)$v <= 0 || is_infinite((double)$v)) { + return false; + } + } + + return $filter; + } + + /** + * Get filter value for reset current filter state + * + * @return null|string + */ + public function getResetValue() + { + $priorIntervals = $this->getPriorIntervals(); + $value = []; + if ($priorIntervals) { + foreach ($priorIntervals as $priorInterval) { + $value[] = implode('-', $priorInterval); + } + + return implode(',', $value); + } + + return null; + } + + /** + * @return array + */ + public function getPriorIntervals() + { + return $this->priorIntervals; + } + + /** + * @param array $priorInterval + * @return void + */ + public function setPriorIntervals($priorInterval) + { + $this->priorIntervals = $priorInterval; + } + + /** + * @return \Magento\Catalog\Model\Resource\Layer\Filter\Price + */ + public function getResource() + { + return $this->resource; + } + + /** + * @return string + */ + public function getAdditionalRequestData() + { + $result = ''; + $appliedInterval = $this->getInterval(); + if ($appliedInterval) { + $result = ',' . $appliedInterval[0] . '-' . $appliedInterval[1]; + $priorIntervals = $this->getResetValue(); + if ($priorIntervals) { + $result .= ',' . $priorIntervals; + } + } + + return $result; + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Decimal.php b/app/code/Magento/Catalog/Model/Layer/Filter/Decimal.php index 9e2bc26c6c05f..ddc08611a2b37 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Decimal.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Decimal.php @@ -22,7 +22,6 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ - /** * Catalog Layer Decimal Attribute Filter Model * @@ -32,7 +31,6 @@ class Decimal extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter { - const MIN_RANGE_POWER = 10; /** * Resource instance @@ -46,10 +44,16 @@ class Decimal extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ protected $priceCurrency; + /** + * @var DataProvider\Decimal + */ + private $dataProvider; + /** * @param ItemFactory $filterItemFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer + * @param \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder * @param \Magento\Catalog\Model\Resource\Layer\Filter\DecimalFactory $filterDecimalFactory * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency * @param array $data @@ -58,33 +62,24 @@ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, - \Magento\Catalog\Model\Resource\Layer\Filter\DecimalFactory $filterDecimalFactory, + \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, + \Magento\Catalog\Model\Layer\Filter\DataProvider\DecimalFactory $dataProviderFactory, array $data = array() ) { - $this->_resource = $filterDecimalFactory->create(); $this->_requestVar = 'decimal'; $this->priceCurrency = $priceCurrency; - parent::__construct($filterItemFactory, $storeManager, $layer, $data); - } - - /** - * Retrieve resource instance - * - * @return \Magento\Catalog\Model\Resource\Layer\Filter\Decimal - */ - protected function _getResource() - { - return $this->_resource; + parent::__construct($filterItemFactory, $storeManager, $layer, $itemDataBuilder, $data); + $this->dataProvider = $dataProviderFactory->create(['layer' => $this->getLayer()]); } /** * Apply decimal range filter to product collection * - * @param \Zend_Controller_Request_Abstract $request + * @param \Magento\Framework\App\RequestInterface $request * @return $this */ - public function apply(\Zend_Controller_Request_Abstract $request) + public function apply(\Magento\Framework\App\RequestInterface $request) { parent::apply($request); @@ -103,30 +98,19 @@ public function apply(\Zend_Controller_Request_Abstract $request) list($index, $range) = $filter; if ((int)$index && (int)$range) { - $this->setRange((int)$range); + $this->dataProvider->setRange((int)$range); - $this->_getResource()->applyFilterToCollection($this, $range, $index); + $this->dataProvider->getResource()->applyFilterToCollection($this, $range, $index); $this->getLayer()->getState()->addFilter( $this->_createItem($this->_renderItemLabel($range, $index), $filter) ); - $this->_items = array(); + $this->_items = []; } return $this; } - /** - * Retrieve price aggreagation data cache key - * - * @return string - */ - protected function _getCacheKey() - { - $key = $this->getLayer()->getStateKey() . '_ATTR_' . $this->getAttributeModel()->getAttributeCode(); - return $key; - } - /** * Prepare text of item label * @@ -141,77 +125,6 @@ protected function _renderItemLabel($range, $value) return __('%1 - %2', $from, $to); } - /** - * Retrieve maximum value from layer products set - * - * @return float - */ - public function getMaxValue() - { - $max = $this->getData('max_value'); - if (is_null($max)) { - list($min, $max) = $this->_getResource()->getMinMax($this); - $this->setData('max_value', $max); - $this->setData('min_value', $min); - } - return $max; - } - - /** - * Retrieve minimal value from layer products set - * - * @return float - */ - public function getMinValue() - { - $min = $this->getData('min_value'); - if (is_null($min)) { - list($min, $max) = $this->_getResource()->getMinMax($this); - $this->setData('max_value', $max); - $this->setData('min_value', $min); - } - return $min; - } - - /** - * Retrieve range for building filter steps - * - * @return int - */ - public function getRange() - { - $range = $this->getData('range'); - if (!$range) { - $maxValue = $this->getMaxValue(); - $index = 1; - do { - $range = pow(10, strlen(floor($maxValue)) - $index); - $items = $this->getRangeItemCounts($range); - $index++; - } while ($range > self::MIN_RANGE_POWER && count($items) < 2); - $this->setData('range', $range); - } - - return $range; - } - - /** - * Retrieve information about products count in range - * - * @param int $range - * @return int - */ - public function getRangeItemCounts($range) - { - $rangeKey = 'range_item_counts_' . $range; - $items = $this->getData($rangeKey); - if (is_null($items)) { - $items = $this->_getResource()->getCount($this, $range); - $this->setData($rangeKey, $items); - } - return $items; - } - /** * Retrieve data for build decimal filter items * @@ -219,18 +132,17 @@ public function getRangeItemCounts($range) */ protected function _getItemsData() { - $data = array(); - $range = $this->getRange(); - $dbRanges = $this->getRangeItemCounts($range); + $range = $this->dataProvider->getRange($this); + $dbRanges = $this->dataProvider->getRangeItemCounts($range, $this); foreach ($dbRanges as $index => $count) { - $data[] = array( - 'label' => $this->_renderItemLabel($range, $index), - 'value' => $index . ',' . $range, - 'count' => $count + $this->itemDataBuilder->addItemData( + $this->_renderItemLabel($range, $index), + $index . ',' . $range, + $count ); } - return $data; + return $this->itemDataBuilder->build(); } } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmFactory.php b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmFactory.php new file mode 100644 index 0000000000000..7fa24605bc649 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmFactory.php @@ -0,0 +1,99 @@ +objectManager = $objectManager; + $this->scopeConfig = $scopeConfig; + $this->algorithms = $algorithms; + } + + /** + * Create algorithm + * + * @param array $data + * @return AlgorithmInterface + * @throws Exception + */ + public function create(array $data = []) + { + $calculationType = $this->scopeConfig->getValue(self::XML_PATH_RANGE_CALCULATION, ScopeInterface::SCOPE_STORE); + + if (!isset($this->algorithms[$calculationType])) { + throw new Exception($calculationType . ' was not found in algorithms'); + } + + $className = $this->algorithms[$calculationType]; + $model = $this->objectManager->create($className, $data); + + if (!$model instanceof AlgorithmInterface) { + throw new Exception( + $className . ' doesn\'t extends \Magento\Catalog\Model\Layer\Filter\Dynamic\AlgorithmInterface' + ); + } + + return $model; + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmInterface.php b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmInterface.php new file mode 100644 index 0000000000000..bdd84ec247177 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/AlgorithmInterface.php @@ -0,0 +1,34 @@ +algorithm = $algorithm; + $this->layer = $layerResolver->get(); + $this->scopeConfig = $scopeConfig; + $this->render = $render; + $this->coreRegistry = $coreRegistry; + $this->range = $range; + $this->resource = $resource; + } + + /** + * {@inheritdoc} + */ + public function getItemsData(array $intervals = [], $additionalRequestData = '') + { + $data = []; + if (empty($intervals)) { + $range = $this->range->getPriceRange(); + if (!$range) { + $range = $this->getRange(); + $dbRanges = $this->resource->getCount($range); + $data = $this->render->renderRangeData($range, $dbRanges); + } + } + + return $data; + } + + /** + * @return number + */ + private function getRange() + { + $maxPrice = $this->getMaxPriceInt(); + $index = 1; + do { + $range = pow(10, strlen(floor($maxPrice)) - $index); + $items = $this->resource->getCount($range); + $index++; + } while ($range > self::MIN_RANGE_POWER && count($items) < 2); + + return $range; + } + + /** + * Get maximum price from layer products set + * + * @return float + */ + public function getMaxPriceInt() + { + $maxPrice = $this->layer->getProductCollection() + ->getMaxPrice(); + $maxPrice = floor($maxPrice); + + return $maxPrice; + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Improved.php b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Improved.php new file mode 100644 index 0000000000000..a81845a4045ef --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Improved.php @@ -0,0 +1,128 @@ +algorithm = $algorithm; + $this->layer = $layerResolver->get(); + $this->scopeConfig = $scopeConfig; + $this->render = $render; + $this->intervalFactory = $intervalFactory; + } + + /** + * {@inheritdoc} + */ + public function getItemsData(array $intervals = [], $additionalRequestData = '') + { + $collection = $this->layer->getProductCollection(); + $appliedInterval = $intervals; + if ($appliedInterval && $collection->getPricesCount() <= $this->getIntervalDivisionLimit()) { + return array(); + } + $this->algorithm->setStatistics( + $collection->getMinPrice(), + $collection->getMaxPrice(), + $collection->getPriceStandardDeviation(), + $collection->getPricesCount() + ); + + if ($appliedInterval) { + if ($appliedInterval[0] == $appliedInterval[1] || $appliedInterval[1] === '0') { + return array(); + } + $this->algorithm->setLimits($appliedInterval[0], $appliedInterval[1]); + } + $interval = $this->intervalFactory->create(); + $items = array(); + foreach ($this->algorithm->calculateSeparators($interval) as $separator) { + $items[] = array( + 'label' => $this->render->renderRangeLabel($separator['from'], $separator['to']), + 'value' => ($separator['from'] == 0 ? '' + : $separator['from']) . '-' . $separator['to'] . $additionalRequestData, + 'count' => $separator['count'] + ); + } + + return $items; + } + + /** + * Get interval division limit + * + * @return int + */ + private function getIntervalDivisionLimit() + { + return (int)$this->scopeConfig->getValue(self::XML_PATH_INTERVAL_DIVISION_LIMIT, ScopeInterface::SCOPE_STORE); + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Manual.php b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Manual.php new file mode 100644 index 0000000000000..cf7d195bc695a --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Dynamic/Manual.php @@ -0,0 +1,120 @@ +algorithm = $algorithm; + $this->layer = $layerResolver->get(); + $this->scopeConfig = $scopeConfig; + $this->render = $render; + $this->coreRegistry = $coreRegistry; + $this->range = $range; + $this->resource = $resource; + } + + /** + * @param int[] $intervals + * @param string $additionalRequestData + * @return array + */ + public function getItemsData(array $intervals = [], $additionalRequestData = '') + { + $data = []; + if (empty($intervals)) { + $range = $this->range->getPriceRange(); + if (!$range) { + $range = $this->range->getConfigRangeStep(); + $dbRanges = $this->resource->getCount($range); + $dbRanges = $this->processRange($dbRanges); + $data = $this->render->renderRangeData($range, $dbRanges); + } + } + + return $data; + } + + /** + * @param array $items + * @return array + */ + private function processRange($items) + { + $i = 0; + $lastIndex = null; + $maxIntervalsNumber = $this->getMaxIntervalsNumber(); + foreach ($items as $k => $v) { + ++$i; + if ($i > 1 && $i > $maxIntervalsNumber) { + $items[$lastIndex] += $v; + unset($items[$k]); + } else { + $lastIndex = $k; + } + } + return $items; + } + + /** + * Get maximum number of intervals + * + * @return int + */ + public function getMaxIntervalsNumber() + { + return (int)$this->scopeConfig->getValue( + self::XML_PATH_RANGE_MAX_INTERVALS, + ScopeInterface::SCOPE_STORE + ); + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/FilterInterface.php b/app/code/Magento/Catalog/Model/Layer/Filter/FilterInterface.php new file mode 100644 index 0000000000000..d1308b8b0ed5d --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/FilterInterface.php @@ -0,0 +1,157 @@ + array( + * 'label' => $label, + * 'value' => $value, + * 'count' => $count + * ) + * ) + * + * @return array + */ + protected $_itemsData = []; + + /** + * Add Item Data + * + * @param string $label + * @param string $label + * @param int $count + * @return void + */ + public function addItemData($label, $value, $count) + { + $this->_itemsData[] = array( + 'label' => $label, + 'value' => $value, + 'count' => $count + ); + } + + /** + * Get Items Data + * + * @return array + */ + public function build() + { + $result = $this->_itemsData; + $this->_itemsData = []; + return $result; + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php index 9fd739a5bb475..a4222ebddec5b 100644 --- a/app/code/Magento/Catalog/Model/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Price.php @@ -30,34 +30,6 @@ */ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter { - /** - * XML configuration paths for Price Layered Navigation - */ - const XML_PATH_RANGE_CALCULATION = 'catalog/layered_navigation/price_range_calculation'; - - const XML_PATH_RANGE_STEP = 'catalog/layered_navigation/price_range_step'; - - const XML_PATH_RANGE_MAX_INTERVALS = 'catalog/layered_navigation/price_range_max_intervals'; - - const XML_PATH_ONE_PRICE_INTERVAL = 'catalog/layered_navigation/one_price_interval'; - - const XML_PATH_INTERVAL_DIVISION_LIMIT = 'catalog/layered_navigation/interval_division_limit'; - - /** - * Price layered navigation modes: Automatic (equalize price ranges), Automatic (equalize product counts), Manual - */ - const RANGE_CALCULATION_AUTO = 'auto'; - - // equalize price ranges - const RANGE_CALCULATION_IMPROVED = 'improved'; - - // equalize product counts - const RANGE_CALCULATION_MANUAL = 'manual'; - - /** - * Minimal size of the range - */ - const MIN_RANGE_POWER = 10; /** * Resource instance @@ -97,309 +69,57 @@ class Price extends \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ protected $priceCurrency; + /** + * @var Dynamic\AlgorithmFactory + */ + private $algorithmFactory; + + /** @var DataProvider\Price */ + private $dataProvider; + /** * @param ItemFactory $filterItemFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Layer $layer + * @param \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder * @param \Magento\Catalog\Model\Resource\Layer\Filter\Price $resource * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Framework\Search\Dynamic\Algorithm $priceAlgorithm - * @param \Magento\Framework\Registry $coreRegistry - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency + * @param Dynamic\AlgorithmFactory $algorithmFactory + * @param DataProvider\PriceFactory $dataProviderFactory * @param array $data */ public function __construct( \Magento\Catalog\Model\Layer\Filter\ItemFactory $filterItemFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Layer $layer, + \Magento\Catalog\Model\Layer\Filter\Item\DataBuilder $itemDataBuilder, \Magento\Catalog\Model\Resource\Layer\Filter\Price $resource, \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Search\Dynamic\Algorithm $priceAlgorithm, - \Magento\Framework\Registry $coreRegistry, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, - array $data = array() + \Magento\Catalog\Model\Layer\Filter\Dynamic\AlgorithmFactory $algorithmFactory, + \Magento\Catalog\Model\Layer\Filter\DataProvider\PriceFactory $dataProviderFactory, + array $data = [] ) { $this->priceCurrency = $priceCurrency; $this->_resource = $resource; $this->_customerSession = $customerSession; $this->_priceAlgorithm = $priceAlgorithm; - $this->_coreRegistry = $coreRegistry; - $this->_scopeConfig = $scopeConfig; - parent::__construct($filterItemFactory, $storeManager, $layer, $data); + parent::__construct($filterItemFactory, $storeManager, $layer, $itemDataBuilder, $data); $this->_requestVar = 'price'; - } - - /** - * Retrieve resource instance - * - * @return \Magento\Catalog\Model\Resource\Layer\Filter\Price - */ - protected function _getResource() - { - return $this->_resource; - } - - /** - * Get price range for building filter steps - * - * @return int - */ - public function getPriceRange() - { - $range = $this->getData('price_range'); - if (!$range) { - $currentCategory = $this->_coreRegistry->registry('current_category_filter'); - if ($currentCategory) { - $range = $currentCategory->getFilterPriceRange(); - } else { - $range = $this->getLayer()->getCurrentCategory()->getFilterPriceRange(); - } - - $maxPrice = $this->getMaxPriceInt(); - if (!$range) { - $calculation = $this->_scopeConfig->getValue( - self::XML_PATH_RANGE_CALCULATION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); - if ($calculation == self::RANGE_CALCULATION_AUTO) { - $index = 1; - do { - $range = pow(10, strlen(floor($maxPrice)) - $index); - $items = $this->getRangeItemCounts($range); - $index++; - } while ($range > self::MIN_RANGE_POWER && count($items) < 2); - } else { - $range = (double)$this->_scopeConfig->getValue( - self::XML_PATH_RANGE_STEP, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); - } - } - - $this->setData('price_range', $range); - } - - return $range; - } - - /** - * Get maximum price from layer products set - * - * @return float - */ - public function getMaxPriceInt() - { - $maxPrice = $this->getData('max_price_int'); - if (is_null($maxPrice)) { - $maxPrice = $this->getLayer()->getProductCollection()->getMaxPrice(); - $maxPrice = floor($maxPrice); - $this->setData('max_price_int', $maxPrice); - } - - return $maxPrice; - } - - /** - * Get information about products count in range - * - * @param int $range - * @return int - */ - public function getRangeItemCounts($range) - { - $rangeKey = 'range_item_counts_' . $range; - $items = $this->getData($rangeKey); - if (is_null($items)) { - $items = $this->_getResource()->getCount($range); - // checking max number of intervals - $i = 0; - $lastIndex = null; - $maxIntervalsNumber = $this->getMaxIntervalsNumber(); - $calculation = $this->_scopeConfig->getValue( - self::XML_PATH_RANGE_CALCULATION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); - foreach ($items as $k => $v) { - ++$i; - if ($calculation == self::RANGE_CALCULATION_MANUAL && $i > 1 && $i > $maxIntervalsNumber) { - $items[$lastIndex] += $v; - unset($items[$k]); - } else { - $lastIndex = $k; - } - } - $this->setData($rangeKey, $items); - } - - return $items; - } - - /** - * Prepare text of range label - * - * @param float|string $fromPrice - * @param float|string $toPrice - * @return string - */ - protected function _renderRangeLabel($fromPrice, $toPrice) - { - $formattedFromPrice = $this->priceCurrency->format($fromPrice); - if ($toPrice === '') { - return __('%1 and above', $formattedFromPrice); - } elseif ($fromPrice == $toPrice && $this->_scopeConfig->getValue( - self::XML_PATH_ONE_PRICE_INTERVAL, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) - ) { - return $formattedFromPrice; - } else { - if ($fromPrice != $toPrice) { - $toPrice -= .01; - } - return __('%1 - %2', $formattedFromPrice, $this->priceCurrency->format($toPrice)); - } - } - - /** - * Get additional request param data - * - * @return string - */ - protected function _getAdditionalRequestData() - { - $result = ''; - $appliedInterval = $this->getInterval(); - if ($appliedInterval) { - $result = ',' . $appliedInterval[0] . '-' . $appliedInterval[1]; - $priorIntervals = $this->getResetValue(); - if ($priorIntervals) { - $result .= ',' . $priorIntervals; - } - } - - return $result; - } - - /** - * Get data generated by algorithm for build price filter items - * - * @return array - */ - protected function _getCalculatedItemsData() - { - $collection = $this->getLayer()->getProductCollection(); - $appliedInterval = $this->getInterval(); - if ($appliedInterval && $collection->getPricesCount() <= $this->getIntervalDivisionLimit()) { - return array(); - } - $this->_priceAlgorithm->setStatistics( - $collection->getMinPrice(), - $collection->getMaxPrice(), - $collection->getPriceStandardDeviation(), - $collection->getPricesCount() - ); - - if ($appliedInterval) { - if ($appliedInterval[0] == $appliedInterval[1] || $appliedInterval[1] === '0') { - return array(); - } - $this->_priceAlgorithm->setLimits($appliedInterval[0], $appliedInterval[1]); - } - - $items = array(); - foreach ($this->_priceAlgorithm->calculateSeparators() as $separator) { - $items[] = array( - 'label' => $this->_renderRangeLabel($separator['from'], $separator['to']), - 'value' => ($separator['from'] == - 0 ? '' : $separator['from']) . '-' . $separator['to'] . $this->_getAdditionalRequestData(), - 'count' => $separator['count'] - ); - } - - return $items; - } - - /** - * Get data for build price filter items - * - * @return array - */ - protected function _getItemsData() - { - if ($this->_scopeConfig->getValue( - self::XML_PATH_RANGE_CALCULATION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) == self::RANGE_CALCULATION_IMPROVED - ) { - return $this->_getCalculatedItemsData(); - } elseif ($this->getInterval()) { - return array(); - } - - $range = $this->getPriceRange(); - $dbRanges = $this->getRangeItemCounts($range); - $data = array(); - - if (!empty($dbRanges)) { - $lastIndex = array_keys($dbRanges); - $lastIndex = $lastIndex[count($lastIndex) - 1]; - - foreach ($dbRanges as $index => $count) { - $fromPrice = $index == 1 ? '' : ($index - 1) * $range; - $toPrice = $index == $lastIndex ? '' : $index * $range; - - $data[] = array( - 'label' => $this->_renderRangeLabel($fromPrice, $toPrice), - 'value' => $fromPrice . '-' . $toPrice, - 'count' => $count - ); - } - } - - return $data; - } - - /** - * Apply price range filter to collection - * - * @return $this - */ - protected function _applyPriceRange() - { - $this->_getResource()->applyPriceRange($this); - return $this; - } - - /** - * Validate and parse filter request param - * - * @param string $filter - * @return array|bool - */ - protected function _validateFilter($filter) - { - $filter = explode('-', $filter); - if (count($filter) != 2) { - return false; - } - foreach ($filter as $v) { - if ($v !== '' && $v !== '0' && (double)$v <= 0 || is_infinite((double)$v)) { - return false; - } - } - - return $filter; + $this->algorithmFactory = $algorithmFactory; + $this->dataProvider = $dataProviderFactory->create(['layer' => $this->getLayer()]); } /** * Apply price range filter * - * @param \Zend_Controller_Request_Abstract $request + * @param \Magento\Framework\App\RequestInterface $request * @return $this */ - public function apply(\Zend_Controller_Request_Abstract $request) + public function apply(\Magento\Framework\App\RequestInterface $request) { /** * Filter must be string: $fromPrice-$toPrice @@ -411,34 +131,26 @@ public function apply(\Zend_Controller_Request_Abstract $request) //validate filter $filterParams = explode(',', $filter); - $filter = $this->_validateFilter($filterParams[0]); + $filter = $this->dataProvider->validateFilter($filterParams[0]); if (!$filter) { return $this; } list($from, $to) = $filter; - $this->setInterval(array($from, $to)); - - $priorFilters = array(); - for ($i = 1; $i < count($filterParams); ++$i) { - $priorFilter = $this->_validateFilter($filterParams[$i]); - if ($priorFilter) { - $priorFilters[] = $priorFilter; - } else { - //not valid data - $priorFilters = array(); - break; - } - } + $this->dataProvider->setInterval([$from, $to]); + + $priorFilters = $this->dataProvider->getPriorFilters($filterParams); if ($priorFilters) { - $this->setPriorIntervals($priorFilters); + $this->dataProvider->setPriorIntervals($priorFilters); } $this->_applyPriceRange(); - $this->getLayer()->getState()->addFilter( - $this->_createItem($this->_renderRangeLabel(empty($from) ? 0 : $from, $to), $filter) - ); + $this->getLayer() + ->getState() + ->addFilter( + $this->_createItem($this->_renderRangeLabel(empty($from) ? 0 : $from, $to), $filter) + ); return $this; } @@ -454,6 +166,7 @@ public function getCustomerGroupId() if (is_null($customerGroupId)) { $customerGroupId = $this->_customerSession->getCustomerGroupId(); } + return $customerGroupId; } @@ -477,11 +190,13 @@ public function getCurrencyRate() { $rate = $this->_getData('currency_rate'); if (is_null($rate)) { - $rate = $this->_storeManager->getStore($this->getStoreId())->getCurrentCurrencyRate(); + $rate = $this->_storeManager->getStore($this->getStoreId()) + ->getCurrentCurrencyRate(); } if (!$rate) { $rate = 1; } + return $rate; } @@ -497,64 +212,95 @@ public function setCurrencyRate($rate) } /** - * Get maximum number of intervals + * Get filter value for reset current filter state * - * @return int + * @return null|string */ - public function getMaxIntervalsNumber() + public function getResetValue() { - return (int)$this->_scopeConfig->getValue( - self::XML_PATH_RANGE_MAX_INTERVALS, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + return $this->dataProvider->getResetValue(); } /** - * Get interval division limit + * Get 'clear price' link text * - * @return int + * @return false|string */ - public function getIntervalDivisionLimit() + public function getClearLinkText() { - return (int)$this->_scopeConfig->getValue( - self::XML_PATH_INTERVAL_DIVISION_LIMIT, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ); + if ($this->dataProvider->getPriorIntervals() + ) { + return __('Clear Price'); + } + + return parent::getClearLinkText(); } /** - * Get filter value for reset current filter state + * Prepare text of range label * - * @return null|string + * @param float|string $fromPrice + * @param float|string $toPrice + * @return string */ - public function getResetValue() + protected function _renderRangeLabel($fromPrice, $toPrice) { - $priorIntervals = $this->getPriorIntervals(); - $value = array(); - if ($priorIntervals) { - foreach ($priorIntervals as $priorInterval) { - $value[] = implode('-', $priorInterval); + $formattedFromPrice = $this->priceCurrency->format($fromPrice); + if ($toPrice === '') { + return __('%1 and above', $formattedFromPrice); + } elseif ($fromPrice == $toPrice && $this->dataProvider->getOnePriceIntervalValue() + ) { + return $formattedFromPrice; + } else { + if ($fromPrice != $toPrice) { + $toPrice -= .01; } - return implode(',', $value); + + return __('%1 - %2', $formattedFromPrice, $this->priceCurrency->format($toPrice)); } - return parent::getResetValue(); } /** - * Get 'clear price' link text + * Get additional request param data * - * @return false|string + * @return string */ - public function getClearLinkText() + protected function _getAdditionalRequestData() { - if ($this->_scopeConfig->getValue( - self::XML_PATH_RANGE_CALCULATION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) == self::RANGE_CALCULATION_IMPROVED && $this->getPriorIntervals() - ) { - return __('Clear Price'); + $result = ''; + $appliedInterval = $this->dataProvider->getInterval(); + if ($appliedInterval) { + $result = ',' . $appliedInterval[0] . '-' . $appliedInterval[1]; + $priorIntervals = $this->getResetValue(); + if ($priorIntervals) { + $result .= ',' . $priorIntervals; + } } - return parent::getClearLinkText(); + return $result; + } + + /** + * Get data for build price filter items + * @return array + * @throws \Magento\Framework\Model\Exception + */ + protected function _getItemsData() + { + $algorithm = $this->algorithmFactory->create(); + + return $algorithm->getItemsData((array)$this->dataProvider->getInterval(), $this->dataProvider->getAdditionalRequestData()); + } + + /** + * Apply price range filter to collection + * + * @return $this + */ + protected function _applyPriceRange() + { + $this->dataProvider->getResource()->applyPriceRange($this, $this->dataProvider->getInterval()); + + return $this; } } diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Price/Range.php b/app/code/Magento/Catalog/Model/Layer/Filter/Price/Range.php new file mode 100644 index 0000000000000..088fb2399d448 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Price/Range.php @@ -0,0 +1,80 @@ +registry = $registry; + $this->scopeConfig = $scopeConfig; + $this->layer = $layerResolver->get(); + } + + /** + * @return array + */ + public function getPriceRange() + { + $currentCategory = $this->registry->registry('current_category_filter') ?: $this->layer->getCurrentCategory(); + + return $currentCategory->getFilterPriceRange(); + } + + /** + * @return float + */ + public function getConfigRangeStep() + { + return (double)$this->scopeConfig->getValue(self::XML_PATH_RANGE_STEP, ScopeInterface::SCOPE_STORE); + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Filter/Price/Render.php b/app/code/Magento/Catalog/Model/Layer/Filter/Price/Render.php new file mode 100644 index 0000000000000..d39f38b13d168 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Filter/Price/Render.php @@ -0,0 +1,116 @@ +priceCurrency = $priceCurrency; + $this->scopeConfig = $scopeConfig; + $this->itemDataBuilder = $itemDataBuilder; + } + + /** + * Prepare text of range label + * + * @param float|string $fromPrice + * @param float|string $toPrice + * @return string + */ + public function renderRangeLabel($fromPrice, $toPrice) + { + $formattedFromPrice = $this->priceCurrency->format($fromPrice); + $priceInterval = $this->scopeConfig->getValue( + self::XML_PATH_ONE_PRICE_INTERVAL, + ScopeInterface::SCOPE_STORE + ); + if ($toPrice === '') { + return __('%1 and above', $formattedFromPrice); + } elseif ($fromPrice == $toPrice && $priceInterval) { + return $formattedFromPrice; + } else { + if ($fromPrice != $toPrice) { + $toPrice -= .01; + } + + return __('%1 - %2', $formattedFromPrice, $this->priceCurrency->format($toPrice)); + } + } + + /** + * @param int $range + * @param int[] $dbRanges + * @return array + */ + public function renderRangeData($range, $dbRanges) + { + if (empty($dbRanges)) { + return []; + } + $lastIndex = array_keys($dbRanges); + $lastIndex = $lastIndex[count($lastIndex) - 1]; + + foreach ($dbRanges as $index => $count) { + $fromPrice = $index == 1 ? '' : ($index - 1) * $range; + $toPrice = $index == $lastIndex ? '' : $index * $range; + $this->itemDataBuilder->addItemData( + $this->renderRangeLabel($fromPrice, $toPrice), + $fromPrice . '-' . $toPrice, + $count + ); + } + return $this->itemDataBuilder->build(); + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/FilterList.php b/app/code/Magento/Catalog/Model/Layer/FilterList.php index 705168e9418da..17f2ab1c53590 100644 --- a/app/code/Magento/Catalog/Model/Layer/FilterList.php +++ b/app/code/Magento/Catalog/Model/Layer/FilterList.php @@ -89,8 +89,8 @@ public function getFilters(\Magento\Catalog\Model\Layer $layer) $this->filters = array( $this->objectManager->create($this->filterTypes[self::CATEGORY_FILTER], array('layer' => $layer)), ); - foreach ($this->filterableAttributes->getList() as $attibute) { - $this->filters[] = $this->createAttributeFilter($attibute, $layer); + foreach ($this->filterableAttributes->getList() as $attribute) { + $this->filters[] = $this->createAttributeFilter($attribute, $layer); } } return $this->filters; @@ -101,12 +101,29 @@ public function getFilters(\Magento\Catalog\Model\Layer $layer) * * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute * @param \Magento\Catalog\Model\Layer $layer - * @return mixed + * @return \Magento\Catalog\Model\Layer\Filter\AbstractFilter */ protected function createAttributeFilter( \Magento\Catalog\Model\Resource\Eav\Attribute $attribute, \Magento\Catalog\Model\Layer $layer ) { + $filterClassName = $this->getAttributeFilterClass($attribute); + + $filter = $this->objectManager->create( + $filterClassName, + array('data' => array('attribute_model' => $attribute), 'layer' => $layer) + ); + return $filter; + } + + /** + * Get Attribute Filter Class Name + * + * @param \Magento\Catalog\Model\Resource\Eav\Attribute $attribute + * @return string + */ + protected function getAttributeFilterClass(\Magento\Catalog\Model\Resource\Eav\Attribute $attribute) + { $filterClassName = $this->filterTypes[self::ATTRIBUTE_FILTER]; if ($attribute->getAttributeCode() == 'price') { @@ -115,10 +132,6 @@ protected function createAttributeFilter( $filterClassName = $this->filterTypes[self::DECIMAL_FILTER]; } - $filter = $this->objectManager->create( - $filterClassName, - array('data' => array('attribute_model' => $attribute), 'layer' => $layer) - ); - return $filter; + return $filterClassName; } } diff --git a/app/code/Magento/Catalog/Model/Layer/Resolver.php b/app/code/Magento/Catalog/Model/Layer/Resolver.php new file mode 100644 index 0000000000000..d5625106a3f59 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Layer/Resolver.php @@ -0,0 +1,92 @@ +objectManager = $objectManager; + $this->layersPool = $layersPool; + } + + /** + * Create Catalog Layer by specified type + * + * @param string $layerType + * @return void + */ + public function create($layerType) + { + if (isset($this->layer)) { + throw new \RuntimeException('Catalog Layer has been already created'); + } + if (!isset($this->layersPool[$layerType])) { + throw new \InvalidArgumentException($layerType . ' does not belong to any registered layer'); + } + $this->layer = $this->objectManager->create($this->layersPool[$layerType]); + } + + /** + * Get current Catalog Layer + * + * @return \Magento\Catalog\Model\Layer + */ + public function get() + { + if (!isset($this->layer)) { + $this->layer = $this->objectManager->create($this->layersPool[self::CATALOG_LAYER_CATEGORY]); + } + return $this->layer; + } +} diff --git a/app/code/Magento/Catalog/Model/Layer/Search.php b/app/code/Magento/Catalog/Model/Layer/Search.php index a5d8f3a1e07c8..7956accc655d0 100644 --- a/app/code/Magento/Catalog/Model/Layer/Search.php +++ b/app/code/Magento/Catalog/Model/Layer/Search.php @@ -28,11 +28,12 @@ use Magento\Catalog\Model\Layer; use Magento\Catalog\Model\Resource; use Magento\Framework\Object; +use Magento\Catalog\Model\Layer\ContextInterface; class Search extends \Magento\Catalog\Model\Layer { /** - * @param Search\Context $context + * @param ContextInterface $context * @param StateFactory $layerStateFactory * @param CategoryFactory $categoryFactory * @param Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory @@ -42,7 +43,7 @@ class Search extends \Magento\Catalog\Model\Layer * @param array $data */ public function __construct( - Search\Context $context, + ContextInterface $context, StateFactory $layerStateFactory, CategoryFactory $categoryFactory, Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, diff --git a/app/code/Magento/Catalog/Model/Layer/Search/Context.php b/app/code/Magento/Catalog/Model/Layer/Search/Context.php deleted file mode 100644 index c75345d496a9b..0000000000000 --- a/app/code/Magento/Catalog/Model/Layer/Search/Context.php +++ /dev/null @@ -1,45 +0,0 @@ -getIsFilterableInSearch(); } diff --git a/app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php b/app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php index df8d2dd170901..db0cae20c7af7 100644 --- a/app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php +++ b/app/code/Magento/Catalog/Model/Layer/Search/FilterableAttributeList.php @@ -30,14 +30,14 @@ class FilterableAttributeList extends \Magento\Catalog\Model\Layer\Category\Filt /** * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory * @param \Magento\Framework\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\Layer\Search $layer + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver */ public function __construct( \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $collectionFactory, \Magento\Framework\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Layer\Search $layer + \Magento\Catalog\Model\Layer\Resolver $layerResolver ) { - parent::__construct($collectionFactory, $storeManager, $layer); + parent::__construct($collectionFactory, $storeManager, $layerResolver); } /** diff --git a/app/code/Magento/Catalog/Model/Observer.php b/app/code/Magento/Catalog/Model/Observer.php index 8ef26b5e73b01..864a5357d934c 100644 --- a/app/code/Magento/Catalog/Model/Observer.php +++ b/app/code/Magento/Catalog/Model/Observer.php @@ -83,7 +83,7 @@ class Observer * @param \Magento\Catalog\Model\Resource\Category $categoryResource * @param \Magento\Catalog\Model\Resource\Product $catalogProduct * @param \Magento\Framework\StoreManagerInterface $storeManager - * @param \Magento\Catalog\Model\Layer\Category $catalogLayer + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param \Magento\Catalog\Helper\Category $catalogCategory * @param \Magento\Catalog\Helper\Data $catalogData * @param Indexer\Category\Flat\State $categoryFlatState @@ -93,7 +93,7 @@ public function __construct( \Magento\Catalog\Model\Resource\Category $categoryResource, \Magento\Catalog\Model\Resource\Product $catalogProduct, \Magento\Framework\StoreManagerInterface $storeManager, - \Magento\Catalog\Model\Layer\Category $catalogLayer, + \Magento\Catalog\Model\Layer\Resolver $layerResolver, \Magento\Catalog\Helper\Category $catalogCategory, \Magento\Catalog\Helper\Data $catalogData, \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, @@ -102,7 +102,7 @@ public function __construct( $this->_categoryResource = $categoryResource; $this->_catalogProduct = $catalogProduct; $this->_storeManager = $storeManager; - $this->_catalogLayer = $catalogLayer; + $this->_catalogLayer = $layerResolver->get(); $this->_catalogCategory = $catalogCategory; $this->_catalogData = $catalogData; $this->categoryFlatConfig = $categoryFlatState; diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 26bab0eb2d061..d9f6376483d01 100644 --- a/app/code/Magento/Catalog/Model/Product.php +++ b/app/code/Magento/Catalog/Model/Product.php @@ -26,6 +26,8 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\Pricing\Object\SaleableInterface; use Magento\Framework\Object\IdentityInterface; +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Framework\Convert\ConvertArray; /** * Catalog product model @@ -45,7 +47,10 @@ * * @SuppressWarnings(PHPMD.LongVariable) */ -class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityInterface, SaleableInterface +class Product extends \Magento\Catalog\Model\AbstractModel implements + IdentityInterface, + SaleableInterface, + ProductInterface { /** * Entity code. @@ -262,6 +267,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry + * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataService * @param \Magento\Framework\StoreManagerInterface $storeManager * @param Product\Url $url * @param Product\Link $productLink @@ -291,6 +297,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements IdentityIn public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, + \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataService, \Magento\Framework\StoreManagerInterface $storeManager, Product\Url $url, Product\Link $productLink, @@ -334,7 +341,15 @@ public function __construct( $this->_productFlatIndexerProcessor = $productFlatIndexerProcessor; $this->_productPriceIndexerProcessor = $productPriceIndexerProcessor; $this->_productEavIndexerProcessor = $productEavIndexerProcessor; - parent::__construct($context, $registry, $storeManager, $resource, $resourceCollection, $data); + parent::__construct( + $context, + $registry, + $metadataService, + $storeManager, + $resource, + $resourceCollection, + $data + ); } /** @@ -421,6 +436,47 @@ public function getPrice() } } + /** + * Get visibility status + * @see \Magento\Catalog\Model\Product\Visibility + * + * @return int + */ + public function getVisibility() + { + return $this->_getData('visibility'); + } + + /** + * Get product attribute set id + * + * @return int + */ + public function getAttributeSetId() + { + return $this->_getData('attribute_set_id'); + } + + /** + * Get product creation date + * + * @return string + */ + public function getCreatedAt() + { + return $this->_getData('created_at'); + } + + /** + * Get previous product update date + * + * @return string + */ + public function getUpdatedAt() + { + return $this->_getData('updated_at'); + } + /** * Set Price calculation flag * @@ -628,7 +684,7 @@ public function getAttributes($groupId = null, $skipSuper = false) * * @return void */ - protected function _beforeSave() + public function beforeSave() { $this->cleanCache(); $this->setTypeHasOptions(false); @@ -685,7 +741,7 @@ protected function _beforeSave() $this->setOrigData('website_ids', $websiteIds); } - parent::_beforeSave(); + parent::beforeSave(); } /** @@ -708,7 +764,7 @@ public function canAffectOptions($value = null) * * @return \Magento\Catalog\Model\Product */ - protected function _afterSave() + public function afterSave() { $this->getLinkInstance()->saveProductRelations($this); $this->getTypeInstance()->save($this); @@ -727,7 +783,7 @@ protected function _afterSave() $this->getOptionInstance()->setProduct($this)->saveOptions(); } - $result = parent::_afterSave(); + $result = parent::afterSave(); $this->_getResource()->addCommitCallback(array($this, 'reindex')); $this->reloadPriceInfo(); @@ -801,10 +857,10 @@ public function reindex() * * @return \Magento\Catalog\Model\Product */ - protected function _beforeDelete() + public function beforeDelete() { $this->cleanCache(); - return parent::_beforeDelete(); + return parent::beforeDelete(); } /** @@ -812,11 +868,11 @@ protected function _beforeDelete() * * @return void */ - protected function _afterDeleteCommit() + public function afterDeleteCommit() { $this->reindex(); $this->_productPriceIndexerProcessor->reindexRow($this->getId()); - parent::_afterDeleteCommit(); + parent::afterDeleteCommit(); } /** @@ -1391,8 +1447,8 @@ public function getIsSalable() if (method_exists($productType, 'getIsSalable')) { return $productType->getIsSalable($this); } - if ($this->hasData('is_salable')) { - return $this->getData('is_salable'); + if ($this->hasData('is_saleable')) { + return $this->getData('is_saleable'); } return $this->isSalable(); @@ -1547,21 +1603,6 @@ public function fromArray(array $data) return $this; } - /** - * Delete product - * - * @return \Magento\Catalog\Model\Product - */ - public function delete() - { - parent::delete(); - $this->_eventManager->dispatch( - $this->_eventPrefix . '_delete_after_done', - array($this->_eventObject => $this) - ); - return $this; - } - /** * Returns request path * @@ -2028,4 +2069,51 @@ public function reloadPriceInfo() return $this->getPriceInfo(); } } + + /** + * Return Data Object data in array format. + * + * @return array + */ + public function __toArray() + { + $data = $this->_data; + $hasToArray = function ($model) { + return is_object($model) && method_exists($model, '__toArray') && is_callable([$model, '__toArray']); + }; + foreach ($data as $key => $value) { + if ($hasToArray($value)) { + $data[$key] = $value->__toArray(); + } elseif (is_array($value)) { + foreach ($value as $nestedKey => $nestedValue) { + if ($hasToArray($nestedValue)) { + $value[$nestedKey] = $nestedValue->__toArray(); + } + } + $data[$key] = $value; + } + } + return $data; + } + + /** + * Convert Category model into flat array. + * + * @return array + */ + public function toFlatArray() + { + $dataArray = $this->__toArray(); + //process custom attributes if present + if (array_key_exists('custom_attributes', $dataArray) && !empty($dataArray['custom_attributes'])) { + /** @var \Magento\Framework\Api\AttributeInterface[] $customAttributes */ + $customAttributes = $dataArray['custom_attributes']; + unset ($dataArray['custom_attributes']); + foreach ($customAttributes as $attributeValue) { + $dataArray[$attributeValue[\Magento\Framework\Api\AttributeInterface::ATTRIBUTE_CODE]] + = $attributeValue[\Magento\Framework\Api\AttributeInterface::VALUE]; + } + } + return $dataArray; + } } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php index 03a9da41cc411..d73024f635dab 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice.php @@ -43,6 +43,7 @@ class Groupprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Groupp * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Product\Type $catalogProductType + * @param \Magento\Customer\Api\GroupManagementInterface $groupManagement * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice */ public function __construct( @@ -51,10 +52,18 @@ public function __construct( \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Product\Type $catalogProductType, + \Magento\Customer\Api\GroupManagementInterface $groupManagement, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Groupprice $productAttributeBackendGroupprice ) { $this->_productAttributeBackendGroupprice = $productAttributeBackendGroupprice; - parent::__construct($currencyFactory, $storeManager, $catalogData, $config, $catalogProductType); + parent::__construct( + $currencyFactory, + $storeManager, + $catalogData, + $config, + $catalogProductType, + $groupManagement + ); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php index c83318bcf6866..2b27ec570cd4c 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Groupprice/AbstractGroupprice.php @@ -24,7 +24,7 @@ namespace Magento\Catalog\Model\Product\Attribute\Backend\Groupprice; use Magento\Catalog\Model\Product\Attribute\Backend\Price; -use Magento\Customer\Service\V1\CustomerGroupServiceInterface; +use Magento\Customer\Api\GroupManagementInterface; /** * Catalog product abstract group price backend attribute model @@ -53,21 +53,29 @@ abstract protected function _getDuplicateErrorMessage(); */ protected $_catalogProductType; + /** + * @var GroupManagementInterface + */ + protected $_groupManagement; + /** * @param \Magento\Directory\Model\CurrencyFactory $currencyFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Product\Type $catalogProductType + * @param GroupManagementInterface $groupManagement */ public function __construct( \Magento\Directory\Model\CurrencyFactory $currencyFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\App\Config\ScopeConfigInterface $config, - \Magento\Catalog\Model\Product\Type $catalogProductType + \Magento\Catalog\Model\Product\Type $catalogProductType, + GroupManagementInterface $groupManagement ) { $this->_catalogProductType = $catalogProductType; + $this->_groupManagement = $groupManagement; parent::__construct($currencyFactory, $storeManager, $catalogData, $config); } @@ -271,7 +279,7 @@ public function afterLoad($object) foreach ($data as $k => $v) { $data[$k]['website_price'] = $v['price']; if ($v['all_groups']) { - $data[$k]['cust_group'] = CustomerGroupServiceInterface::CUST_GROUP_ALL; + $data[$k]['cust_group'] = $this->_groupManagement->getAllCustomersGroup()->getId(); } } @@ -356,7 +364,7 @@ public function afterSave($object) array_merge(array($data['website_id'], $data['cust_group']), $this->_getAdditionalUniqueFields($data)) ); - $useForAllGroups = $data['cust_group'] == CustomerGroupServiceInterface::CUST_GROUP_ALL; + $useForAllGroups = $data['cust_group'] == $this->_groupManagement->getAllCustomersGroup()->getId(); $customerGroupId = !$useForAllGroups ? $data['cust_group'] : 0; $new[$key] = array_merge( diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php index 6b1b2cc597438..2a0d11c121193 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php @@ -45,6 +45,7 @@ class Tierprice extends \Magento\Catalog\Model\Product\Attribute\Backend\Grouppr * @param \Magento\Catalog\Helper\Data $catalogData * @param \Magento\Framework\App\Config\ScopeConfigInterface $config * @param \Magento\Catalog\Model\Product\Type $catalogProductType + * @param \Magento\Customer\Api\GroupManagementInterface $groupManagement * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice */ public function __construct( @@ -53,10 +54,18 @@ public function __construct( \Magento\Catalog\Helper\Data $catalogData, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Catalog\Model\Product\Type $catalogProductType, + \Magento\Customer\Api\GroupManagementInterface $groupManagement, \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Tierprice $productAttributeTierprice ) { $this->_productAttributeBackendTierprice = $productAttributeTierprice; - parent::__construct($currencyFactory, $storeManager, $catalogData, $config, $catalogProductType); + parent::__construct( + $currencyFactory, + $storeManager, + $catalogData, + $config, + $catalogProductType, + $groupManagement + ); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php index 7a6a5e4314d5c..298799eaf7509 100644 --- a/app/code/Magento/Catalog/Model/Product/Attribute/Group.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Group.php @@ -36,6 +36,7 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry + * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService * @param \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -44,13 +45,14 @@ class Group extends \Magento\Eav\Model\Entity\Attribute\Group public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, + \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Catalog\Model\Resource\Product\Attribute\CollectionFactory $attributeCollectionFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_attributeCollectionFactory = $attributeCollectionFactory; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $metadataService, $resource, $resourceCollection, $data); } /** diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Management.php b/app/code/Magento/Catalog/Model/Product/Attribute/Management.php new file mode 100644 index 0000000000000..288600b891cdb --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Management.php @@ -0,0 +1,75 @@ +eavAttributeManagement = $eavAttributeManagement; + } + + /** + * {@inheritdoc} + */ + public function assign($attributeSetId, $attributeGroupId, $attributeCode, $sortOrder) + { + return $this->eavAttributeManagement->assign( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $attributeSetId, + $attributeGroupId, + $attributeCode, + $sortOrder + ); + } + + /** + * {@inheritdoc} + */ + public function unassign($attributeSetId, $attributeCode) + { + return $this->eavAttributeManagement->unassign($attributeSetId, $attributeCode); + } + + /** + * {@inheritdoc} + */ + public function getAttributes($attributeSetId) + { + return $this->eavAttributeManagement->getAttributes( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $attributeSetId + ); + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php b/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php new file mode 100644 index 0000000000000..e31255acf139c --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Attribute/OptionManagement.php @@ -0,0 +1,83 @@ + + * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) + * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) + */ +namespace Magento\Catalog\Model\Product\Attribute; + +use Magento\Framework\Exception\InputException; + +class OptionManagement implements \Magento\Catalog\Api\ProductAttributeOptionManagementInterface +{ + /** + * @var \Magento\Eav\Api\AttributeOptionManagementInterface + */ + protected $eavOptionManagement; + + /** + * @param \Magento\Eav\Api\AttributeOptionManagementInterface $eavOptionManagement + */ + public function __construct( + \Magento\Eav\Api\AttributeOptionManagementInterface $eavOptionManagement + ) { + $this->eavOptionManagement = $eavOptionManagement; + } + + /** + * {@inheritdoc} + */ + public function getItems($attributeCode) + { + return $this->eavOptionManagement->getItems( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $attributeCode + ); + } + + /** + * {@inheritdoc} + */ + public function add($attributeCode, $option) + { + return $this->eavOptionManagement->add( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $attributeCode, + $option + ); + } + + /** + * {@inheritdoc} + */ + public function delete($attributeCode, $optionId) + { + if (empty($optionId)) { + throw new InputException(sprintf('Invalid option id %s', $optionId)); + } + + return $this->eavOptionManagement->delete( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $attributeCode, + $optionId + ); + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php new file mode 100644 index 0000000000000..6d8deca5bfecc --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Repository.php @@ -0,0 +1,306 @@ +attributeResource = $attributeResource; + $this->attributeBuilder = $attributeBuilder; + $this->productHelper = $productHelper; + $this->filterManager = $filterManager; + $this->eavAttributeRepository = $eavAttributeRepository; + $this->eavConfig = $eavConfig; + $this->inputtypeValidatorFactory = $validatorFactory; + $this->metadataConfig = $metadataConfig; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->filterBuilder = $filterBuilder; + } + + /** + * {@inheritdoc} + */ + public function get($attributeCode) + { + return $this->eavAttributeRepository->get( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $attributeCode + ); + } + + /** + * {@inheritdoc} + */ + public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) + { + return $this->eavAttributeRepository->getList( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $searchCriteria + ); + } + + /** + * {@inheritdoc} + */ + public function save(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute) + { + $this->attributeBuilder->populate($attribute); + + if ($attribute->getAttributeId()) { + $existingModel = $this->get($attribute->getAttributeCode()); + + if (!$existingModel->getAttributeId()) { + throw NoSuchEntityException::singleField('attribute_code', $existingModel->getAttributeCode()); + } + + $this->attributeBuilder->setAttributeId($existingModel->getAttributeId()); + $this->attributeBuilder->setIsUserDefined($existingModel->getIsUserDefined()); + $this->attributeBuilder->setFrontendInput($existingModel->getFrontendInput()); + + if (is_array($attribute->getFrontendLabels())) { + $frontendLabel[0] = $existingModel->getDefaultFrontendLabel(); + foreach ($attribute->getFrontendLabels() as $item) { + $frontendLabel[$item->getStoreId()] = $item->getLabel(); + } + $this->attributeBuilder->setDefaultFrontendLabel($frontendLabel); + } + if (!$attribute->getIsUserDefined()) { + // Unset attribute field for system attributes + $this->attributeBuilder->setApplyTo(null); + } + } else { + $this->attributeBuilder->setAttributeId(null); + + if (!$attribute->getFrontendLabels() && !$attribute->getDefaultFrontendLabel()) { + throw InputException::requiredField('frontend_label'); + } + + $frontendLabels = []; + if ($attribute->getDefaultFrontendLabel()) { + $frontendLabels[0] = $attribute->getDefaultFrontendLabel(); + } + if ($attribute->getFrontendLabels() && is_array($attribute->getFrontendLabels())) { + foreach ($attribute->getFrontendLabels() as $label) { + $frontendLabels[$label->getStoreId()] = $label->getLabel(); + } + if (!isset($frontendLabels[0]) || !$frontendLabels[0]) { + throw InputException::invalidFieldValue('frontend_label', null); + } + + $this->attributeBuilder->setDefaultFrontendLabel($frontendLabels); + } + $this->attributeBuilder->setAttributeCode( + $attribute->getAttributeCode() ?: $this->generateCode($frontendLabels[0]) + ); + $this->validateCode($attribute->getAttributeCode()); + $this->validateFrontendInput($attribute->getFrontendInput()); + + $this->attributeBuilder->setBackendType( + $attribute->getBackendTypeByInput($attribute->getFrontendInput()) + ); + $this->attributeBuilder->setSourceModel( + $this->productHelper->getAttributeSourceModelByInputType($attribute->getFrontendInput()) + ); + $this->attributeBuilder->setBackendModel( + $this->productHelper->getAttributeBackendModelByInputType($attribute->getFrontendInput()) + ); + $this->attributeBuilder->setEntityTypeId( + $this->eavConfig + ->getEntityType(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE) + ->getId() + ); + $this->attributeBuilder->setIsUserDefined(1); + } + $attribute = $this->attributeBuilder->create(); + $this->attributeResource->save($attribute); + return $attribute; + } + + /** + * {@inheritdoc} + */ + public function delete(\Magento\Catalog\Api\Data\ProductAttributeInterface $attribute) + { + $this->attributeResource->delete($attribute); + return true; + } + + /** + * {@inheritdoc} + */ + public function deleteById($attributeCode) + { + $this->delete( + $this->get($attributeCode) + ); + return true; + } + + /** + * {@inheritdoc} + */ + public function getCustomAttributesMetadata($dataObjectClassName = null) + { + $searchCriteria = $this->searchCriteriaBuilder->addFilter( + [ + $this->filterBuilder + ->setField('attribute_set_id') + ->setValue(\Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID) + ->create() + ] + ); + + $customAttributes = []; + $entityAttributes = $this->getList($searchCriteria->create())->getItems(); + + foreach ($entityAttributes as $attributeMetadata) { + $customAttributes[] = $attributeMetadata; + } + return array_merge($customAttributes, $this->metadataConfig->getCustomAttributesMetadata($dataObjectClassName)); + } + + /** + * Generate code from label + * + * @param string $label + * @return string + */ + protected function generateCode($label) + { + $code = substr(preg_replace('/[^a-z_0-9]/', '_', $this->filterManager->translitUrl($label)), 0, 30); + $validatorAttrCode = new \Zend_Validate_Regex(['pattern' => '/^[a-z][a-z_0-9]{0,29}[a-z0-9]$/']); + if (!$validatorAttrCode->isValid($code)) { + $code = 'attr_' . ($code ?: substr(md5(time()), 0, 8)); + } + return $code; + } + + /** + * Validate attribute code + * + * @param string $code + * @return void + * @throws \Magento\Framework\Exception\InputException + */ + protected function validateCode($code) + { + $validatorAttrCode = new \Zend_Validate_Regex(['pattern' => '/^[a-z][a-z_0-9]{0,30}$/']); + if (!$validatorAttrCode->isValid($code)) { + throw InputException::invalidFieldValue('attribute_code', $code); + } + } + + /** + * Validate Frontend Input Type + * + * @param string $frontendInput + * @return void + * @throws \Magento\Framework\Exception\InputException + */ + protected function validateFrontendInput($frontendInput) + { + /** @var \Magento\Eav\Model\Adminhtml\System\Config\Source\Inputtype\Validator $validator */ + $validator = $this->inputtypeValidatorFactory->create(); + if (!$validator->isValid($frontendInput)) { + throw InputException::invalidFieldValue('frontend_input', $frontendInput); + } + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/SetManagement.php b/app/code/Magento/Catalog/Model/Product/Attribute/SetManagement.php new file mode 100644 index 0000000000000..ea1d8f77d2c42 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Attribute/SetManagement.php @@ -0,0 +1,91 @@ +attributeSetManagement = $attributeSetManagement; + $this->attributeSetRepository = $attributeSetRepository; + $this->eavConfig = $eavConfig; + } + + /** + * {@inheritdoc} + */ + public function create(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet, $skeletonId) + { + $this->validateSkeletonSet($skeletonId); + return $this->attributeSetManagement->create( + \Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE, + $attributeSet, + $skeletonId + ); + } + + /** + * @param int $skeletonId + * @return void + * @throws StateException + */ + protected function validateSkeletonSet($skeletonId) + { + try { + $skeletonSet = $this->attributeSetRepository->get($skeletonId); + $productEntityId = $this->eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY)->getId(); + if ($skeletonSet->getEntityTypeId() != $productEntityId) { + throw new StateException('Can not create attribute set based on non product attribute set.'); + } + } catch (\Magento\Framework\Exception\NoSuchEntityException $exception) { + throw new StateException('Can not create attribute set based on not existing attribute set'); + } + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php new file mode 100644 index 0000000000000..32c31ada56979 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Attribute/SetRepository.php @@ -0,0 +1,139 @@ +attributeSetRepository = $attributeSetRepository; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->filterBuilder = $filterBuilder; + $this->eavConfig = $eavConfig; + } + + /** + * {@inheritdoc} + */ + public function save(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet) + { + $this->validate($attributeSet); + return $this->attributeSetRepository->save($attributeSet); + } + + /** + * {@inheritdoc} + */ + public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) + { + $this->searchCriteriaBuilder->addFilter( + [ + $this->filterBuilder + ->setField('entity_type_code') + ->setValue(\Magento\Catalog\Api\Data\ProductAttributeInterface::ENTITY_TYPE_CODE) + ->setConditionType('eq') + ->create() + ] + ); + $this->searchCriteriaBuilder->setCurrentPage($searchCriteria->getCurrentPage()); + $this->searchCriteriaBuilder->setPageSize($searchCriteria->getPageSize()); + return $this->attributeSetRepository->getList($this->searchCriteriaBuilder->create()); + } + + /** + * {@inheritdoc} + */ + public function get($attributeSetId) + { + $attributeSet = $this->attributeSetRepository->get($attributeSetId); + $this->validate($attributeSet); + return $attributeSet; + } + + /** + * {@inheritdoc} + */ + public function delete(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet) + { + $this->validate($attributeSet); + return $this->attributeSetRepository->delete($attributeSet); + } + + /** + * {@inheritdoc} + */ + public function deleteById($attributeSetId) + { + $this->get($attributeSetId); + return $this->attributeSetRepository->deleteById($attributeSetId); + } + + /** + * Validate Frontend Input Type + * + * @param \Magento\Eav\Api\Data\AttributeSetInterface $attributeSet + * @return void + * @throws \Magento\Framework\Exception\InputException + */ + protected function validate(\Magento\Eav\Api\Data\AttributeSetInterface $attributeSet) + { + $productEntityId = $this->eavConfig->getEntityType(\Magento\Catalog\Model\Product::ENTITY)->getId(); + if ($attributeSet->getEntityTypeId() != $productEntityId) { + throw new \Magento\Framework\Exception\StateException('Provided Attribute set non product Attribute set.'); + } + } +} diff --git a/lib/internal/Magento/Framework/Module/Declaration/FileIteratorFactory.php b/app/code/Magento/Catalog/Model/Product/Attribute/Type.php similarity index 70% rename from lib/internal/Magento/Framework/Module/Declaration/FileIteratorFactory.php rename to app/code/Magento/Catalog/Model/Product/Attribute/Type.php index efcdfb2548476..6fdfe58fabb0e 100644 --- a/lib/internal/Magento/Framework/Module/Declaration/FileIteratorFactory.php +++ b/app/code/Magento/Catalog/Model/Product/Attribute/Type.php @@ -1,6 +1,5 @@ getData('value'); + } + + /** + * {@inheritdoc} */ - public function create($filesystem, $paths) + public function getLabel() { - return new FileIterator($filesystem, $paths); + return $this->getData(self::LABEL); } } diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/TypesList.php b/app/code/Magento/Catalog/Model/Product/Attribute/TypesList.php new file mode 100644 index 0000000000000..27781021923a1 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Attribute/TypesList.php @@ -0,0 +1,68 @@ +inputTypeFactory = $inputTypeFactory; + $this->attributeTypeBuilder = $attributeTypeBuilder; + } + + /** + * {@inheritdoc} + */ + public function getItems() + { + $types = []; + $inputType = $this->inputTypeFactory->create(); + + foreach ($inputType->toOptionArray() as $option) { + $types[] = $this->attributeTypeBuilder->populateWithArray($option)->create(); + } + return $types; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/AttributeSet/AlreadyExistsException.php b/app/code/Magento/Catalog/Model/Product/AttributeSet/AlreadyExistsException.php new file mode 100644 index 0000000000000..ac3dda6de65dd --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/AttributeSet/AlreadyExistsException.php @@ -0,0 +1,29 @@ +attributeSetFactory = $attributeSetFactory; + } + + /** + * @param int $entityTypeId + * @return $this + */ + public function setEntityTypeId($entityTypeId) + { + $this->entityTypeId = (int)$entityTypeId; + return $this; + } + + /** + * @param int $skeletonId + * @return $this + */ + public function setSkeletonId($skeletonId) + { + $this->skeletonId = (int)$skeletonId; + return $this; + } + + /** + * @param string $setName + * @return $this + */ + public function setName($setName) + { + $this->name = $setName; + return $this; + } + + /** + * @return \Magento\Eav\Model\Entity\Attribute\Set + * @throws AlreadyExistsException + */ + public function getAttributeSet() + { + $this->validateParameters(); + /** @var \Magento\Eav\Model\Entity\Attribute\Set $attributeSet */ + $attributeSet = $this->attributeSetFactory->create(); + $attributeSet->setEntityTypeId($this->entityTypeId)->load($this->name, 'attribute_set_name'); + if ($attributeSet->getId()) { + throw new AlreadyExistsException(); + } + + $attributeSet->setAttributeSetName($this->name)->validate(); + $attributeSet->save(); + $attributeSet->initFromSkeleton($this->skeletonId)->save(); + + return $attributeSet; + } + + /** + * @trows \InvalidArgumentException + * @return void + */ + protected function validateParameters() + { + if (empty($this->name)) { + throw new \InvalidArgumentException(); + } elseif (empty($this->skeletonId)) { + throw new \InvalidArgumentException(); + } elseif (empty($this->entityTypeId)) { + throw new \InvalidArgumentException(); + } + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Compare/Item.php b/app/code/Magento/Catalog/Model/Product/Compare/Item.php index e4db0341e799f..77f3459bf5155 100644 --- a/app/code/Magento/Catalog/Model/Product/Compare/Item.php +++ b/app/code/Magento/Catalog/Model/Product/Compare/Item.php @@ -141,9 +141,9 @@ protected function _getResource() * * @return $this */ - protected function _beforeSave() + public function beforeSave() { - parent::_beforeSave(); + parent::beforeSave(); if (!$this->hasStoreId()) { $this->setStoreId($this->_storeManager->getStore()->getId()); } diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/ContentValidator.php b/app/code/Magento/Catalog/Model/Product/Gallery/ContentValidator.php new file mode 100644 index 0000000000000..986c23402cf1a --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Gallery/ContentValidator.php @@ -0,0 +1,108 @@ +allowedMimeTypes = array_merge($this->defaultMimeTypes, $allowedMimeTypes); + } + + /** + * Check if gallery entry content is valid + * + * @param ProductAttributeMediaGalleryEntryContentInterface $entryContent + * @return bool + * @throws InputException + */ + public function isValid(ProductAttributeMediaGalleryEntryContentInterface $entryContent) + { + $fileContent = @base64_decode($entryContent->getEntryData(), true); + if (empty($fileContent)) { + throw new InputException('The image content must be valid base64 encoded data.'); + } + $imageProperties = @getimagesizefromstring($fileContent); + if (empty($imageProperties)) { + throw new InputException('The image content must be valid base64 encoded data.'); + } + $sourceMimeType = $imageProperties['mime']; + if ($sourceMimeType != $entryContent->getMimeType() || !$this->isMimeTypeValid($sourceMimeType)) { + throw new InputException('The image MIME type is not valid or not supported.'); + } + if (!$this->isNameValid($entryContent->getName())) { + throw new InputException('Provided image name contains forbidden characters.'); + } + return true; + } + + /** + * Check if given mime type is valid + * + * @param string $mimeType + * @return bool + */ + protected function isMimeTypeValid($mimeType) + { + return in_array($mimeType, $this->allowedMimeTypes); + } + + /** + * Check if given filename is valid + * + * @param string $name + * @return bool + */ + protected function isNameValid($name) + { + // Cannot contain \ / : * ? " < > | + if (!preg_match('/^[^\\/?*:";<>()|{}\\\\]+$/', $name)) { + return false; + } + return true; + } +} diff --git a/setup/module/Magento/Config/src/FileIterator.php b/app/code/Magento/Catalog/Model/Product/Gallery/Entry.php similarity index 52% rename from setup/module/Magento/Config/src/FileIterator.php rename to app/code/Magento/Catalog/Model/Product/Gallery/Entry.php index 95c8a5daa5796..fcbba1ed3d0db 100644 --- a/setup/module/Magento/Config/src/FileIterator.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/Entry.php @@ -1,5 +1,6 @@ paths = $paths; - } - - /** - *Rewind + * Retrieve gallery entry ID * - * @return void + * @return int */ - public function rewind() + public function getId() { - reset($this->paths); + return $this->getData(self::ID); } /** - * Current + * Retrieve gallery entry alternative text * * @return string */ - public function current() + public function getLabel() { - return file_get_contents($this->key()); + return $this->getData(self::LABEL); } /** - * Key + * Retrieve gallery entry position (sort order) * - * @return mixed - */ - public function key() - { - return current($this->paths); - } - - /** - * Next - * - * @return void + * @return int */ - public function next() + public function getPosition() { - next($this->paths); + return $this->getData(self::POSITION); } /** - * Valid + * Check if gallery entry is hidden from product page * * @return bool */ - public function valid() + public function getIsDisabled() { - return (bool) $this->key(); + return $this->getData(self::DISABLED); } /** - * Convert to an array + * Retrieve gallery entry image types (thumbnail, image, small_image etc) * - * @return array + * @return string[] */ - public function toArray() + public function getTypes() { - $result = array(); - foreach ($this as $item) { - $result[$this->key()] = $item; - } - return $result; + return $this->getData(self::TYPES); } /** - * Count + * Get file path * - * @return int + * @return string */ - public function count() + public function getFile() { - return count($this->paths); + return $this->getData(self::FILE); } } diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/EntryResolver.php b/app/code/Magento/Catalog/Model/Product/Gallery/EntryResolver.php new file mode 100644 index 0000000000000..df78aacd812e4 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Gallery/EntryResolver.php @@ -0,0 +1,75 @@ +getData('media_gallery'); + if (!isset($mediaGalleryData['images']) || !is_array($mediaGalleryData['images'])) { + return null; + } + + foreach ($mediaGalleryData['images'] as $image) { + if (isset($image['value_id']) && $image['value_id'] == $entryId) { + return isset($image['file']) ? $image['file'] : null; + } + } + return null; + } + + /** + * Retrieve gallery entry ID that corresponds to the given file path + * + * @param Product $product + * @param string $filePath + * @return int|null + */ + public function getEntryIdByFilePath(Product $product, $filePath) + { + $mediaGalleryData = $product->getData('media_gallery'); + if (!isset($mediaGalleryData['images']) || !is_array($mediaGalleryData['images'])) { + return null; + } + + foreach ($mediaGalleryData['images'] as $image) { + if (isset($image['file']) && $image['file'] == $filePath) { + return isset($image['value_id']) ? $image['value_id'] : null; + } + } + return null; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php new file mode 100644 index 0000000000000..81db877435ba8 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Gallery/GalleryManagement.php @@ -0,0 +1,326 @@ + 'jpg', + 'image/jpeg' => 'jpg', + 'image/gif' => 'gif', + 'image/png' => 'png', + ); + + /** + * @var \Magento\Framework\StoreManagerInterface + */ + protected $storeManager; + + /** + * @var \Magento\Catalog\Api\ProductRepositoryInterface + */ + protected $productRepository; + + /** + * @var MediaConfig + */ + protected $mediaConfig; + + /** + * @var \Magento\Catalog\Model\Product\Gallery\ContentValidator + */ + protected $contentValidator; + + /** + * @var \Magento\Framework\Filesystem + */ + protected $filesystem; + + /** + * @var \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryDataBuilder + */ + protected $entryBuilder; + + /** + * @var \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media + */ + protected $mediaGallery; + + /** + * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface + */ + protected $attributeRepository; + + /** + * @param \Magento\Framework\StoreManagerInterface $storeManager + * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository + * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository + * @param MediaConfig $mediaConfig + * @param ContentValidator $contentValidator + * @param \Magento\Framework\Filesystem $filesystem + * @param EntryResolver $entryResolver + * @param \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryDataBuilder $entryBuilder + * @param \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $mediaGallery + */ + public function __construct( + \Magento\Framework\StoreManagerInterface $storeManager, + \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, + \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository, + MediaConfig $mediaConfig, + \Magento\Catalog\Model\Product\Gallery\ContentValidator $contentValidator, + \Magento\Framework\Filesystem $filesystem, + EntryResolver $entryResolver, + \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryDataBuilder $entryBuilder, + \Magento\Catalog\Model\Resource\Product\Attribute\Backend\Media $mediaGallery + ) { + $this->productRepository = $productRepository; + $this->storeManager = $storeManager; + $this->attributeRepository = $attributeRepository; + $this->mediaConfig = $mediaConfig; + $this->contentValidator = $contentValidator; + $this->filesystem = $filesystem; + $this->entryResolver = $entryResolver; + $this->entryBuilder = $entryBuilder; + $this->mediaGallery = $mediaGallery; + } + + /** + * Retrieve backend model of product media gallery attribute + * + * @param Product $product + * @return \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend + * @throws StateException + */ + protected function getGalleryAttributeBackend(Product $product) + { + $attributes = $product->getTypeInstance()->getSetAttributes($product); + if (!isset($attributes['media_gallery']) + || !($attributes['media_gallery'] instanceof \Magento\Eav\Model\Entity\Attribute\AbstractAttribute) + ) { + throw new StateException('Requested product does not support images.'); + } + /** @var $galleryAttribute \Magento\Eav\Model\Entity\Attribute\AbstractAttribute */ + $galleryAttribute = $attributes['media_gallery']; + return $galleryAttribute->getBackend(); + } + + /** + * Retrieve assoc array that contains media attribute values of the given product + * + * @param Product $product + * @return array + */ + protected function getMediaAttributeValues(Product $product) + { + $mediaAttributeCodes = array_keys($product->getMediaAttributes()); + $mediaAttributeValues = array(); + foreach ($mediaAttributeCodes as $attributeCode) { + $mediaAttributeValues[$attributeCode] = $product->getData($attributeCode); + } + return $mediaAttributeValues; + } + + /** + * {@inheritdoc} + */ + public function create( + $productSku, + ProductAttributeMediaGalleryEntryInterface $entry, + ContentInterface $entryContent, + $storeId = 0 + ) { + try { + $this->storeManager->getStore($storeId); + } catch (\Exception $exception) { + throw new NoSuchEntityException('There is no store with provided ID.'); + } + if (!$this->contentValidator->isValid($entryContent)) { + throw new InputException('The image content is not valid.'); + } + $product = $this->productRepository->get($productSku); + + $fileContent = @base64_decode($entryContent->getEntryData(), true); + $mediaTmpPath = $this->mediaConfig->getBaseTmpMediaPath(); + $mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA); + $mediaDirectory->create($mediaTmpPath); + $fileName = $entryContent->getName() . '.' . $this->mimeTypeExtensionMap[$entryContent->getMimeType()]; + $relativeFilePath = $mediaTmpPath . DIRECTORY_SEPARATOR . $fileName; + $absoluteFilePath = $mediaDirectory->getAbsolutePath($relativeFilePath); + $mediaDirectory->writeFile($relativeFilePath, $fileContent); + + /** @var $productMediaGallery \Magento\Catalog\Model\Product\Attribute\Backend\Media */ + $productMediaGallery = $this->getGalleryAttributeBackend($product); + $imageFileUri = $productMediaGallery->addImage( + $product, + $absoluteFilePath, + $entry->getTypes(), + true, + $entry->getIsDisabled() + ); + // Update additional fields that are still empty after addImage call + $productMediaGallery->updateImage($product, $imageFileUri, array( + 'label' => $entry->getLabel(), + 'position' => $entry->getPosition(), + 'disabled' => $entry->getIsDisabled(), + )); + $product->setStoreId($storeId); + + try { + $this->productRepository->save($product); + } catch (\Exception $e) { + throw new StateException('Cannot save product.'); + } + // Remove all temporary files + $mediaDirectory->delete($relativeFilePath); + // File could change its name during the move from tmp dir + return $this->entryResolver->getEntryIdByFilePath( + $product, + $productMediaGallery->getRenamedImage($imageFileUri) + ); + } + + /** + * {@inheritdoc} + */ + public function update($productSku, ProductAttributeMediaGalleryEntryInterface $entry, $storeId = 0) + { + try { + $this->storeManager->getStore($storeId); + } catch (\Exception $exception) { + throw new NoSuchEntityException('There is no store with provided ID.'); + } + $product = $this->productRepository->get($productSku); + /** @var $productMediaGallery \Magento\Catalog\Model\Product\Attribute\Backend\Media */ + $productMediaGallery = $this->getGalleryAttributeBackend($product); + $filePath = $this->entryResolver->getEntryFilePathById($product, $entry->getId()); + if (is_null($filePath)) { + throw new NoSuchEntityException('There is no image with provided ID.'); + } + + $productMediaGallery->updateImage($product, $filePath, array( + 'label' => $entry->getLabel(), + 'position' => $entry->getPosition(), + 'disabled' => $entry->getIsDisabled(), + )); + $productMediaGallery->clearMediaAttribute($product, array_keys($product->getMediaAttributes())); + $productMediaGallery->setMediaAttribute($product, $entry->getTypes(), $filePath); + $product->setStoreId($storeId); + + try { + $this->productRepository->save($product); + } catch (\Exception $exception) { + throw new StateException('Cannot save product.'); + } + return true; + } + + /** + * {@inheritdoc} + */ + public function remove($productSku, $entryId) + { + $product = $this->productRepository->get($productSku); + /** @var $productMediaGallery \Magento\Catalog\Model\Product\Attribute\Backend\Media */ + $productMediaGallery = $this->getGalleryAttributeBackend($product); + $filePath = $this->entryResolver->getEntryFilePathById($product, $entryId); + if (is_null($filePath)) { + throw new NoSuchEntityException('There is no image with provided ID.'); + } + + $productMediaGallery->removeImage($product, $filePath); + $this->productRepository->save($product); + return true; + } + + /** + * {@inheritdoc} + */ + public function get($productSku, $imageId) + { + try { + $product = $this->productRepository->get($productSku); + } catch (\Exception $exception) { + throw new NoSuchEntityException("Such product doesn't exist"); + } + + $output = null; + $productImages = $this->getMediaAttributeValues($product); + foreach ((array)$product->getMediaGallery('images') as $image) { + if (intval($image['value_id']) == intval($imageId)) { + $image['types'] = array_keys($productImages, $image['file']); + $output = $this->entryBuilder->populateWithArray($image)->create(); + break; + } + } + + if (is_null($output)) { + throw new NoSuchEntityException("Such image doesn't exist"); + } + return $output; + } + + /** + * {@inheritdoc} + */ + public function getList($productSku) + { + $result = array(); + /** @var \Magento\Catalog\Model\Product $product */ + $product = $this->productRepository->get($productSku); + + /** @var \Magento\Catalog\Api\Data\ProductAttributeInterface $galleryAttribute */ + $galleryAttribute = $this->attributeRepository->get('media_gallery'); + + $container = new \Magento\Framework\Object(array('attribute' => $galleryAttribute)); + $gallery = $this->mediaGallery->loadGallery($product, $container); + + $productImages = $this->getMediaAttributeValues($product); + + foreach ($gallery as $image) { + $this->entryBuilder->setId($image['value_id']); + $this->entryBuilder->setLabel($image['label_default']); + $this->entryBuilder->setTypes(array_keys($productImages, $image['file'])); + $this->entryBuilder->setIsDisabled($image['disabled_default']); + $this->entryBuilder->setPosition($image['position_default']); + $this->entryBuilder->setFile($image['file']); + $result[] = $this->entryBuilder->create(); + } + return $result; + } +} diff --git a/app/code/Magento/Tax/Service/V1/Data/ZipRange.php b/app/code/Magento/Catalog/Model/Product/GroupPrice.php similarity index 66% rename from app/code/Magento/Tax/Service/V1/Data/ZipRange.php rename to app/code/Magento/Catalog/Model/Product/GroupPrice.php index c000f69eb39d7..44e4c6960da34 100644 --- a/app/code/Magento/Tax/Service/V1/Data/ZipRange.php +++ b/app/code/Magento/Catalog/Model/Product/GroupPrice.php @@ -1,5 +1,6 @@ _get(self::KEY_FROM); + return $this->getData('customer_group_id'); } /** - * Get zip range ending point + * Retrieve price value * - * @return int + * @return float */ - public function getTo() + public function getValue() { - return $this->_get(self::KEY_TO); + return $this->getData('value'); } } diff --git a/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php b/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php new file mode 100644 index 0000000000000..d80915c5e8dcc --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/GroupPriceManagement.php @@ -0,0 +1,174 @@ +productRepository = $productRepository; + $this->groupPriceBuilder = $groupPriceBuilder; + $this->groupRepository = $groupRepository; + $this->priceModifier = $priceModifier; + $this->config = $config; + $this->storeManager = $storeManager; + } + + /** + * {@inheritdoc} + */ + public function add($productSku, $customerGroupId, $price) + { + if (!\Zend_Validate::is($price, 'Float') || $price <= 0 || !\Zend_Validate::is($price, 'Float')) { + throw new InputException('Please provide valid data'); + } + $customerGroup = $this->groupRepository->getById($customerGroupId); + $product = $this->productRepository->get($productSku, true); + $groupPrices = $product->getData('group_price'); + $websiteIdentifier = 0; + if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) != 0) { + $websiteIdentifier = $this->storeManager->getWebsite()->getId(); + } + $found = false; + foreach ($groupPrices as &$currentPrice) { + if (intval($currentPrice['cust_group']) === $customerGroupId + && intval($currentPrice['website_id']) === intval($websiteIdentifier) + ) { + $currentPrice['price'] = $price; + $found = true; + break; + } + } + if (!$found) { + $groupPrices[] = array( + 'cust_group' => $customerGroup->getId(), + 'website_id' => $websiteIdentifier, + 'price' => $price, + ); + } + + $product->setData('group_price', $groupPrices); + $errors = $product->validate(); + if (is_array($errors) && count($errors)) { + $errorAttributeCodes = implode(', ', array_keys($errors)); + throw new InputException( + sprintf('Values of following attributes are invalid: %s', $errorAttributeCodes) + ); + } + try { + $this->productRepository->save($product); + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not save group price'); + } + return true; + } + + /** + * {@inheritdoc} + */ + public function remove($productSku, $customerGroupId) + { + $product = $this->productRepository->get($productSku, true); + $websiteIdentifier = 0; + if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) != 0) { + $websiteIdentifier = $this->storeManager->getWebsite()->getId(); + } + $this->priceModifier->removeGroupPrice($product, $customerGroupId, $websiteIdentifier); + return true; + } + + /** + * {@inheritdoc} + */ + public function getList($productSku, $websiteId = null) + { + $product = $this->productRepository->get($productSku, true); + $priceKey = 'website_price'; + if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) == 0) { + $priceKey = 'price'; + } + + $prices = array(); + foreach ($product->getData('group_price') as $price) { + $this->groupPriceBuilder->populateWithArray( + array( + 'customer_group_id' => $price['all_groups'] ? 'all' : $price['cust_group'], + 'value' => $price[$priceKey], + ) + ); + $prices[] = $this->groupPriceBuilder->create(); + } + return $prices; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/LinkTypeProvider.php b/app/code/Magento/Catalog/Model/Product/LinkTypeProvider.php index 82343d5dbac71..ef1797431b7cb 100644 --- a/app/code/Magento/Catalog/Model/Product/LinkTypeProvider.php +++ b/app/code/Magento/Catalog/Model/Product/LinkTypeProvider.php @@ -25,7 +25,7 @@ */ namespace Magento\Catalog\Model\Product; -class LinkTypeProvider +class LinkTypeProvider implements \Magento\Catalog\Api\ProductLinkTypeListInterface { /** * Available product link types @@ -34,14 +34,39 @@ class LinkTypeProvider * * @var array */ - protected $_linkTypes; + protected $linkTypes; /** + * @var \Magento\Catalog\Api\Data\ProductLinkTypeDataBuilder + */ + protected $linkTypeBuilder; + + /** + * @var \Magento\Catalog\Api\Data\ProductLinkAttributeDataBuilder + */ + protected $linkAttributeBuilder; + + /** + * @var \Magento\Catalog\Model\Product\LinkFactory + */ + protected $linkFactory; + + /** + * @param \Magento\Catalog\Api\Data\ProductLinkTypeDataBuilder $linkTypeBuilder + * @param \Magento\Catalog\Api\Data\ProductLinkAttributeDataBuilder $linkAttributeBuilder + * @param LinkFactory $linkFactory * @param array $linkTypes */ - public function __construct(array $linkTypes = array()) - { - $this->_linkTypes = $linkTypes; + public function __construct( + \Magento\Catalog\Api\Data\ProductLinkTypeDataBuilder $linkTypeBuilder, + \Magento\Catalog\Api\Data\ProductLinkAttributeDataBuilder $linkAttributeBuilder, + \Magento\Catalog\Model\Product\LinkFactory $linkFactory, + array $linkTypes = array() + ) { + $this->linkTypes = $linkTypes; + $this->linkTypeBuilder = $linkTypeBuilder; + $this->linkAttributeBuilder = $linkAttributeBuilder; + $this->linkFactory = $linkFactory; } /** @@ -51,6 +76,39 @@ public function __construct(array $linkTypes = array()) */ public function getLinkTypes() { - return $this->_linkTypes; + return $this->linkTypes; + } + + /** + * {@inheritdoc} + */ + public function getItems() + { + $output = []; + foreach ($this->getLinkTypes() as $type => $typeCode) { + $output[] = $this->linkTypeBuilder + ->populateWithArray(['name' => $type, 'code' => $typeCode]) + ->create(); + } + return $output; + } + + /** + * {@inheritdoc} + */ + public function getItemAttributes($type) + { + $output = []; + $types = $this->getLinkTypes(); + $typeId = isset($types[$type]) ? $types[$type] : null; + + /** @var \Magento\Catalog\Model\Product\Link $link */ + $link = $this->linkFactory->create(['data' => ['link_type_id' => $typeId]]); + $attributes = $link->getAttributes(); + foreach ($attributes as $item) { + $data = ['code' => $item['code'], 'type' => $item['type']]; + $output[] = $this->linkAttributeBuilder->populateWithArray($data)->create(); + } + return $output; } } diff --git a/app/code/Magento/Catalog/Model/Product/Media/AttributeManagement.php b/app/code/Magento/Catalog/Model/Product/Media/AttributeManagement.php new file mode 100644 index 0000000000000..dc431da5e19c6 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Media/AttributeManagement.php @@ -0,0 +1,67 @@ +collectionFactory = $collectionFactory; + $this->storeManager = $storeManager; + } + + /** + * {@inheritdoc} + */ + public function getList($attributeSetName) + { + /** @var \Magento\Catalog\Model\Resource\Product\Attribute\Collection $collection */ + $collection = $this->collectionFactory->create(); + $collection->setAttributeSetFilterBySetName($attributeSetName, Product::ENTITY); + $collection->setFrontendInputTypeFilter('media_image'); + $collection->addStoreLabel($this->storeManager->getStore()->getId()); + + return $collection->getItems(); + } +} diff --git a/lib/internal/Magento/Framework/Module/Declaration/FileIterator.php b/app/code/Magento/Catalog/Model/Product/Media/GalleryEntryContent.php similarity index 64% rename from lib/internal/Magento/Framework/Module/Declaration/FileIterator.php rename to app/code/Magento/Catalog/Model/Product/Media/GalleryEntryContent.php index e89dc8393a9dd..1aed3f160339d 100644 --- a/lib/internal/Magento/Framework/Module/Declaration/FileIterator.php +++ b/app/code/Magento/Catalog/Model/Product/Media/GalleryEntryContent.php @@ -1,5 +1,6 @@ getData(self::DATA); + } + + /** + * {@inheritdoc} + */ + public function getMimeType() + { + return $this->getData(self::MIME_TYPE); + } + + /** + * {@inheritdoc} */ - public function __construct(Filesystem $filesystem, array $paths) + public function getName() { - parent::__construct($filesystem->getDirectoryRead(DirectoryList::APP), $paths); + return $this->getData(self::NAME); } } diff --git a/app/code/Magento/Catalog/Model/Product/Option.php b/app/code/Magento/Catalog/Model/Product/Option.php index dc3b95fb27cd7..51b419a5abb0c 100644 --- a/app/code/Magento/Catalog/Model/Product/Option.php +++ b/app/code/Magento/Catalog/Model/Product/Option.php @@ -28,6 +28,8 @@ use Magento\Catalog\Pricing\Price\BasePrice; use Magento\Framework\Model\Exception; use Magento\Framework\Model\AbstractModel; +use \Magento\Framework\Model\AbstractExtensibleModel; +use \Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface; /** * Catalog product option model @@ -35,28 +37,10 @@ * @method \Magento\Catalog\Model\Resource\Product\Option getResource() * @method int getProductId() * @method \Magento\Catalog\Model\Product\Option setProductId(int $value) - * @method string getType() - * @method \Magento\Catalog\Model\Product\Option setType(string $value) - * @method string getTitle() - * @method \Magento\Catalog\Model\Product\Option seTitle(string $value) - * @method int getIsRequire() - * @method \Magento\Catalog\Model\Product\Option setIsRequire(int $value) - * @method string getSku() - * @method \Magento\Catalog\Model\Product\Option setSku(string $value) - * @method int getMaxCharacters() - * @method \Magento\Catalog\Model\Product\Option setMaxCharacters(int $value) - * @method string getFileExtension() - * @method \Magento\Catalog\Model\Product\Option setFileExtension(string $value) - * @method int getImageSizeX() - * @method \Magento\Catalog\Model\Product\Option setImageSizeX(int $value) - * @method int getImageSizeY() - * @method \Magento\Catalog\Model\Product\Option setImageSizeY(int $value) - * @method int getSortOrder() - * @method \Magento\Catalog\Model\Product\Option setSortOrder(int $value) * * @author Magento Core Team */ -class Option extends AbstractModel +class Option extends AbstractExtensibleModel implements \Magento\Catalog\Api\Data\ProductCustomOptionInterface { const OPTION_GROUP_TEXT = 'text'; @@ -128,6 +112,7 @@ class Option extends AbstractModel /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry + * @param \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService * @param Option\Value $productOptionValue * @param Option\Type\Factory $optionFactory * @param \Magento\Framework\Stdlib\String $string @@ -139,6 +124,7 @@ class Option extends AbstractModel public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, + \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService, Option\Value $productOptionValue, \Magento\Catalog\Model\Product\Option\Type\Factory $optionFactory, \Magento\Framework\Stdlib\String $string, @@ -151,7 +137,7 @@ public function __construct( $this->_optionFactory = $optionFactory; $this->validatorPool = $validatorPool; $this->string = $string; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $metadataService, $resource, $resourceCollection, $data); } /** @@ -201,7 +187,7 @@ public function getValueById($valueId) } /** - * @return Option\Value[] + * @return ProductCustomOptionValuesInterface[]|null */ public function getValues() { @@ -414,7 +400,7 @@ public function saveOptions() * @return AbstractModel * @throws \Magento\Framework\Model\Exception */ - protected function _afterSave() + public function afterSave() { $this->getValueInstance()->unsetValues(); if (is_array($this->getData('values'))) { @@ -427,7 +413,7 @@ protected function _afterSave() throw new Exception(__('Select type options required values rows.')); } - return parent::_afterSave(); + return parent::afterSave(); } /** @@ -588,4 +574,121 @@ protected function _getValidationRulesBeforeSave() { return $this->validatorPool->get($this->getType()); } + + /** + * Get product SKU + * + * @return string + */ + public function getProductSku() + { + $productSku = $this->_getData('product_sku'); + if (!$productSku) { + $productSku = $this->getProduct()->getSku(); + } + return $productSku; + } + + /** + * Get option id + * + * @return int|null + */ + public function getOptionId() + { + return $this->_getData('option_id'); + } + + + /** + * Get option title + * + * @return string + */ + public function getTitle() + { + return $this->_getData('title'); + } + + /** + * Get option type + * + * @return string + */ + public function getType() + { + return $this->_getData('type'); + } + + /** + * Get sort order + * + * @return int + */ + public function getSortOrder() + { + return $this->_getData('sort_order'); + } + + /** + * Get is require + * + * @return bool + */ + public function getIsRequire() + { + return $this->_getData('is_require'); + } + + /** + * Get price type + * + * @return string|null + */ + public function getPriceType() + { + return $this->_getData('price_type'); + } + + /** + * Get Sku + * + * @return string|null + */ + public function getSku() + { + return $this->_getData('sku'); + } + + /** + * @return string|null + */ + public function getFileExtension() + { + return $this->getData('file_extension'); + } + + /** + * @return int|null + */ + public function getMaxCharacters() + { + return $this->getData('max_characters'); + } + + /** + * @return int|null + */ + public function getImageSizeX() + { + return $this->getData('image_size_x'); + } + + /** + * @return int|null + */ + public function getImageSizeY() + { + return $this->getData('image_size_y'); + } } diff --git a/app/code/Magento/Sales/Service/V1/Action/OrderGet.php b/app/code/Magento/Catalog/Model/Product/Option/Converter.php similarity index 52% rename from app/code/Magento/Sales/Service/V1/Action/OrderGet.php rename to app/code/Magento/Catalog/Model/Product/Option/Converter.php index 19d133bff9d79..6933e288548ab 100644 --- a/app/code/Magento/Sales/Service/V1/Action/OrderGet.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Converter.php @@ -1,5 +1,6 @@ orderRepository = $orderRepository; - $this->orderMapper = $orderMapper; + $this->productRepository = $productRepository; } + /** - * Invoke getOrder service - * - * @param int $id - * @return \Magento\Sales\Service\V1\Data\Order - * @throws \Magento\Framework\Exception\NoSuchEntityException + * Convert option data to array + * @param \Magento\Catalog\Api\Data\ProductCustomOptionInterface $option + * @return array */ - public function invoke($id) + public function toArray(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $option) { - return $this->orderMapper->extractDto($this->orderRepository->get($id)); + $optionData = $option->getData(); + $values = $option->getData('values'); + $valuesData = []; + if (!empty($values)) { + foreach ($values as $key => $value) { + $valuesData[$key] = $value->getData(); + } + } + $optionData['values'] = $valuesData; + return $optionData; } } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Repository.php b/app/code/Magento/Catalog/Model/Product/Option/Repository.php new file mode 100644 index 0000000000000..ccdde906022a6 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Option/Repository.php @@ -0,0 +1,186 @@ +productRepository = $productRepository; + $this->optionResource = $optionResource; + $this->converter = $converter; + } + + /** + * {@inheritdoc} + */ + public function getList($productSku) + { + $product = $this->productRepository->get($productSku, true); + return $product->getOptions(); + } + + /** + * {@inheritdoc} + */ + public function get($productSku, $optionId) + { + $product = $this->productRepository->get($productSku); + $option = $product->getOptionById($optionId); + if (is_null($option)) { + throw NoSuchEntityException::singleField('optionId', $optionId); + } + return $option; + } + + /** + * {@inheritdoc} + */ + public function delete(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $entity) + { + $this->optionResource->delete($entity); + return true; + } + + /** + * {@inheritdoc} + */ + public function save(\Magento\Catalog\Api\Data\ProductCustomOptionInterface $option) + { + $productSku = $option->getProductSku(); + $product = $this->productRepository->get($productSku, true); + $optionData = $this->converter->toArray($option); + if ($option->getOptionId()) { + if (!$product->getOptionById($option->getOptionId())) { + throw new NoSuchEntityException(); + } + $originalValues = $product->getOptionById($option->getOptionId())->getValues(); + if (!empty($optionData['values'])) { + $optionData['values'] = $this->markRemovedValues($optionData['values'], $originalValues); + } + } + + unset($optionData['product_sku']); + + $product->setProductOptions([$optionData]); + $existingOptions = $product->getOptions(); + try { + $this->productRepository->save($product, true); + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not save product option'); + } + + $product = $this->productRepository->get($productSku, true); + if (!$option->getOptionId()) { + $currentOptions = $product->getOptions(); + + $newID = array_diff(array_keys($currentOptions), array_keys($existingOptions)); + if (empty($newID)) { + throw new CouldNotSaveException('Could not save product option'); + } + $newID = current($newID); + } else { + $newID = $option->getOptionId(); + } + $option = $this->get($productSku, $newID); + return $option; + } + + /** + * {@inheritdoc} + */ + public function deleteByIdentifier($productSku, $optionId) + { + $product = $this->productRepository->get($productSku, true); + $options = $product->getOptions(); + $option = $product->getOptionById($optionId); + if (is_null($option)) { + throw NoSuchEntityException::singleField('optionId', $optionId); + } + unset($options[$optionId]); + try { + $this->delete($option); + if (empty($options)) { + $this->productRepository->save($product); + } + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not remove custom option'); + } + return true; + } + + /** + * Mark original values for removal if they are absent among new values + * + * @param $newValues array + * @param $originalValues \Magento\Catalog\Model\Product\Option\Value[] + * @return array + */ + protected function markRemovedValues($newValues, $originalValues) + { + $existingValuesIds = []; + + foreach ($newValues as $newValue) { + if (array_key_exists('option_type_id', $newValue)) { + $existingValuesIds[] = $newValue['option_type_id']; + } + } + /** @var $originalValue \Magento\Catalog\Model\Product\Option\Value */ + foreach ($originalValues as $originalValue) { + if (!in_array($originalValue->getData('option_type_id'), $existingValuesIds)) { + $originalValue->setData('is_delete', 1); + $newValues[] = $originalValue->getData(); + } + } + + return $newValues; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type.php b/app/code/Magento/Catalog/Model/Product/Option/Type.php new file mode 100644 index 0000000000000..d0552f8cf02bb --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Option/Type.php @@ -0,0 +1,59 @@ +getData('label'); + } + + /** + * Get option type code + * + * @return string + */ + public function getCode() + { + return $this->getData('code'); + } + + /** + * Get option type group + * + * @return string + */ + public function getGroup() + { + return $this->getData('group'); + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php index 092edb9b2936a..30359358e38b4 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Type/File.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File.php @@ -45,47 +45,11 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ protected $_formattedOptionValue = null; - /** - * @var \Magento\Framework\Filesystem - */ - protected $_filesystem; - /** * @var \Magento\Framework\Filesystem\Directory\ReadInterface */ protected $_rootDirectory; - /** - * @var \Magento\Framework\Filesystem\Directory\WriteInterface - */ - protected $_mediaDirectory; - - /** - * Relative path for main destination folder - * - * @var string - */ - protected $_path = '/custom_options'; - - /** - * Relative path for quote folder - * - * @var string - */ - protected $_quotePath = '/custom_options/quote'; - - /** - * Relative path for order folder - * - * @var string - */ - protected $_orderPath = '/custom_options/order'; - - /** - * @var \Magento\Framework\File\Size - */ - protected $_fileSize; - /** * Core file storage database * @@ -112,6 +76,16 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType */ protected $_itemOptionFactory; + /** + * @var File\ValidatorInfo + */ + protected $validatorInfo; + + /** + * @var File\ValidatorFile + */ + protected $validatorFile; + /** * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig @@ -119,30 +93,28 @@ class File extends \Magento\Catalog\Model\Product\Option\Type\DefaultType * @param \Magento\Catalog\Model\Product\Option\UrlBuilder $urlBuilder * @param \Magento\Framework\Escaper $escaper * @param \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase - * @param \Magento\Framework\Filesystem $filesystem - * @param \Magento\Framework\File\Size $fileSize + * @param File\ValidatorInfo $validatorInfo + * @param File\ValidatorFile $validatorFile * @param array $data + * @throws \Magento\Framework\Filesystem\FilesystemException */ public function __construct( \Magento\Checkout\Model\Session $checkoutSession, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Sales\Model\Quote\Item\OptionFactory $itemOptionFactory, + \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, + \Magento\Catalog\Model\Product\Option\Type\File\ValidatorInfo $validatorInfo, + \Magento\Catalog\Model\Product\Option\Type\File\ValidatorFile $validatorFile, \Magento\Catalog\Model\Product\Option\UrlBuilder $urlBuilder, \Magento\Framework\Escaper $escaper, - \Magento\Core\Helper\File\Storage\Database $coreFileStorageDatabase, - \Magento\Framework\Filesystem $filesystem, - \Magento\Framework\File\Size $fileSize, array $data = array() ) { $this->_itemOptionFactory = $itemOptionFactory; $this->_urlBuilder = $urlBuilder; $this->_escaper = $escaper; $this->_coreFileStorageDatabase = $coreFileStorageDatabase; - $this->_filesystem = $filesystem; - $this->_rootDirectory = $this->_filesystem->getDirectoryRead(DirectoryList::ROOT); - $this->_mediaDirectory = $this->_filesystem->getDirectoryWrite(DirectoryList::MEDIA); - $this->_fileSize = $fileSize; - $this->_data = $data; + $this->validatorInfo = $validatorInfo; + $this->validatorFile = $validatorFile; parent::__construct($checkoutSession, $scopeConfig, $data); } @@ -250,22 +222,42 @@ public function validateUserValue($values) $fileInfo = $this->_getCurrentConfigFileInfo(); } if ($fileInfo !== null) { - if (is_array($fileInfo) && $this->_validateFile($fileInfo)) { - $value = $fileInfo; - } else { - $value = null; + try { + $value = $this->validatorInfo->setUseQuotePath($this->getUseQuotePath()) + ->validate($fileInfo, $option) ? $fileInfo : null; + $this->setUserValue($value); + return $this; + } catch (Exception $exception) { + $this->setIsValid(false); + throw $exception; } - $this->setUserValue($value); - return $this; } // Process new uploaded file try { - $this->_validateUploadedFile(); + $value = $this->validatorFile->setProduct($this->getProduct()) + ->validate($this->_getProcessingParams(), $option); + $this->setUserValue($value); + } catch (File\LargeSizeException $largeSizeException) { + $this->setIsValid(false); + throw new Exception($largeSizeException->getMessage()); + } catch (File\OptionRequiredException $e) { + switch ($this->getProcessMode()) { + case \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL: + throw new Exception(__('Please specify the product\'s required option(s).')); + break; + default: + $this->setUserValue(null); + break; + } + } catch (File\RunValidationException $e) { + $this->setUserValue(null); + } catch (File\Exception $e) { + $this->setIsValid(false); + throw new Exception($e->getMessage()); } catch (\Exception $e) { if ($this->getSkipCheckRequiredOption()) { $this->setUserValue(null); - return $this; } else { throw new Exception($e->getMessage()); } @@ -273,295 +265,6 @@ public function validateUserValue($values) return $this; } - /** - * Validate uploaded file - * - * @return $this - * @throws \Magento\Framework\Model\Exception - */ - protected function _validateUploadedFile() - { - $option = $this->getOption(); - $processingParams = $this->_getProcessingParams(); - - /** - * Upload init - */ - $upload = new \Zend_File_Transfer_Adapter_Http(); - $file = $processingParams->getFilesPrefix() . 'options_' . $option->getId() . '_file'; - $maxFileSize = $this->getFileSizeService()->getMaxFileSize(); - try { - $runValidation = $option->getIsRequire() || $upload->isUploaded($file); - if (!$runValidation) { - $this->setUserValue(null); - return $this; - } - - $fileInfo = $upload->getFileInfo($file); - $fileInfo = $fileInfo[$file]; - $fileInfo['title'] = $fileInfo['name']; - } catch (\Exception $e) { - // when file exceeds the upload_max_filesize, $_FILES is empty - if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > $maxFileSize) { - $this->setIsValid(false); - $value = $this->getFileSizeService()->getMaxFileSizeInMb(); - throw new Exception(__("The file you uploaded is larger than %1 Megabytes allowed by server", $value)); - } else { - switch ($this->getProcessMode()) { - case \Magento\Catalog\Model\Product\Type\AbstractType::PROCESS_MODE_FULL: - throw new Exception(__('Please specify the product\'s required option(s).')); - break; - default: - $this->setUserValue(null); - break; - } - return $this; - } - } - - /** - * Option Validations - */ - - // Image dimensions - $_dimentions = array(); - if ($option->getImageSizeX() > 0) { - $_dimentions['maxwidth'] = $option->getImageSizeX(); - } - if ($option->getImageSizeY() > 0) { - $_dimentions['maxheight'] = $option->getImageSizeY(); - } - if (count($_dimentions) > 0) { - $upload->addValidator('ImageSize', false, $_dimentions); - } - - // File extension - $_allowed = $this->_parseExtensionsString($option->getFileExtension()); - if ($_allowed !== null) { - $upload->addValidator('Extension', false, $_allowed); - } else { - $_forbidden = $this->_parseExtensionsString($this->getConfigData('forbidden_extensions')); - if ($_forbidden !== null) { - $upload->addValidator('ExcludeExtension', false, $_forbidden); - } - } - - // Maximum filesize - $upload->addValidator('FilesSize', false, array('max' => $maxFileSize)); - - /** - * Upload process - */ - - $this->_initFilesystem(); - - if ($upload->isUploaded($file) && $upload->isValid($file)) { - - $extension = pathinfo(strtolower($fileInfo['name']), PATHINFO_EXTENSION); - - $fileName = \Magento\Core\Model\File\Uploader::getCorrectFileName($fileInfo['name']); - $dispersion = \Magento\Core\Model\File\Uploader::getDispretionPath($fileName); - - $filePath = $dispersion; - - $tmpDirectory = $this->_filesystem->getDirectoryRead(DirectoryList::SYS_TMP); - $fileHash = md5($tmpDirectory->readFile($tmpDirectory->getRelativePath($fileInfo['tmp_name']))); - $filePath .= '/' . $fileHash . '.' . $extension; - $fileFullPath = $this->_mediaDirectory->getAbsolutePath($this->_quotePath . $filePath); - - $upload->addFilter('Rename', array('target' => $fileFullPath, 'overwrite' => true)); - - $this->getProduct()->getTypeInstance()->addFileQueue( - array( - 'operation' => 'receive_uploaded_file', - 'src_name' => $file, - 'dst_name' => $fileFullPath, - 'uploader' => $upload, - 'option' => $this - ) - ); - - $_width = 0; - $_height = 0; - - if ($tmpDirectory->isReadable($tmpDirectory->getRelativePath($fileInfo['tmp_name']))) { - $_imageSize = getimagesize($fileInfo['tmp_name']); - if ($_imageSize) { - $_width = $_imageSize[0]; - $_height = $_imageSize[1]; - } - } - $uri = $this->_filesystem->getUri(DirectoryList::MEDIA); - $this->setUserValue( - array( - 'type' => $fileInfo['type'], - 'title' => $fileInfo['name'], - 'quote_path' => $uri . $this->_quotePath . $filePath, - 'order_path' => $uri . $this->_orderPath . $filePath, - 'fullpath' => $fileFullPath, - 'size' => $fileInfo['size'], - 'width' => $_width, - 'height' => $_height, - 'secret_key' => substr($fileHash, 0, 20) - ) - ); - } elseif ($upload->getErrors()) { - $errors = $this->_getValidatorErrors($upload->getErrors(), $fileInfo); - - if (count($errors) > 0) { - $this->setIsValid(false); - throw new Exception(implode("\n", $errors)); - } - } else { - $this->setIsValid(false); - throw new Exception(__('Please specify the product\'s required option(s).')); - } - return $this; - } - - /** - * Validate file - * - * @param array $optionValue - * @return bool|void - * @throws \Magento\Framework\Model\Exception - */ - protected function _validateFile($optionValue) - { - $option = $this->getOption(); - /** - * @see \Magento\Catalog\Model\Product\Option\Type\File::_validateUploadFile() - * There setUserValue() sets correct fileFullPath only for - * quote_path. So we must form both full paths manually and - * check them. - */ - $checkPaths = array(); - if (isset($optionValue['quote_path'])) { - $checkPaths[] = $optionValue['quote_path']; - } - if (isset($optionValue['order_path']) && !$this->getUseQuotePath()) { - $checkPaths[] = $optionValue['order_path']; - } - $fileFullPath = null; - $fileRelativePath = null; - foreach ($checkPaths as $path) { - if (!$this->_rootDirectory->isFile($path)) { - if (!$this->_coreFileStorageDatabase->saveFileToFilesystem($fileFullPath)) { - continue; - } - } - $fileFullPath = $this->_rootDirectory->getAbsolutePath($path); - $fileRelativePath = $path; - break; - } - - if ($fileFullPath === null) { - return false; - } - - $validatorChain = new \Zend_Validate(); - - $_dimentions = array(); - - if ($option->getImageSizeX() > 0) { - $_dimentions['maxwidth'] = $option->getImageSizeX(); - } - if ($option->getImageSizeY() > 0) { - $_dimentions['maxheight'] = $option->getImageSizeY(); - } - if (count($_dimentions) > 0 && !$this->_isImage($fileFullPath)) { - return false; - } - if (count($_dimentions) > 0) { - $validatorChain->addValidator(new \Zend_Validate_File_ImageSize($_dimentions)); - } - - // File extension - $_allowed = $this->_parseExtensionsString($option->getFileExtension()); - if ($_allowed !== null) { - $validatorChain->addValidator(new \Zend_Validate_File_Extension($_allowed)); - } else { - $_forbidden = $this->_parseExtensionsString($this->getConfigData('forbidden_extensions')); - if ($_forbidden !== null) { - $validatorChain->addValidator(new \Zend_Validate_File_ExcludeExtension($_forbidden)); - } - } - - // Maximum file size - $maxFileSize = $this->getFileSizeService()->getMaxFileSize(); - $validatorChain->addValidator(new \Zend_Validate_File_FilesSize(array('max' => $maxFileSize))); - - - if ($validatorChain->isValid($fileFullPath)) { - $ok = $this->_rootDirectory->isReadable( - $fileRelativePath - ) && isset( - $optionValue['secret_key'] - ) && substr( - md5($this->_rootDirectory->readFile($fileRelativePath)), - 0, - 20 - ) == $optionValue['secret_key']; - - return $ok; - } elseif ($validatorChain->getErrors()) { - $errors = $this->_getValidatorErrors($validatorChain->getErrors(), $optionValue); - - if (count($errors) > 0) { - $this->setIsValid(false); - throw new Exception(implode("\n", $errors)); - } - } else { - $this->setIsValid(false); - throw new Exception(__('Please specify the product\'s required option(s).')); - } - } - - /** - * Get Error messages for validator Errors - * - * @param string[] $errors Array of validation failure message codes @see \Zend_Validate::getErrors() - * @param array $fileInfo File info - * @return string[] Array of error messages - */ - protected function _getValidatorErrors($errors, $fileInfo) - { - $option = $this->getOption(); - $result = array(); - foreach ($errors as $errorCode) { - if ($errorCode == \Zend_Validate_File_ExcludeExtension::FALSE_EXTENSION) { - $result[] = __( - "The file '%1' for '%2' has an invalid extension.", - $fileInfo['title'], - $option->getTitle() - ); - } elseif ($errorCode == \Zend_Validate_File_Extension::FALSE_EXTENSION) { - $result[] = __( - "The file '%1' for '%2' has an invalid extension.", - $fileInfo['title'], - $option->getTitle() - ); - } elseif ($errorCode == \Zend_Validate_File_ImageSize::WIDTH_TOO_BIG || - $errorCode == \Zend_Validate_File_ImageSize::HEIGHT_TOO_BIG - ) { - $result[] = __( - "Maximum allowed image size for '%1' is %2x%3 px.", - $option->getTitle(), - $option->getImageSizeX(), - $option->getImageSizeY() - ); - } elseif ($errorCode == \Zend_Validate_File_FilesSize::TOO_BIG) { - $maxFileSize = $this->getFileSizeService()->getMaxFileSizeInMb(); - $result[] = __( - "The file '%1' you uploaded is larger than the %2 megabytes allowed by our server.", - $fileInfo['title'], - $maxFileSize - ); - } - } - return $result; - } - /** * Prepare option value for cart * @@ -641,18 +344,7 @@ protected function _getOptionHtml($optionValue) { $value = $this->_unserializeValue($optionValue); try { - if (isset( - $value - ) && isset( - $value['width'] - ) && isset( - $value['height'] - ) && $value['width'] > 0 && $value['height'] > 0 - ) { - $sizes = $value['width'] . ' x ' . $value['height'] . ' ' . __('px.'); - } else { - $sizes = ''; - } + $sizes = $this->prepareSize($value); $urlRoute = !empty($value['url']['route']) ? $value['url']['route'] : ''; $urlParams = !empty($value['url']['params']) ? $value['url']['params'] : ''; @@ -798,24 +490,6 @@ public function setCustomOptionDownloadUrl($url) return $this; } - /** - * Directory structure initializing - * - * @return void - */ - protected function _initFilesystem() - { - $this->_mediaDirectory->create($this->_path); - $this->_mediaDirectory->create($this->_quotePath); - $this->_mediaDirectory->create($this->_orderPath); - - // Directory listing and hotlink secure - $path = $this->_path . '/.htaccess'; - if (!$this->_mediaDirectory->isFile($path)) { - $this->_mediaDirectory->writeFile($path, "Order deny,allow\nDeny from all"); - } - } - /** * Return URL for option file download * @@ -829,51 +503,16 @@ protected function _getOptionDownloadUrl($route, $params) } /** - * Parse file extensions string with various separators - * - * @param string $extensions String to parse - * @return array|null - */ - protected function _parseExtensionsString($extensions) - { - preg_match_all('/[a-z0-9]+/si', strtolower($extensions), $matches); - if (isset($matches[0]) && is_array($matches[0]) && count($matches[0]) > 0) { - return $matches[0]; - } - return null; - } - - /** - * Simple check if file is image - * - * @param array|string $fileInfo - either file data from \Zend_File_Transfer or file path - * @return boolean + * @param array $value + * @return string */ - protected function _isImage($fileInfo) + protected function prepareSize($value) { - // Maybe array with file info came in - if (is_array($fileInfo)) { - return strstr($fileInfo['type'], 'image/'); - } - - // File path came in - check the physical file - if (!$this->_rootDirectory->isReadable($this->_rootDirectory->getRelativePath($fileInfo))) { - return false; + $sizes = ''; + if (!empty($value['width']) && !empty($value['height']) && $value['width'] > 0 && $value['height'] > 0) { + $sizes = $value['width'] . ' x ' . $value['height'] . ' ' . __('px.'); + return array($value, $sizes); } - $imageInfo = getimagesize($fileInfo); - if (!$imageInfo) { - return false; - } - return true; - } - - /** - * Get file storage helper - * - * @return \Magento\Framework\File\Size - */ - public function getFileSizeService() - { - return $this->_fileSize; + return $sizes; } } diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/Exception.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/Exception.php new file mode 100644 index 0000000000000..914b6f1e13f30 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/Exception.php @@ -0,0 +1,29 @@ +scopeConfig = $scopeConfig; + $this->rootDirectory = $filesystem->getDirectoryRead(DirectoryList::ROOT); + $this->fileSize = $fileSize; + } + + /** + * Store Config value + * + * @param string $key Config value key + * @return string + */ + protected function getConfigData($key) + { + return $this->scopeConfig->getValue( + 'catalog/custom_options/' . $key, + \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ); + } + + /** + * Get Error messages for validator Errors + * + * @param string[] $errors Array of validation failure message codes @see \Zend_Validate::getErrors() + * @param array $fileInfo File info + * @param \Magento\Catalog\Model\Product\Option $option + * @return string[] Array of error messages + * @see \Magento\Catalog\Model\Product\Option\Type\File::_getValidatorErrors + */ + protected function getValidatorErrors($errors, $fileInfo, $option) + { + $result = array(); + foreach ($errors as $errorCode) { + switch($errorCode) { + case \Zend_Validate_File_ExcludeExtension::FALSE_EXTENSION: + $result[] = __( + "The file '%1' for '%2' has an invalid extension.", + $fileInfo['title'], + $option->getTitle() + ); + break; + case \Zend_Validate_File_Extension::FALSE_EXTENSION: + $result[] = __( + "The file '%1' for '%2' has an invalid extension.", + $fileInfo['title'], + $option->getTitle() + ); + break; + case \Zend_Validate_File_ImageSize::WIDTH_TOO_BIG: + case \Zend_Validate_File_ImageSize::HEIGHT_TOO_BIG: + $result[] = __( + "Maximum allowed image size for '%1' is %2x%3 px.", + $option->getTitle(), + $option->getImageSizeX(), + $option->getImageSizeY() + ); + break; + case \Zend_Validate_File_FilesSize::TOO_BIG: + $result[] = __( + "The file '%1' you uploaded is larger than the %2 megabytes allowed by our server.", + $fileInfo['title'], + $this->fileSize->getMaxFileSizeInMb() + ); + break; + } + } + return $result; + } + + /** + * Parse file extensions string with various separators + * + * @param string $extensions String to parse + * @return array|null + * @see \Magento\Catalog\Model\Product\Option\Type\File::_parseExtensionsString + */ + protected function parseExtensionsString($extensions) + { + if (preg_match_all('/(?[a-z0-9]+)/si', strtolower($extensions), $matches)) { + return $matches['extension'] ?: null; + } + return null; + } + + /** + * @param \Zend_File_Transfer_Adapter_Http|\Zend_Validate $object + * @param \Magento\Catalog\Model\Product\Option $option + * @param array $fileFullPath + * @return \Zend_File_Transfer_Adapter_Http|\Zend_Validate $object + * @throws NotImageException + */ + protected function buildImageValidator($object, $option, $fileFullPath = null) + { + $dimensions = array(); + + if ($option->getImageSizeX() > 0) { + $dimensions['maxwidth'] = $option->getImageSizeX(); + } + if ($option->getImageSizeY() > 0) { + $dimensions['maxheight'] = $option->getImageSizeY(); + } + if (count($dimensions) > 0) { + if (!is_null($fileFullPath) && !$this->isImage($fileFullPath)) { + throw new NotImageException(); + } + $object->addValidator(new \Zend_Validate_File_ImageSize($dimensions)); + } + + // File extension + $allowed = $this->parseExtensionsString($option->getFileExtension()); + if ($allowed !== null) { + $object->addValidator(new \Zend_Validate_File_Extension($allowed)); + } else { + $forbidden = $this->parseExtensionsString($this->getConfigData('forbidden_extensions')); + if ($forbidden !== null) { + $object->addValidator(new \Zend_Validate_File_ExcludeExtension($forbidden)); + } + } + + $object->addValidator( + new \Zend_Validate_File_FilesSize(array('max' => $this->fileSize->getMaxFileSize())) + ); + return $object; + } + + /** + * Simple check if file is image + * + * @param array|string $fileInfo - either file data from \Zend_File_Transfer or file path + * @return boolean + * @see \Magento\Catalog\Model\Product\Option\Type\File::_isImage + */ + protected function isImage($fileInfo) + { + // Maybe array with file info came in + if (is_array($fileInfo)) { + return strstr($fileInfo['type'], 'image/'); + } + + // File path came in - check the physical file + if (!$this->rootDirectory->isReadable($this->rootDirectory->getRelativePath($fileInfo))) { + return false; + } + $imageInfo = getimagesize($fileInfo); + if (!$imageInfo) { + return false; + } + return true; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php new file mode 100644 index 0000000000000..e8c5818d9ae16 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorFile.php @@ -0,0 +1,236 @@ +mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); + $this->filesystem = $filesystem; + $this->httpFactory = $httpFactory; + parent::__construct($scopeConfig, $filesystem, $fileSize); + } + + /** + * @param Product $product + * @return $this + */ + public function setProduct(Product $product) + { + $this->product = $product; + return $this; + } + + /** + * @param \Magento\Framework\Object $processingParams + * @param \Magento\Catalog\Model\Product\Option $option + * @return array + * @throws \Magento\Framework\Model\Exception + * @throws \Zend_File_Transfer_Exception + */ + public function validate($processingParams, $option) + { + $upload = $this->httpFactory->create(); + $file = $processingParams->getFilesPrefix() . 'options_' . $option->getId() . '_file'; + try { + $runValidation = $option->getIsRequire() || $upload->isUploaded($file); + if (!$runValidation) { + throw new RunValidationException(); + } + + $fileInfo = $upload->getFileInfo($file)[$file]; + $fileInfo['title'] = $fileInfo['name']; + } catch (RunValidationException $r) { + throw $r; + } catch (\Exception $e) { + // when file exceeds the upload_max_filesize, $_FILES is empty + if ($this->validateContentLength()) { + $value = $this->fileSize->getMaxFileSizeInMb(); + throw new LargeSizeException( + __("The file you uploaded is larger than %1 Megabytes allowed by server", $value) + ); + } else { + throw new OptionRequiredException(); + } + } + + /** + * Option Validations + */ + $upload = $this->buildImageValidator($upload, $option); + + /** + * Upload process + */ + $this->initFilesystem(); + $userValue = array(); + + if ($upload->isUploaded($file) && $upload->isValid($file)) { + + $extension = pathinfo(strtolower($fileInfo['name']), PATHINFO_EXTENSION); + + $fileName = \Magento\Core\Model\File\Uploader::getCorrectFileName($fileInfo['name']); + $dispersion = \Magento\Core\Model\File\Uploader::getDispretionPath($fileName); + + $filePath = $dispersion; + + $tmpDirectory = $this->filesystem->getDirectoryRead(DirectoryList::SYS_TMP); + $fileHash = md5($tmpDirectory->readFile($tmpDirectory->getRelativePath($fileInfo['tmp_name']))); + $filePath .= '/' . $fileHash . '.' . $extension; + $fileFullPath = $this->mediaDirectory->getAbsolutePath($this->quotePath . $filePath); + + $upload->addFilter(new \Zend_Filter_File_Rename(array('target' => $fileFullPath, 'overwrite' => true))); + + // TODO: I don't know how change this + if (!is_null($this->product)) { + $this->product->getTypeInstance()->addFileQueue( + array( + 'operation' => 'receive_uploaded_file', + 'src_name' => $file, + 'dst_name' => $fileFullPath, + 'uploader' => $upload, + 'option' => $this + ) + ); + } + + $_width = 0; + $_height = 0; + + if ($tmpDirectory->isReadable($tmpDirectory->getRelativePath($fileInfo['tmp_name']))) { + $imageSize = getimagesize($fileInfo['tmp_name']); + if ($imageSize) { + $_width = $imageSize[0]; + $_height = $imageSize[1]; + } + } + $uri = $this->filesystem->getUri(DirectoryList::MEDIA); + $userValue = array( + 'type' => $fileInfo['type'], + 'title' => $fileInfo['name'], + 'quote_path' => $uri . $this->quotePath . $filePath, + 'order_path' => $uri . $this->orderPath . $filePath, + 'fullpath' => $fileFullPath, + 'size' => $fileInfo['size'], + 'width' => $_width, + 'height' => $_height, + 'secret_key' => substr($fileHash, 0, 20) + ); + } elseif ($upload->getErrors()) { + $errors = $this->getValidatorErrors($upload->getErrors(), $fileInfo, $option); + + if (count($errors) > 0) { + throw new Exception(implode("\n", $errors)); + } + } else { + throw new Exception(__('Please specify the product\'s required option(s).')); + } + return $userValue; + } + + /** + * Directory structure initializing + * + * @return void + * @see \Magento\Catalog\Model\Product\Option\Type\File::_initFilesystem + */ + protected function initFilesystem() + { + $this->mediaDirectory->create($this->path); + $this->mediaDirectory->create($this->quotePath); + $this->mediaDirectory->create($this->orderPath); + + // Directory listing and hotlink secure + $path = $this->path . '/.htaccess'; + if (!$this->mediaDirectory->isFile($path)) { + $this->mediaDirectory->writeFile($path, "Order deny,allow\nDeny from all"); + } + } + + /** + * @return bool + * @todo need correctly name + */ + protected function validateContentLength() + { + return isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > $this->fileSize->getMaxFileSize(); + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php new file mode 100644 index 0000000000000..095fe67f4d459 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/Option/Type/File/ValidatorInfo.php @@ -0,0 +1,168 @@ +coreFileStorageDatabase = $coreFileStorageDatabase; + $this->validateFactory = $validateFactory; + parent::__construct($scopeConfig, $filesystem, $fileSize); + } + + /** + * @param mixed $useQuotePath + * @return $this + */ + public function setUseQuotePath($useQuotePath) + { + $this->useQuotePath = $useQuotePath; + return $this; + } + + /** + * @param array $optionValue + * @param \Magento\Catalog\Model\Product\Option $option + * @return bool + * @throws \Magento\Framework\Model\Exception + */ + public function validate($optionValue, $option) + { + if (!is_array($optionValue)) { + return false; + } + + $this->fileFullPath = null; + $this->fileRelativePath = null; + $this->initFilePath($optionValue); + + if ($this->fileFullPath === null) { + return false; + } + + $validatorChain = $this->validateFactory->create(); + try { + $validatorChain = $this->buildImageValidator($validatorChain, $option, $this->fileFullPath); + } catch (NotImageException $notImage) { + return false; + } + + $result = false; + if ($validatorChain->isValid($this->fileFullPath)) { + $result = $this->rootDirectory->isReadable($this->fileRelativePath) + && isset($optionValue['secret_key']) + && $this->buildSecretKey($this->fileRelativePath) == $optionValue['secret_key']; + + } elseif ($validatorChain->getErrors()) { + $errors = $this->getValidatorErrors($validatorChain->getErrors(), $optionValue, $option); + + if (count($errors) > 0) { + throw new \Magento\Framework\Model\Exception(implode("\n", $errors)); + } + } else { + throw new \Magento\Framework\Model\Exception(__('Please specify the product\'s required option(s).')); + } + return $result; + } + + /** + * @param string $fileRelativePath + * @return string + */ + protected function buildSecretKey($fileRelativePath) + { + return substr(md5($this->rootDirectory->readFile($fileRelativePath)), 0, 20); + } + + /** + * @param array $optionValue + * @return void + */ + protected function initFilePath($optionValue) + { + /** + * @see \Magento\Catalog\Model\Product\Option\Type\File\ValidatorFile::validate + * There setUserValue() sets correct fileFullPath only for + * quote_path. So we must form both full paths manually and + * check them. + */ + $checkPaths = array(); + if (isset($optionValue['quote_path'])) { + $checkPaths[] = $optionValue['quote_path']; + } + if (isset($optionValue['order_path']) && !$this->useQuotePath) { + $checkPaths[] = $optionValue['order_path']; + } + + foreach ($checkPaths as $path) { + if (!$this->rootDirectory->isFile($path)) { + if (!$this->coreFileStorageDatabase->saveFileToFilesystem($path)) { + continue; + } + } + $this->fileFullPath = $this->rootDirectory->getAbsolutePath($path); + $this->fileRelativePath = $path; + break; + } + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Option/Value.php b/app/code/Magento/Catalog/Model/Product/Option/Value.php index dcc8d625a4ffa..50c32e3e93922 100644 --- a/app/code/Magento/Catalog/Model/Product/Option/Value.php +++ b/app/code/Magento/Catalog/Model/Product/Option/Value.php @@ -25,6 +25,7 @@ use Magento\Catalog\Model\Product; use Magento\Catalog\Model\Product\Option; +use \Magento\Framework\Model\AbstractExtensibleModel; /** * Catalog product option select type model @@ -33,14 +34,10 @@ * @method \Magento\Catalog\Model\Resource\Product\Option\Value getResource() * @method int getOptionId() * @method \Magento\Catalog\Model\Product\Option\Value setOptionId(int $value) - * @method string getSku() - * @method \Magento\Catalog\Model\Product\Option\Value setSku(string $value) - * @method int getSortOrder() - * @method \Magento\Catalog\Model\Product\Option\Value setSortOrder(int $value) * * @SuppressWarnings(PHPMD.LongVariable) */ -class Value extends \Magento\Framework\Model\AbstractModel +class Value extends AbstractExtensibleModel implements \Magento\Catalog\Api\Data\ProductCustomOptionValuesInterface { /** * Option type percent @@ -72,6 +69,7 @@ class Value extends \Magento\Framework\Model\AbstractModel /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry + * @param \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService * @param \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory * @param \Magento\Framework\Model\Resource\AbstractResource $resource * @param \Magento\Framework\Data\Collection\Db $resourceCollection @@ -80,13 +78,14 @@ class Value extends \Magento\Framework\Model\AbstractModel public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, + \Magento\Catalog\Api\CategoryAttributeRepositoryInterface $metadataService, \Magento\Catalog\Model\Resource\Product\Option\Value\CollectionFactory $valueCollectionFactory, \Magento\Framework\Model\Resource\AbstractResource $resource = null, \Magento\Framework\Data\Collection\Db $resourceCollection = null, array $data = array() ) { $this->_valueCollectionFactory = $valueCollectionFactory; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); + parent::__construct($context, $registry, $metadataService, $resource, $resourceCollection, $data); } /** @@ -306,4 +305,54 @@ public function duplicate($oldOptionId, $newOptionId) $this->getResource()->duplicate($this, $oldOptionId, $newOptionId); return $this; } + + /** + * Get option title + * + * @return string + */ + public function getTitle() + { + return $this->_getData('title'); + } + + /** + * Get sort order + * + * @return int + */ + public function getSortOrder() + { + return $this->_getData('sort_order'); + } + + /** + * Get price type + * + * @return string + */ + public function getPriceType() + { + return $this->_getData('price_type'); + } + + /** + * Get Sku + * + * @return string|null + */ + public function getSku() + { + return $this->_getData('sku'); + } + + /** + * Get Sku + * + * @return string|null + */ + public function getOptionTypeId() + { + return $this->_getData('option_type_id'); + } } diff --git a/app/code/Magento/Catalog/Model/Product/PriceModifier.php b/app/code/Magento/Catalog/Model/Product/PriceModifier.php index 01373135fa103..8405447a88c73 100644 --- a/app/code/Magento/Catalog/Model/Product/PriceModifier.php +++ b/app/code/Magento/Catalog/Model/Product/PriceModifier.php @@ -29,6 +29,20 @@ class PriceModifier { + /** + * @var \Magento\Catalog\Model\ProductRepository + */ + protected $productRepository; + + /** + * @param \Magento\Catalog\Model\ProductRepository $productRepository + */ + public function __construct( + \Magento\Catalog\Model\ProductRepository $productRepository + ) { + $this->productRepository = $productRepository; + } + /** * @param \Magento\Catalog\Model\Product $product * @param int $customerGroupId @@ -47,7 +61,8 @@ public function removeGroupPrice(\Magento\Catalog\Model\Product $product, $custo foreach ($prices as $key => $groupPrice) { if ($groupPrice['cust_group'] == $customerGroupId - && intval($groupPrice['website_id']) === intval($websiteId)) { + && intval($groupPrice['website_id']) === intval($websiteId) + ) { unset ($prices[$key]); } } @@ -59,7 +74,7 @@ public function removeGroupPrice(\Magento\Catalog\Model\Product $product, $custo } $product->setData('group_price', $prices); try { - $product->save(); + $this->productRepository->save($product); } catch (\Exception $exception) { throw new CouldNotSaveException("Invalid data provided for group price"); } @@ -85,10 +100,12 @@ public function removeTierPrice(\Magento\Catalog\Model\Product $product, $custom foreach ($prices as $key => $tierPrice) { if ($customerGroupId == 'all' && $tierPrice['price_qty'] == $qty - && $tierPrice['all_groups'] == 1 && intval($tierPrice['website_id']) === intval($websiteId)) { + && $tierPrice['all_groups'] == 1 && intval($tierPrice['website_id']) === intval($websiteId) + ) { unset ($prices[$key]); } elseif ($tierPrice['price_qty'] == $qty && $tierPrice['cust_group'] == $customerGroupId - && intval($tierPrice['website_id']) === intval($websiteId)) { + && intval($tierPrice['website_id']) === intval($websiteId) + ) { unset ($prices[$key]); } } @@ -101,7 +118,7 @@ public function removeTierPrice(\Magento\Catalog\Model\Product $product, $custom } $product->setData('tier_price', $prices); try { - $product->save(); + $this->productRepository->save($product); } catch (\Exception $exception) { throw new CouldNotSaveException("Invalid data provided for tier_price"); } diff --git a/lib/internal/Magento/Framework/Module/Declaration/SchemaLocator.php b/app/code/Magento/Catalog/Model/Product/TierPrice.php similarity index 69% rename from lib/internal/Magento/Framework/Module/Declaration/SchemaLocator.php rename to app/code/Magento/Catalog/Model/Product/TierPrice.php index 3c8b266a94fdb..a1ef0f60e0e60 100644 --- a/lib/internal/Magento/Framework/Module/Declaration/SchemaLocator.php +++ b/app/code/Magento/Catalog/Model/Product/TierPrice.php @@ -1,6 +1,5 @@ getData(self::QTY); } /** - * Get path to pre file validation schema + * Retrieve price value * - * @return null + * @return float */ - public function getPerFileSchema() + public function getValue() { - return null; + return $this->getData(self::VALUE); } } diff --git a/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php new file mode 100644 index 0000000000000..41ad04f748098 --- /dev/null +++ b/app/code/Magento/Catalog/Model/Product/TierPriceManagement.php @@ -0,0 +1,201 @@ +productRepository = $productRepository; + $this->priceBuilder = $priceBuilder; + $this->storeManager = $storeManager; + $this->priceModifier = $priceModifier; + $this->config = $config; + $this->groupManagement = $groupManagement; + $this->groupRepository = $groupRepository; + } + + /** + * {@inheritdoc} + * @SuppressWarnings(PHPMD.CyclomaticComplexity) + * @SuppressWarnings(PHPMD.NPathComplexity) + */ + public function add($productSku, $customerGroupId, $price, $qty) + { + if (!\Zend_Validate::is($price, 'Float') || $price <= 0 || !\Zend_Validate::is($qty, 'Float') || $qty <= 0) { + throw new InputException('Please provide valid data'); + } + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); + $tierPrices = $product->getData('tier_price'); + $websiteIdentifier = 0; + if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) != 0) { + $websiteIdentifier = $this->storeManager->getWebsite()->getId(); + } + $found = false; + + foreach ($tierPrices as &$item) { + if ('all' == $customerGroupId) { + $isGroupValid = ($item['all_groups'] == 1); + } else { + $isGroupValid = ($item['cust_group'] == $customerGroupId); + } + + if ($isGroupValid && $item['website_id'] == $websiteIdentifier && $item['price_qty'] == $qty) { + $item['price'] = $price; + $found = true; + break; + } + } + if (!$found) { + $mappedCustomerGroupId = 'all' == $customerGroupId + ? $this->groupManagement->getAllCustomersGroup()->getId() + : $this->groupRepository->getById($customerGroupId)->getId(); + + $tierPrices[] = array( + 'cust_group' => $mappedCustomerGroupId, + 'price' => $price, + 'website_price' => $price, + 'website_id' => $websiteIdentifier, + 'price_qty' => $qty + ); + } + + $product->setData('tier_price', $tierPrices); + $errors = $product->validate(); + if (is_array($errors) && count($errors)) { + $errorAttributeCodes = implode(', ', array_keys($errors)); + throw new InputException( + sprintf('Values of following attributes are invalid: %s', $errorAttributeCodes) + ); + } + try { + $this->productRepository->save($product); + } catch (\Exception $e) { + throw new CouldNotSaveException('Could not save group price'); + } + return true; + } + + /** + * {@inheritdoc} + */ + public function remove($productSku, $customerGroupId, $qty) + { + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); + $websiteIdentifier = 0; + if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) != 0) { + $websiteIdentifier = $this->storeManager->getWebsite()->getId(); + } + $this->priceModifier->removeTierPrice($product, $customerGroupId, $qty, $websiteIdentifier); + return true; + } + + /** + * {@inheritdoc} + */ + public function getList($productSku, $customerGroupId) + { + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); + + $priceKey = 'website_price'; + if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) == 0) { + $priceKey = 'price'; + } + + $prices = array(); + foreach ($product->getData('tier_price') as $price) { + if ((is_numeric($customerGroupId) && intval($price['cust_group']) === intval($customerGroupId)) + || ($customerGroupId === 'all' && $price['all_groups']) + ) { + $this->priceBuilder->populateWithArray( + array( + \Magento\Catalog\Api\Data\ProductTierPriceInterface::VALUE => $price[$priceKey], + \Magento\Catalog\Api\Data\ProductTierPriceInterface::QTY => $price['price_qty'] + ) + ); + $prices[] = $this->priceBuilder->create(); + } + } + return $prices; + } +} diff --git a/app/code/Magento/Catalog/Model/Product/Type/Price.php b/app/code/Magento/Catalog/Model/Product/Type/Price.php index a56056a33f535..f56412702f942 100644 --- a/app/code/Magento/Catalog/Model/Product/Type/Price.php +++ b/app/code/Magento/Catalog/Model/Product/Type/Price.php @@ -25,6 +25,7 @@ namespace Magento\Catalog\Model\Product\Type; use Magento\Catalog\Model\Product; +use Magento\Customer\Api\GroupManagementInterface; use Magento\Store\Model\Store; use Magento\Framework\Pricing\PriceCurrencyInterface; @@ -81,6 +82,11 @@ class Price */ protected $priceCurrency; + /** + * @var GroupManagementInterface + */ + protected $_groupManagement; + /** * @param \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory * @param \Magento\Framework\StoreManagerInterface $storeManager @@ -88,6 +94,7 @@ class Price * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param PriceCurrencyInterface $priceCurrency + * @param GroupManagementInterface $groupManagement */ public function __construct( \Magento\CatalogRule\Model\Resource\RuleFactory $ruleFactory, @@ -95,7 +102,8 @@ public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Event\ManagerInterface $eventManager, - PriceCurrencyInterface $priceCurrency + PriceCurrencyInterface $priceCurrency, + GroupManagementInterface $groupManagement ) { $this->_ruleFactory = $ruleFactory; $this->_storeManager = $storeManager; @@ -103,6 +111,7 @@ public function __construct( $this->_customerSession = $customerSession; $this->_eventManager = $eventManager; $this->priceCurrency = $priceCurrency; + $this->_groupManagement = $groupManagement; } /** @@ -256,7 +265,7 @@ protected function _applyTierPrice($product, $qty, $finalPrice) */ public function getTierPrice($qty, $product) { - $allGroups = \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL; + $allGroups = $this->_groupManagement->getAllCustomersGroup()->getId(); $prices = $product->getData('tier_price'); if (is_null($prices)) { diff --git a/app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php b/app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php new file mode 100644 index 0000000000000..25864279fea14 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductAttributeGroupRepository.php @@ -0,0 +1,114 @@ +groupRepository = $groupRepository; + $this->groupResource = $groupResource; + $this->groupFactory = $groupFactory; + } + + /** + * {@inheritdoc} + */ + public function save(\Magento\Eav\Api\Data\AttributeGroupInterface $group) + { + return $this->groupRepository->save($group); + } + + /** + * {@inheritdoc} + */ + public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) + { + return $this->groupRepository->getList($searchCriteria); + } + + /** + * {@inheritdoc} + */ + public function get($groupId) + { + /** @var \Magento\Catalog\Model\Product\Attribute\Group $group */ + $group = $this->groupFactory->create(); + $this->groupResource->load($group, $groupId); + if (!$group->getId()) { + throw new NoSuchEntityException(sprintf('Group with id "%s" does not exist.', $groupId)); + } + return $group; + } + + /** + * {@inheritdoc} + */ + public function deleteById($groupId) + { + $this->delete( + $this->get($groupId) + ); + return true; + } + + /** + * {@inheritdoc} + */ + public function delete(\Magento\Eav\Api\Data\AttributeGroupInterface $group) + { + /** @var \Magento\Catalog\Model\Product\Attribute\Group $group */ + if ($group->hasSystemAttributes()) { + throw new StateException('Attribute group that contains system attributes can not be deleted'); + } + return $this->groupRepository->delete($group); + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/Attribute.php b/app/code/Magento/Catalog/Model/ProductLink/Attribute.php new file mode 100644 index 0000000000000..8f7f4cc4f0747 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/Attribute.php @@ -0,0 +1,46 @@ +_get('code'); + } + + /** + * {@inheritdoc} + */ + public function getType() + { + return $this->_get('type'); + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php new file mode 100644 index 0000000000000..023ed18378297 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider.php @@ -0,0 +1,74 @@ +converterPool = $converterPool; + $this->providers = $providers; + } + + /** + * Get product collection by link type + * + * @param \Magento\Catalog\Model\Product $product + * @param string $type + * @return array + * @throws NoSuchEntityException + */ + public function getCollection(\Magento\Catalog\Model\Product $product, $type) + { + if (!isset($this->providers[$type])) { + throw new NoSuchEntityException('Collection provider is not registered'); + } + + $products = $this->providers[$type]->getLinkedProducts($product); + $converter = $this->converterPool->getConverter($type); + $output = []; + foreach ($products as $item) { + $output[$item->getId()] = $converter->convert($item); + } + return $output; + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Crosssell.php b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Crosssell.php new file mode 100644 index 0000000000000..4f39bb467cf3c --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Crosssell.php @@ -0,0 +1,36 @@ +getCrossSellProducts(); + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Related.php b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Related.php new file mode 100644 index 0000000000000..c07e8b3b79858 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Related.php @@ -0,0 +1,36 @@ +getRelatedProducts(); + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Upsell.php b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Upsell.php new file mode 100644 index 0000000000000..4cf52a9920262 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/CollectionProvider/Upsell.php @@ -0,0 +1,36 @@ +getUpSellProducts(); + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/CollectionProviderInterface.php b/app/code/Magento/Catalog/Model/ProductLink/CollectionProviderInterface.php new file mode 100644 index 0000000000000..b2a6921662dfb --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/CollectionProviderInterface.php @@ -0,0 +1,36 @@ +orderRepository = $orderRepository; + $this->converters = $converters; } /** - * Invoke getOrder service + * Get converter by link type * - * @param int $id - * @return bool - * @throws \Magento\Framework\Exception\NoSuchEntityException + * @param string $linkType + * @return ConverterInterface */ - public function invoke($id) + public function getConverter($linkType) { - return (bool)$this->orderRepository->get($id)->cancel(); + return isset($this->converters[$linkType]) + ? $this->converters[$linkType] + : $this->converters[$this->defaultConverterCode]; } } diff --git a/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResults.php b/app/code/Magento/Catalog/Model/ProductLink/Converter/DefaultConverter.php similarity index 72% rename from app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResults.php rename to app/code/Magento/Catalog/Model/ProductLink/Converter/DefaultConverter.php index cc218c0181bc5..a8020ec76c707 100644 --- a/app/code/Magento/Tax/Service/V1/Data/TaxRuleSearchResults.php +++ b/app/code/Magento/Catalog/Model/ProductLink/Converter/DefaultConverter.php @@ -22,22 +22,19 @@ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ -namespace Magento\Tax\Service\V1\Data; +namespace Magento\Catalog\Model\ProductLink\Converter; -use Magento\Framework\Api\SearchResults; - -/** - * TaxRuleSearchResults Service Data Object used for the search service requests - */ -class TaxRuleSearchResults extends SearchResults +class DefaultConverter implements ConverterInterface { /** - * Get items - * - * @return \Magento\Tax\Service\V1\Data\TaxRule[] + * {@inheritdoc} */ - public function getItems() + public function convert(\Magento\Catalog\Model\Product $product) { - return parent::getItems(); + return [ + 'type' => $product->getTypeId(), + 'sku' => $product->getSku(), + 'position' => $product->getPosition() + ]; } } diff --git a/app/code/Magento/Catalog/Model/ProductLink/Link.php b/app/code/Magento/Catalog/Model/ProductLink/Link.php new file mode 100644 index 0000000000000..ed756e70e3295 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/Link.php @@ -0,0 +1,134 @@ +_data = $data; + } + + /** + * Retrieves a value from the data array if set, or null otherwise. + * + * @param string $key + * @return mixed|null + */ + protected function _get($key) + { + return isset($this->_data[$key]) ? $this->_data[$key] : null; + } + + /** + * Return Data Object data in array format. + * + * @return array + */ + public function __toArray() + { + $data = $this->_data; + $hasToArray = function ($model) { + return is_object($model) && method_exists($model, '__toArray') && is_callable([$model, '__toArray']); + }; + foreach ($data as $key => $value) { + if ($hasToArray($value)) { + $data[$key] = $value->__toArray(); + } elseif (is_array($value)) { + foreach ($value as $nestedKey => $nestedValue) { + if ($hasToArray($nestedValue)) { + $value[$nestedKey] = $nestedValue->__toArray(); + } + } + $data[$key] = $value; + } + } + return $data; + } + + /** + * Get product SKU + * + * @identifier + * @return string + */ + public function getProductSku() + { + return $this->_get('product_sku'); + } + + /** + * Get link type + * + * @identifier + * @return string + */ + public function getLinkType() + { + return $this->_get('link_type'); + } + + /** + * Get linked product sku + * + * @identifier + * @return string + */ + public function getLinkedProductSku() + { + return $this->_get('linked_product_sku'); + } + + /** + * Get linked product type (simple, virtual, etc) + * + * @return string + */ + public function getLinkedProductType() + { + return $this->_get('linked_product_type'); + } + + /** + * Get product position + * + * @return int + */ + public function getPosition() + { + return $this->_get('position'); + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/Management.php b/app/code/Magento/Catalog/Model/ProductLink/Management.php new file mode 100644 index 0000000000000..7ad96d096b547 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/Management.php @@ -0,0 +1,172 @@ +productRepository = $productRepository; + $this->entityCollectionProvider = $collectionProvider; + $this->productLinkBuilder = $productLinkBuilder; + $this->productResource = $productResource; + $this->linkInitializer = $linkInitializer; + $this->valueBuilder = $valueBuilder; + $this->linkTypeProvider = $linkTypeProvider; + } + + /** + * {@inheritdoc} + */ + public function getLinkedItemsByType($productSku, $type) + { + $output = []; + $product = $this->productRepository->get($productSku); + try { + $collection = $this->entityCollectionProvider->getCollection($product, $type); + } catch (NoSuchEntityException $e) { + throw new NoSuchEntityException('Unknown link type: ' . (string)$type); + } + foreach ($collection as $item) { + $data = [ + 'product_sku' => $product->getSku(), + 'link_type' => $type, + 'linked_product_sku' => $item['sku'], + 'linked_product_type' => $item['type'], + 'position' => $item['position'], + ]; + $this->productLinkBuilder->populateWithArray($data); + if (isset($item['custom_attributes'])) { + foreach ($item['custom_attributes'] as $option) { + $this->productLinkBuilder->setCustomAttribute( + $option['attribute_code'], + $option['value'] + ); + } + } + $output[] = $this->productLinkBuilder->create(); + } + return $output; + } + + /** + * {@inheritdoc} + */ + public function setProductLinks($productSku, $type, array $items) + { + $linkTypes = $this->linkTypeProvider->getLinkTypes(); + + if (!isset($linkTypes[$type])) { + throw new NoSuchEntityException( + sprintf("Provided link type \"%s\" does not exist", $type) + ); + } + + $product = $this->productRepository->get($productSku); + $assignedSkuList = []; + /** @var \Magento\Catalog\Api\Data\ProductLinkInterface $link */ + foreach ($items as $link) { + $assignedSkuList[] = $link->getLinkedProductSku(); + } + $linkedProductIds = $this->productResource->getProductsIdsBySkus($assignedSkuList); + + $links = []; + /** @var \Magento\Catalog\Api\Data\ProductLinkInterface[] $items*/ + foreach ($items as $link) { + $data = $link->__toArray(); + $linkedSku = $link->getLinkedProductSku(); + if (!isset($linkedProductIds[$linkedSku])) { + throw new NoSuchEntityException( + sprintf("Product with SKU \"%s\" does not exist", $linkedSku) + ); + } + $data['product_id'] = $linkedProductIds[$linkedSku]; + $links[$linkedProductIds[$linkedSku]] = $data; + } + $this->linkInitializer->initializeLinks($product, [$type => $links]); + try { + $product->save(); + } catch (\Exception $exception) { + throw new CouldNotSaveException('Invalid data provided for linked products'); + } + return true; + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/Repository.php b/app/code/Magento/Catalog/Model/ProductLink/Repository.php new file mode 100644 index 0000000000000..90b13c122a1f9 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/Repository.php @@ -0,0 +1,147 @@ +productRepository = $productRepository; + $this->entityCollectionProvider = $entityCollectionProvider; + $this->linkInitializer = $linkInitializer; + $this->linkManagement = $linkManagement; + } + + /** + * {@inheritdoc} + */ + public function save(\Magento\Catalog\Api\Data\ProductLinkInterface $entity) + { + $linkedProduct = $this->productRepository->get($entity->getLinkedProductSku()); + $product = $this->productRepository->get($entity->getProductSku()); + $links = $this->entityCollectionProvider->getCollection($product, $entity->getLinkType()); + + $data = $entity->__toArray(); + foreach ($entity->getCustomAttributes() as $attribute) { + $data[$attribute->getAttributeCode()] = $attribute->getValue(); + } + $data['product_id'] = $linkedProduct->getId(); + $links[$linkedProduct->getId()] = $data; + $this->linkInitializer->initializeLinks($product, [$entity->getLinkType() => $links]); + try { + $product->save(); + } catch (\Exception $exception) { + throw new CouldNotSaveException('Invalid data provided for linked products'); + } + return true; + } + + /** + * {@inheritdoc} + */ + public function delete(\Magento\Catalog\Api\Data\ProductLinkInterface $entity) + { + $linkedProduct = $this->productRepository->get($entity->getLinkedProductSku()); + $product = $this->productRepository->get($entity->getProductSku()); + $links = $this->entityCollectionProvider->getCollection($product, $entity->getLinkType()); + + if (!isset($links[$linkedProduct->getId()])) { + throw new NoSuchEntityException( + sprintf( + 'Product with SKU %s is not linked to product with SKU %s', + $entity->getLinkedProductSku(), + $entity->getProductSku() + ) + ); + } + //Remove product from the linked product list + unset($links[$linkedProduct->getId()]); + + $this->linkInitializer->initializeLinks($product, [$entity->getLinkType() => $links]); + try { + $product->save(); + } catch (\Exception $exception) { + throw new CouldNotSaveException('Invalid data provided for linked products'); + } + return true; + } + + /** + * {@inheritdoc} + */ + public function deleteById($productSku, $type, $linkedProductSku) + { + $linkItems = $this->linkManagement->getLinkedItemsByType($productSku, $type); + /** @var \Magento\Catalog\Api\Data\ProductLinkInterface $linkItem */ + foreach ($linkItems as $linkItem) { + if ($linkItem->getLinkedProductSku() == $linkedProductSku) { + return $this->delete($linkItem); + } + } + throw new NoSuchEntityException( + 'Product %s doesn\'t have linked %s as %s', + [ + $productSku, + $linkedProductSku, + $type + ] + ); + } +} diff --git a/app/code/Magento/Catalog/Model/ProductLink/Type.php b/app/code/Magento/Catalog/Model/ProductLink/Type.php new file mode 100644 index 0000000000000..b58bce138223c --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductLink/Type.php @@ -0,0 +1,46 @@ +_get('code'); + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->_get('name'); + } +} diff --git a/app/code/Magento/Catalog/Model/ProductOptions/Config.php b/app/code/Magento/Catalog/Model/ProductOptions/Config.php index 8f024ef4e8a3d..5672a9cc0f3d2 100644 --- a/app/code/Magento/Catalog/Model/ProductOptions/Config.php +++ b/app/code/Magento/Catalog/Model/ProductOptions/Config.php @@ -23,7 +23,8 @@ */ namespace Magento\Catalog\Model\ProductOptions; -class Config extends \Magento\Framework\Config\Data implements \Magento\Catalog\Model\ProductOptions\ConfigInterface +class Config extends \Magento\Framework\Config\Data implements + \Magento\Catalog\Model\ProductOptions\ConfigInterface { /** * @param \Magento\Catalog\Model\ProductOptions\Config\Reader $reader diff --git a/app/code/Magento/Catalog/Model/ProductOptions/TypeList.php b/app/code/Magento/Catalog/Model/ProductOptions/TypeList.php new file mode 100644 index 0000000000000..4592218c02920 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductOptions/TypeList.php @@ -0,0 +1,72 @@ +config = $config; + $this->builder = $builder; + } + + /** + * {@inheritdoc} + */ + public function getItems() + { + $output = []; + foreach ($this->config->getAll() as $option) { + foreach ($option['types'] as $type) { + if ($type['disabled']) { + continue; + } + $itemData = [ + 'label' => __($type['label']), + 'code' => $type['name'], + 'group' => __($option['label']) + ]; + $output[] = $this->builder->populateWithArray($itemData)->create(); + } + } + return $output; + } +} diff --git a/app/code/Magento/Catalog/Model/ProductRepository.php b/app/code/Magento/Catalog/Model/ProductRepository.php index 8dc31bb44c1bf..9cec26266df6f 100644 --- a/app/code/Magento/Catalog/Model/ProductRepository.php +++ b/app/code/Magento/Catalog/Model/ProductRepository.php @@ -24,9 +24,12 @@ */ namespace Magento\Catalog\Model; -use Magento\Framework\Exception\NoSuchEntityException; +use \Magento\Framework\Exception\NoSuchEntityException; +use \Magento\Catalog\Model\Resource\Product\Collection; +use \Magento\Framework\Api\SearchCriteriaInterface; +use \Magento\Framework\Api\SortOrder; -class ProductRepository +class ProductRepository implements \Magento\Catalog\Api\ProductRepositoryInterface { /** * @var ProductFactory @@ -38,27 +41,88 @@ class ProductRepository */ protected $instances = array(); + /** + * @var \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper + */ + protected $initializationHelper; + + /** + * @var \Magento\Catalog\Api\Data\ProductSearchResultsDataBuilder + */ + protected $searchResultsBuilder; + + /** + * @var \Magento\Framework\Api\SearchCriteriaDataBuilder + */ + protected $searchCriteriaBuilder; + + /** + * @var \Magento\Framework\Api\FilterBuilder + */ + protected $filterBuilder; + + /** + * @var \Magento\Catalog\Model\Resource\Product\CollectionFactory + */ + protected $collectionFactory; + + /** + * @var \Magento\Catalog\Model\Resource\Product + */ + protected $resourceModel; + + /** + * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface + */ + protected $attributeRepository; + + /** + * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface + */ + protected $metadataService; + /** * @param ProductFactory $productFactory + * @param \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper + * @param \Magento\Catalog\Api\Data\ProductSearchResultsDataBuilder $searchResultsBuilder + * @param Resource\Product\CollectionFactory $collectionFactory + * @param \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder + * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository + * @param Resource\Product $resourceModel + * @param \Magento\Framework\Api\FilterBuilder $filterBuilder + * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface */ - public function __construct(ProductFactory $productFactory) - { + public function __construct( + ProductFactory $productFactory, + \Magento\Catalog\Controller\Adminhtml\Product\Initialization\Helper $initializationHelper, + \Magento\Catalog\Api\Data\ProductSearchResultsDataBuilder $searchResultsBuilder, + \Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory, + \Magento\Framework\Api\SearchCriteriaDataBuilder $searchCriteriaBuilder, + \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository, + \Magento\Catalog\Model\Resource\Product $resourceModel, + \Magento\Framework\Api\FilterBuilder $filterBuilder, + \Magento\Catalog\Api\ProductAttributeRepositoryInterface $metadataServiceInterface + ) { $this->productFactory = $productFactory; + $this->collectionFactory = $collectionFactory; + $this->initializationHelper = $initializationHelper; + $this->searchResultsBuilder = $searchResultsBuilder; + $this->searchCriteriaBuilder = $searchCriteriaBuilder; + $this->resourceModel = $resourceModel; + $this->attributeRepository = $attributeRepository; + $this->filterBuilder = $filterBuilder; + $this->metadataService = $metadataServiceInterface; } /** - * Retrieve product instance by sku - * - * @param string $sku - * @param boolean $editMode - * @return Product - * @throws NoSuchEntityException + * {@inheritdoc} */ public function get($sku, $editMode = false) { if (!isset($this->instances[$sku])) { $product = $this->productFactory->create(); - $productId = $product->getIdBySku($sku); + + $productId = $this->resourceModel->getIdBySku($sku); if (!$productId) { throw new NoSuchEntityException('Requested product doesn\'t exist'); } @@ -70,4 +134,153 @@ public function get($sku, $editMode = false) } return $this->instances[$sku]; } + + /** + * Merge data from DB and updates from request + * + * @param array $productData + * @param bool $createNew + * @return \Magento\Catalog\Api\Data\ProductInterface|Product + * @throws NoSuchEntityException + */ + protected function initializeProductData(array $productData, $createNew) + { + if ($createNew) { + $product = $this->productFactory->create(); + } else { + $product = $this->get($productData['sku']); + $this->initializationHelper->initialize($product); + } + foreach ($productData as $key => $value) { + $product->setData($key, $value); + } + + return $product; + } + + /** + * {@inheritdoc} + */ + public function save(\Magento\Catalog\Api\Data\ProductInterface $product, $saveOptions = false) + { + $productId = $this->resourceModel->getIdBySku($product->getSku()); + $product = $this->initializeProductData($product->toFlatArray(), empty($productId)); + $validationResult = $this->resourceModel->validate($product); + if (true !== $validationResult) { + throw new \Magento\Framework\Exception\CouldNotSaveException( + sprintf('Invalid product data: %s', implode(',', $validationResult)) + ); + } + try { + if ($saveOptions) { + $product->setCanSaveCustomOptions(true); + } + $this->resourceModel->save($product); + } catch (\Magento\Eav\Model\Entity\Attribute\Exception $exception) { + throw \Magento\Framework\Exception\InputException::invalidFieldValue( + $exception->getAttributeCode(), + $product->getData($exception->getAttributeCode()), + $exception + ); + } catch (\Exception $e) { + throw new \Magento\Framework\Exception\CouldNotSaveException('Unable to save product'); + } + if (array_key_exists($product->getSku(), $this->instances)) { + unset($this->instances[$product->getSku()]); + } + + return $product; + } + + /** + * {@inheritdoc} + */ + public function delete(\Magento\Catalog\Api\Data\ProductInterface $product) + { + $productSku = $product->getSku(); + try { + $this->resourceModel->delete($product); + } catch (\Exception $e) { + throw new \Magento\Framework\Exception\StateException('Unable to remove product ' . $productSku); + } + if (array_key_exists($productSku, $this->instances)) { + unset($this->instances[$productSku]); + } + return true; + } + + /** + * {@inheritdoc} + */ + public function deleteById($productSku) + { + $product = $this->get($productSku); + return $this->delete($product); + } + + /** + * {@inheritdoc} + */ + public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria) + { + /** @var \Magento\Catalog\Model\Resource\Product\Collection $collection */ + $collection = $this->collectionFactory->create(); + + $extendedSearchCriteria = $this->searchCriteriaBuilder->addFilter( + [ + $this->filterBuilder + ->setField('attribute_set_id') + ->setValue(\Magento\Catalog\Api\Data\ProductAttributeInterface::DEFAULT_ATTRIBUTE_SET_ID) + ->create() + ] + ); + + foreach ($this->metadataService->getList($extendedSearchCriteria->create())->getItems() as $metadata) { + $collection->addAttributeToSelect($metadata->getAttributeCode()); + } + $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner'); + $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner'); + + //Add filters from root filter group to the collection + foreach ($searchCriteria->getFilterGroups() as $group) { + $this->addFilterGroupToCollection($group, $collection); + } + /** @var SortOrder $sortOrder */ + foreach ((array)$searchCriteria->getSortOrders() as $sortOrder) { + $field = $sortOrder->getField(); + $collection->addOrder( + $field, + ($sortOrder->getDirection() == SearchCriteriaInterface::SORT_ASC) ? 'ASC' : 'DESC' + ); + } + $collection->setCurPage($searchCriteria->getCurrentPage()); + $collection->setPageSize($searchCriteria->getPageSize()); + $collection->load(); + + $this->searchResultsBuilder->setSearchCriteria($searchCriteria); + $this->searchResultsBuilder->setItems($collection->getItems()); + $this->searchResultsBuilder->setTotalCount($collection->getSize()); + return $this->searchResultsBuilder->create(); + } + + /** + * Helper function that adds a FilterGroup to the collection. + * + * @param \Magento\Framework\Api\Search\FilterGroup $filterGroup + * @param Collection $collection + * @return void + */ + protected function addFilterGroupToCollection( + \Magento\Framework\Api\Search\FilterGroup $filterGroup, + Collection $collection + ) { + $fields = []; + foreach ($filterGroup->getFilters() as $filter) { + $condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq'; + $fields[] = array('attribute' => $filter->getField(), $condition => $filter->getValue()); + } + if ($fields) { + $collection->addFieldToFilter($fields); + } + } } diff --git a/setup/module/Magento/Setup/src/Module/ResourceInterface.php b/app/code/Magento/Catalog/Model/ProductType.php similarity index 69% rename from setup/module/Magento/Setup/src/Module/ResourceInterface.php rename to app/code/Magento/Catalog/Model/ProductType.php index 89e1839b8d788..c4529b74bc800 100644 --- a/setup/module/Magento/Setup/src/Module/ResourceInterface.php +++ b/app/code/Magento/Catalog/Model/ProductType.php @@ -1,5 +1,7 @@ _get('name'); + } /** - * Set module version into DB - * - * @param string $resName - * @param string $version - * @return int + * {@inheritdoc} */ - public function setDbVersion($resName, $version); + public function getLabel() + { + return $this->_get('label'); + } } diff --git a/app/code/Magento/Catalog/Model/ProductTypeList.php b/app/code/Magento/Catalog/Model/ProductTypeList.php new file mode 100644 index 0000000000000..064bf3f6b0893 --- /dev/null +++ b/app/code/Magento/Catalog/Model/ProductTypeList.php @@ -0,0 +1,85 @@ +productTypeConfig = $productTypeConfig; + $this->productTypeBuilder = $productTypeBuilder; + } + + /** + * {@inheritdoc} + */ + public function getProductTypes() + { + if (is_null($this->productTypes)) { + $productTypes = array(); + foreach ($this->productTypeConfig->getAll() as $productTypeData) { + $productTypes[] = $this->productTypeBuilder->populateWithArray( + [ + 'name' => $productTypeData['name'], + 'label' => $productTypeData['label'] + ] + )->create(); + } + $this->productTypes = $productTypes; + } + return $this->productTypes; + } +} diff --git a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php index 622bd3a3c89ca..9004697019238 100644 --- a/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Category/Attribute/Collection.php @@ -43,6 +43,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory + * @param \Magento\Eav\Model\Config $eavConfig * @param \Zend_Db_Adapter_Abstract $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ @@ -51,12 +52,13 @@ public function __construct( \Magento\Framework\Logger $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\EntityFactory $eavEntityFactory, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { $this->_eavEntityFactory = $eavEntityFactory; - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $eavConfig, $connection, $resource); } /** diff --git a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php index 2058d82898f25..67d6d04ff1d27 100644 --- a/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Eav/Attribute.php @@ -33,41 +33,29 @@ * @method \Magento\Catalog\Model\Resource\Eav\Attribute getFrontendInputRenderer() * @method string setFrontendInputRenderer(string $value) * @method int setIsGlobal(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsVisible() * @method int setIsVisible(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsSearchable() * @method int setIsSearchable(int $value) * @method \Magento\Catalog\Model\Resource\Eav\Attribute getSearchWeight() * @method int setSearchWeight(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsFilterable() * @method int setIsFilterable(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsComparable() * @method int setIsComparable(int $value) * @method int setIsVisibleOnFront(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsHtmlAllowedOnFront() * @method int setIsHtmlAllowedOnFront(int $value) * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsUsedForPriceRules() * @method int setIsUsedForPriceRules(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsFilterableInSearch() * @method int setIsFilterableInSearch(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getUsedInProductListing() * @method int setUsedInProductListing(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getUsedForSortBy() * @method int setUsedForSortBy(int $value) * @method string setApplyTo(string $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsVisibleInAdvancedSearch() * @method int setIsVisibleInAdvancedSearch(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getPosition() * @method int setPosition(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsWysiwygEnabled() * @method int setIsWysiwygEnabled(int $value) - * @method \Magento\Catalog\Model\Resource\Eav\Attribute getIsUsedForPromoRules() * @method int setIsUsedForPromoRules(int $value) - * @method string getFrontendLabel() * * @author Magento Core Team */ -class Attribute extends \Magento\Eav\Model\Entity\Attribute +class Attribute extends \Magento\Eav\Model\Entity\Attribute implements + \Magento\Catalog\Api\Data\ProductAttributeInterface { const SCOPE_STORE = 0; @@ -123,12 +111,14 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute /** * @param \Magento\Framework\Model\Context $context * @param \Magento\Framework\Registry $registry + * @param \Magento\Framework\Api\MetadataServiceInterface $metadataService * @param \Magento\Core\Helper\Data $coreData * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Eav\Model\Resource\Helper $resourceHelper * @param \Magento\Framework\Validator\UniversalFactory $universalFactory + * @param \Magento\Eav\Api\Data\AttributeOptionDataBuilder $optionDataBuilder * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList * @param \Magento\Framework\Locale\ResolverInterface $localeResolver @@ -143,12 +133,14 @@ class Attribute extends \Magento\Eav\Model\Entity\Attribute public function __construct( \Magento\Framework\Model\Context $context, \Magento\Framework\Registry $registry, + \Magento\Framework\Api\MetadataServiceInterface $metadataService, \Magento\Core\Helper\Data $coreData, \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\Entity\TypeFactory $eavTypeFactory, \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Eav\Model\Resource\Helper $resourceHelper, \Magento\Framework\Validator\UniversalFactory $universalFactory, + \Magento\Eav\Api\Data\AttributeOptionDataBuilder $optionDataBuilder, \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Catalog\Model\Product\ReservedAttributeList $reservedAttributeList, \Magento\Framework\Locale\ResolverInterface $localeResolver, @@ -167,12 +159,14 @@ public function __construct( parent::__construct( $context, $registry, + $metadataService, $coreData, $eavConfig, $eavTypeFactory, $storeManager, $resourceHelper, $universalFactory, + $optionDataBuilder, $localeDate, $reservedAttributeList, $localeResolver, @@ -196,7 +190,7 @@ protected function _construct() * @return \Magento\Framework\Model\AbstractModel * @throws \Magento\Framework\Model\Exception */ - protected function _beforeSave() + public function beforeSave() { $this->setData('modulePrefix', self::MODULE_NAME); if (isset($this->_origData['is_global'])) { @@ -221,7 +215,10 @@ protected function _beforeSave() $this->setIsHtmlAllowedOnFront(1); } } - return parent::_beforeSave(); + if (!$this->getIsSearchable()) { + $this->setIsVisibleInAdvancedSearch(false); + } + return parent::beforeSave(); } /** @@ -229,7 +226,7 @@ protected function _beforeSave() * * @return \Magento\Framework\Model\AbstractModel */ - protected function _afterSave() + public function afterSave() { /** * Fix saving attribute in admin @@ -245,7 +242,7 @@ protected function _afterSave() $this->_indexerEavProcessor->markIndexerAsInvalid(); } - return parent::_afterSave(); + return parent::afterSave(); } /** @@ -282,10 +279,10 @@ protected function _isOriginalEnabledInFlat() * @return $this * @throws \Magento\Framework\Model\Exception */ - protected function _beforeDelete() + public function beforeDelete() { $this->attrLockValidator->validate($this); - return parent::_beforeDelete(); + return parent::beforeDelete(); } /** @@ -293,9 +290,9 @@ protected function _beforeDelete() * * @return $this */ - protected function _afterDeleteCommit() + public function afterDeleteCommit() { - parent::_afterDeleteCommit(); + parent::afterDeleteCommit(); if ($this->_isOriginalEnabledInFlat()) { $this->_productFlatIndexerProcessor->markIndexerAsInvalid(); @@ -503,4 +500,124 @@ public function getIndexType() return 'source'; } + + /** + * {@inheritdoc} + */ + public function getIsWysiwygEnabled() + { + return $this->getData(self::IS_WYSIWYG_ENABLED); + } + + /** + * {@inheritdoc} + */ + public function getIsHtmlAllowedOnFront() + { + return $this->getData(self::IS_HTML_ALLOWED_ON_FRONT); + } + + /** + * {@inheritdoc} + */ + public function getUsedForSortBy() + { + return $this->getData(self::USED_FOR_SORT_BY); + } + + /** + * {@inheritdoc} + */ + public function getIsFilterable() + { + return $this->getData(self::IS_FILTERABLE); + } + + /** + * {@inheritdoc} + */ + public function getIsFilterableInSearch() + { + return $this->getData(self::IS_FILTERABLE_IN_SEARCH); + } + + /** + * {@inheritdoc} + */ + public function getPosition() + { + return $this->getData(self::POSITION); + } + + /** + * {@inheritdoc} + */ + public function getIsConfigurable() + { + return $this->getData(self::IS_CONFIGURABLE); + } + + /** + * {@inheritdoc} + */ + public function getIsSearchable() + { + return $this->getData(self::IS_SEARCHABLE); + } + + /** + * {@inheritdoc} + */ + public function getIsVisibleInAdvancedSearch() + { + return $this->getData(self::IS_VISIBLE_IN_ADVANCED_SEARCH); + } + + /** + * {@inheritdoc} + */ + public function getIsComparable() + { + return $this->getData(self::IS_COMPARABLE); + } + + /** + * {@inheritdoc} + */ + public function getIsUsedForPromoRules() + { + return $this->getData(self::IS_USED_FOR_PROMO_RULES); + } + + /** + * {@inheritdoc} + */ + public function getIsVisibleOnFront() + { + return $this->getData(self::IS_VISIBLE_ON_FRONT); + } + + /** + * {@inheritdoc} + */ + public function getUsedInProductListing() + { + return $this->getData(self::USED_IN_PRODUCT_LISTING); + } + + /** + * {@inheritdoc} + */ + public function getIsVisible() + { + return $this->getData(self::IS_VISIBLE); + } + + /** + * {@inheritdoc} + */ + public function getScope() + { + return $this->isScopeGlobal() ? 'global' : ($this->isScopeWebsite() ? 'website' : 'store'); + } } diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php index be984995b84f1..b7fd22b243cfe 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Attribute.php @@ -43,11 +43,12 @@ protected function _construct() /** * Apply attribute filter to product collection * - * @param \Magento\Catalog\Model\Layer\Filter\Attribute $filter + * @param \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter * @param int $value + * @throws \Magento\Framework\Model\Exception * @return $this */ - public function applyFilterToCollection($filter, $value) + public function applyFilterToCollection(\Magento\Catalog\Model\Layer\Filter\FilterInterface $filter, $value) { $collection = $filter->getLayer()->getProductCollection(); $attribute = $filter->getAttributeModel(); @@ -72,10 +73,11 @@ public function applyFilterToCollection($filter, $value) /** * Retrieve array with products counts per attribute option * - * @param \Magento\Catalog\Model\Layer\Filter\Attribute $filter + * @param \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter + * @throws \Magento\Framework\Model\Exception * @return array */ - public function getCount($filter) + public function getCount(\Magento\Catalog\Model\Layer\Filter\FilterInterface $filter) { // clone select from collection with filters $select = clone $filter->getLayer()->getProductCollection()->getSelect(); diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php index df7b61673dcb7..47b74ab9f9d65 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Decimal.php @@ -43,12 +43,13 @@ protected function _construct() /** * Apply attribute filter to product collection * - * @param \Magento\Catalog\Model\Layer\Filter\Decimal $filter + * @param \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter * @param float $range * @param int $index + * @throws \Magento\Framework\Model\Exception * @return $this */ - public function applyFilterToCollection($filter, $range, $index) + public function applyFilterToCollection(\Magento\Catalog\Model\Layer\Filter\FilterInterface $filter, $range, $index) { $collection = $filter->getLayer()->getProductCollection(); $attribute = $filter->getAttributeModel(); @@ -80,10 +81,10 @@ public function applyFilterToCollection($filter, $range, $index) /** * Retrieve array of minimal and maximal values * - * @param \Magento\Catalog\Model\Layer\Filter\Decimal $filter + * @param \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter * @return array */ - public function getMinMax($filter) + public function getMinMax(\Magento\Catalog\Model\Layer\Filter\FilterInterface $filter) { $select = $this->_getSelect($filter); $adapter = $this->_getReadAdapter(); @@ -104,7 +105,8 @@ public function getMinMax($filter) * Retrieve clean select with joined index table * Joined table has index * - * @param \Magento\Catalog\Model\Layer\Filter\Decimal $filter + * @param \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter + * @throws \Magento\Framework\Model\Exception * @return \Magento\Framework\DB\Select */ protected function _getSelect($filter) @@ -140,11 +142,11 @@ protected function _getSelect($filter) /** * Retrieve array with products counts per range * - * @param \Magento\Catalog\Model\Layer\Filter\Decimal $filter + * @param \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter * @param int $range * @return array */ - public function getCount($filter, $range) + public function getCount(\Magento\Catalog\Model\Layer\Filter\FilterInterface $filter, $range) { $select = $this->_getSelect($filter); $adapter = $this->_getReadAdapter(); diff --git a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php index 594f0d7f5524d..f9d2134d754cb 100644 --- a/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php +++ b/app/code/Magento/Catalog/Model/Resource/Layer/Filter/Price.php @@ -58,18 +58,18 @@ class Price extends \Magento\Framework\Model\Resource\Db\AbstractDb /** * @param \Magento\Framework\App\Resource $resource * @param \Magento\Framework\Event\ManagerInterface $eventManager - * @param \Magento\Catalog\Model\Layer\Category $layer + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param \Magento\Customer\Model\Session $session * @param \Magento\Framework\StoreManagerInterface $storeManager */ public function __construct( \Magento\Framework\App\Resource $resource, \Magento\Framework\Event\ManagerInterface $eventManager, - \Magento\Catalog\Model\Layer\Category $layer, + \Magento\Catalog\Model\Layer\Resolver $layerResolver, \Magento\Customer\Model\Session $session, \Magento\Framework\StoreManagerInterface $storeManager ) { - $this->layer = $layer; + $this->layer = $layerResolver->get(); $this->session = $session; $this->storeManager = $storeManager; $this->_eventManager = $eventManager; @@ -339,12 +339,12 @@ public function loadNextPrices($price, $rightIndex, $upperPrice = null) /** * Apply price range filter to product collection * - * @param \Magento\Catalog\Model\Layer\Filter\Price $filter + * @param \Magento\Catalog\Model\Layer\Filter\FilterInterface $filter + * @param mixed $interval * @return $this */ - public function applyPriceRange($filter) + public function applyPriceRange(\Magento\Catalog\Model\Layer\Filter\FilterInterface $filter, $interval) { - $interval = $filter->getInterval(); if (!$interval) { return $this; } diff --git a/app/code/Magento/Catalog/Model/Resource/Product.php b/app/code/Magento/Catalog/Model/Resource/Product.php index 9b7e0d30cc006..632fcc5e53bab 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product.php +++ b/app/code/Magento/Catalog/Model/Resource/Product.php @@ -59,8 +59,21 @@ class Product extends AbstractResource protected $_categoryCollectionFactory; /** - * Construct - * + * @var \Magento\Framework\Event\ManagerInterface + */ + protected $eventManager; + + /** + * @var \Magento\Eav\Model\Entity\Attribute\SetFactory + */ + protected $setFactory; + + /** + * @var \Magento\Eav\Model\Entity\TypeFactory + */ + protected $typeFactory; + + /** * @param \Magento\Framework\App\Resource $resource * @param \Magento\Eav\Model\Config $eavConfig * @param \Magento\Eav\Model\Entity\Attribute\Set $attrSetEntity @@ -69,8 +82,11 @@ class Product extends AbstractResource * @param \Magento\Framework\Validator\UniversalFactory $universalFactory * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Factory $modelFactory - * @param \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryCollectionFactory + * @param Category\CollectionFactory $categoryCollectionFactory * @param Category $catalogCategory + * @param \Magento\Framework\Event\ManagerInterface $eventManager + * @param \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory + * @param \Magento\Eav\Model\Entity\TypeFactory $typeFactory * @param array $data * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -86,10 +102,16 @@ public function __construct( \Magento\Catalog\Model\Factory $modelFactory, \Magento\Catalog\Model\Resource\Category\CollectionFactory $categoryCollectionFactory, Category $catalogCategory, + \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Eav\Model\Entity\Attribute\SetFactory $setFactory, + \Magento\Eav\Model\Entity\TypeFactory $typeFactory, $data = array() ) { $this->_categoryCollectionFactory = $categoryCollectionFactory; $this->_catalogCategory = $catalogCategory; + $this->eventManager = $eventManager; + $this->setFactory = $setFactory; + $this->typeFactory = $typeFactory; parent::__construct( $resource, $eavConfig, @@ -246,6 +268,19 @@ protected function _afterSave(\Magento\Framework\Object $product) return parent::_afterSave($product); } + /** + * {@inheritdoc} + */ + public function delete($object) + { + $result = parent::delete($object); + $this->eventManager->dispatch( + 'catalog_product_delete_after_done', + array('product' => $object) + ); + return $result; + } + /** * Save product website relations * @@ -599,4 +634,19 @@ public function countAll() $result = (int)$adapter->fetchOne($select); return $result; } + + /** + * {@inheritdoc} + */ + public function validate($object) + { + //validate attribute set entity type + $entityType = $this->typeFactory->create()->loadByCode(\Magento\Catalog\Model\Product::ENTITY); + $attributeSet = $this->setFactory->create()->load($object->getAttributeSetId()); + if ($attributeSet->getEntityTypeId() != $entityType->getId()) { + return ['attribute_set' => 'Invalid attribute set entity type']; + } + + return parent::validate($object); + } } diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php index 6a35f9315be35..f7b0bfc32ce81 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Backend/Media.php @@ -63,26 +63,33 @@ public function loadGallery($product, $object) // Select gallery images for product $select = $adapter->select()->from( - array('main' => $this->getMainTable()), - array('value_id', 'value AS file') + ['main' => $this->getMainTable()], + [ + 'value_id', + 'file' => 'value' + ] )->joinLeft( - array('value' => $this->getTable(self::GALLERY_VALUE_TABLE)), + ['value' => $this->getTable(self::GALLERY_VALUE_TABLE)], $adapter->quoteInto('main.value_id = value.value_id AND value.store_id = ?', (int)$product->getStoreId()), - array('label', 'position', 'disabled') + [ + 'label', + 'position', + 'disabled' + ] )->joinLeft( // Joining default values - array('default_value' => $this->getTable(self::GALLERY_VALUE_TABLE)), + ['default_value' => $this->getTable(self::GALLERY_VALUE_TABLE)], 'main.value_id = default_value.value_id AND default_value.store_id = 0', - array('label_default' => 'label', 'position_default' => 'position', 'disabled_default' => 'disabled') + ['label_default' => 'label', 'position_default' => 'position', 'disabled_default' => 'disabled'] )->where( 'main.attribute_id = ?', $object->getAttribute()->getId() )->where( 'main.entity_id = ?', $product->getId() - )->order( - $positionCheckSql . ' ' . \Magento\Framework\DB\Select::SQL_ASC - ); + ) + ->where($positionCheckSql . ' IS NOT NULL') + ->order($positionCheckSql . ' ' . \Magento\Framework\DB\Select::SQL_ASC); $result = $adapter->fetchAll($select); $this->_removeDuplicates($result); diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php index bad88547c508b..7b10431ddd666 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Attribute/Collection.php @@ -41,6 +41,7 @@ class Collection extends \Magento\Eav\Model\Resource\Entity\Attribute\Collection * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy * @param \Magento\Framework\Event\ManagerInterface $eventManager * @param \Magento\Eav\Model\EntityFactory $eavEntityFactory + * @param \Magento\Eav\Model\Config $eavConfig * @param \Zend_Db_Adapter_Abstract $connection * @param \Magento\Framework\Model\Resource\Db\AbstractDb $resource */ @@ -49,12 +50,13 @@ public function __construct( \Magento\Framework\Logger $logger, \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy, \Magento\Framework\Event\ManagerInterface $eventManager, + \Magento\Eav\Model\Config $eavConfig, \Magento\Eav\Model\EntityFactory $eavEntityFactory, $connection = null, \Magento\Framework\Model\Resource\Db\AbstractDb $resource = null ) { $this->_eavEntityFactory = $eavEntityFactory; - parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource); + parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $eavConfig, $connection, $resource); } /** diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php index 1c7709593681e..fa3b910bc3353 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Collection.php @@ -25,9 +25,9 @@ use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; +use Magento\Customer\Api\GroupManagementInterface; use Magento\Framework\DB\Select; use Magento\Store\Model\Store; -use Magento\Customer\Service\V1\CustomerGroupServiceInterface; /** * Product collection @@ -260,6 +260,11 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl */ protected $dateTime; + /** + * @var GroupManagementInterface + */ + protected $_groupManagement; + /** * @param \Magento\Core\Model\EntityFactory $entityFactory * @param \Magento\Framework\Logger $logger @@ -279,6 +284,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Collection\AbstractColl * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Framework\Stdlib\DateTime $dateTime + * @param GroupManagementInterface $groupManagement * @param \Zend_Db_Adapter_Abstract $connection * * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -302,6 +308,7 @@ public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Stdlib\DateTime $dateTime, + GroupManagementInterface $groupManagement, $connection = null ) { $this->moduleManager = $moduleManager; @@ -313,6 +320,7 @@ public function __construct( $this->_customerSession = $customerSession; $this->_resourceHelper = $resourceHelper; $this->dateTime = $dateTime; + $this->_groupManagement = $groupManagement; parent::__construct( $entityFactory, $logger, @@ -382,9 +390,8 @@ protected function _preparePriceExpressionParameters($select) */ public function getPriceExpression($select) { - if (null === $this->_priceExpression) { - $this->_preparePriceExpressionParameters($select); - } + //@todo: Add caching of price expresion + $this->_preparePriceExpressionParameters($select); return $this->_priceExpression; } @@ -2044,7 +2051,7 @@ public function addTierPriceData() foreach ($adapter->fetchAll($select) as $row) { $tierPrices[$row['product_id']][] = array( 'website_id' => $row['website_id'], - 'cust_group' => $row['all_groups'] ? CustomerGroupServiceInterface::CUST_GROUP_ALL : $row['cust_group'], + 'cust_group' => $row['all_groups'] ? $this->_groupManagement->getAllCustomersGroup()->getId() : $row['cust_group'], 'price_qty' => $row['price_qty'], 'price' => $row['price'], 'website_price' => $row['price'] diff --git a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php index fbdee28a69e73..3df10d62496d9 100644 --- a/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php +++ b/app/code/Magento/Catalog/Model/Resource/Product/Compare/Item/Collection.php @@ -85,6 +85,7 @@ class Collection extends \Magento\Catalog\Model\Resource\Product\Collection * @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate * @param \Magento\Customer\Model\Session $customerSession * @param \Magento\Framework\Stdlib\DateTime $dateTime + * @param \Magento\Customer\Api\GroupManagementInterface $groupManagement * @param \Magento\Catalog\Model\Resource\Product\Compare\Item $catalogProductCompareItem * @param \Magento\Catalog\Helper\Product\Compare $catalogProductCompare * @param \Zend_Db_Adapter_Abstract $connection @@ -110,6 +111,7 @@ public function __construct( \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate, \Magento\Customer\Model\Session $customerSession, \Magento\Framework\Stdlib\DateTime $dateTime, + \Magento\Customer\Api\GroupManagementInterface $groupManagement, \Magento\Catalog\Model\Resource\Product\Compare\Item $catalogProductCompareItem, \Magento\Catalog\Helper\Product\Compare $catalogProductCompare, $connection = null @@ -135,6 +137,7 @@ public function __construct( $localeDate, $customerSession, $dateTime, + $groupManagement, $connection ); } diff --git a/app/code/Magento/Catalog/Model/Resource/Setup.php b/app/code/Magento/Catalog/Model/Resource/Setup.php index 3dd73ed183ea9..0e6e8d6c3ebd1 100644 --- a/app/code/Magento/Catalog/Model/Resource/Setup.php +++ b/app/code/Magento/Catalog/Model/Resource/Setup.php @@ -383,6 +383,7 @@ public function getDefaultEntities() 'type' => 'varchar', 'label' => 'Name', 'input' => 'text', + 'frontend_class' => 'validate-length maximum-length-255', 'sort_order' => 1, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'searchable' => true, @@ -394,6 +395,7 @@ public function getDefaultEntities() 'type' => 'static', 'label' => 'SKU', 'input' => 'text', + 'frontend_class' => 'validate-length maximum-length-64', 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Sku', 'unique' => true, 'sort_order' => 2, @@ -447,7 +449,7 @@ public function getDefaultEntities() 'input' => 'price', 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Price', 'required' => false, - 'sort_order' => 2, + 'sort_order' => 3, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, 'used_in_product_listing' => true, 'apply_to' => 'simple,virtual', @@ -459,7 +461,7 @@ public function getDefaultEntities() 'input' => 'date', 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate', 'required' => false, - 'sort_order' => 3, + 'sort_order' => 4, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, 'used_in_product_listing' => true, 'apply_to' => 'simple,virtual', @@ -471,7 +473,7 @@ public function getDefaultEntities() 'input' => 'date', 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Datetime', 'required' => false, - 'sort_order' => 4, + 'sort_order' => 5, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, 'used_in_product_listing' => true, 'apply_to' => 'simple,virtual', @@ -484,7 +486,7 @@ public function getDefaultEntities() 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Price', 'required' => false, 'user_defined' => true, - 'sort_order' => 5, + 'sort_order' => 6, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, 'apply_to' => 'simple,virtual', 'group' => 'Prices' @@ -493,8 +495,10 @@ public function getDefaultEntities() 'type' => 'decimal', 'label' => 'Weight', 'input' => 'weight', + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Weight', + 'input_renderer' => 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Weight', 'sort_order' => 5, - 'apply_to' => \Magento\Catalog\Model\Product\Type::TYPE_SIMPLE + 'apply_to' => 'simple,virtual' ), 'manufacturer' => array( 'type' => 'int', @@ -542,10 +546,12 @@ public function getDefaultEntities() 'label' => 'Base Image', 'input' => 'media_image', 'frontend' => 'Magento\Catalog\Model\Product\Attribute\Frontend\Image', + 'input_renderer' => 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\BaseImage', 'required' => false, - 'sort_order' => 1, + 'sort_order' => 0, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, - 'group' => 'Images' + 'used_in_product_listing' => true, + 'group' => 'General' ), 'small_image' => array( 'type' => 'varchar', @@ -585,7 +591,7 @@ public function getDefaultEntities() 'input' => 'text', 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice', 'required' => false, - 'sort_order' => 6, + 'sort_order' => 2, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, 'apply_to' => 'simple,virtual', 'group' => 'Prices' @@ -596,7 +602,7 @@ public function getDefaultEntities() 'input' => 'text', 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Tierprice', 'required' => false, - 'sort_order' => 6, + 'sort_order' => 7, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, 'apply_to' => 'simple,virtual', 'group' => 'Prices' @@ -617,7 +623,7 @@ public function getDefaultEntities() 'type' => 'datetime', 'label' => 'Set Product as New from Date', 'input' => 'date', - 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Datetime', + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate', 'required' => false, 'sort_order' => 7, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, @@ -656,7 +662,7 @@ public function getDefaultEntities() 'label' => 'Minimal Price', 'input' => 'price', 'required' => false, - 'sort_order' => 7, + 'sort_order' => 8, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, 'visible' => false, 'apply_to' => 'simple,virtual', @@ -685,7 +691,7 @@ public function getDefaultEntities() 'type' => 'datetime', 'label' => 'Active From', 'input' => 'date', - 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Datetime', + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate', 'required' => false, 'sort_order' => 2, 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_STORE, @@ -723,10 +729,14 @@ public function getDefaultEntities() ), 'category_ids' => array( 'type' => 'static', + 'label' => 'Categories', 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Category', + 'input_renderer' => 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Category', 'required' => false, - 'sort_order' => 13, - 'visible' => false + 'sort_order' => 9, + 'visible' => true, + 'group' => 'General' ), 'options_container' => array( 'type' => 'varchar', @@ -797,6 +807,41 @@ public function getDefaultEntities() 'backend' => 'Magento\Eav\Model\Entity\Attribute\Backend\Time\Updated', 'sort_order' => 20, 'visible' => false + ), + 'country_of_manufacture' => array( + 'type' => 'varchar', + 'label' => 'Country of Manufacture', + 'input' => 'select', + 'source' => 'Magento\Catalog\Model\Product\Attribute\Source\Countryofmanufacture', + 'required' => false, + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, + 'visible' => true, + 'user_defined' => false, + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'visible_on_front' => false, + 'unique' => false, + 'apply_to' => 'simple,bundle', + 'group' => 'General', + ), + 'quantity_and_stock_status' => array( + 'group' => 'General', + 'type' => 'int', + 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Stock', + 'label' => 'Quantity', + 'input' => 'select', + 'input_renderer' => 'Magento\CatalogInventory\Block\Adminhtml\Form\Field\Stock', + 'source' => 'Magento\\CatalogInventory\\Model\\Source\\Stock', + 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, + 'default' => \Magento\CatalogInventory\Model\Stock::STOCK_IN_STOCK, + 'user_defined' => false, + 'visible' => true, + 'required' => false, + 'searchable' => false, + 'filterable' => false, + 'comparable' => false, + 'unique' => false ) ) ) diff --git a/app/code/Magento/Catalog/Model/Rss/Category.php b/app/code/Magento/Catalog/Model/Rss/Category.php index 9a7f34bbadfdd..47736d9b8bf25 100644 --- a/app/code/Magento/Catalog/Model/Rss/Category.php +++ b/app/code/Magento/Catalog/Model/Rss/Category.php @@ -45,16 +45,16 @@ class Category protected $visibility; /** - * @param \Magento\Catalog\Model\Layer\Category $catalogLayer + * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver * @param \Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory * @param \Magento\Catalog\Model\Product\Visibility $visibility */ public function __construct( - \Magento\Catalog\Model\Layer\Category $catalogLayer, + \Magento\Catalog\Model\Layer\Resolver $layerResolver, \Magento\Catalog\Model\Resource\Product\CollectionFactory $collectionFactory, \Magento\Catalog\Model\Product\Visibility $visibility ) { - $this->catalogLayer = $catalogLayer; + $this->catalogLayer = $layerResolver->get(); $this->collectionFactory = $collectionFactory; $this->visibility = $visibility; } diff --git a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php index a86383cc8cffc..05d69cce83f4d 100644 --- a/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php +++ b/app/code/Magento/Catalog/Model/System/Config/Backend/Catalog/Url/Rewrite/Suffix.php @@ -86,7 +86,7 @@ public function __construct( * * @return $this */ - protected function _beforeSave() + public function beforeSave() { $this->urlRewriteHelper->validateSuffix($this->getValue()); return $this; @@ -95,12 +95,12 @@ protected function _beforeSave() /** * @return $this */ - protected function _afterSave() + public function afterSave() { if ($this->isValueChanged()) { $this->updateSuffixForUrlRewrites(); } - return parent::_afterSave(); + return parent::afterSave(); } /** diff --git a/app/code/Magento/Catalog/Pricing/Price/ConfiguredPrice.php b/app/code/Magento/Catalog/Pricing/Price/ConfiguredPrice.php index 1498d9f2ebc19..5104472262605 100644 --- a/app/code/Magento/Catalog/Pricing/Price/ConfiguredPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/ConfiguredPrice.php @@ -47,16 +47,18 @@ class ConfiguredPrice extends FinalPrice implements ConfiguredPriceInterface * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator + * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency * @param ItemInterface $item */ public function __construct( Product $saleableItem, $quantity, CalculatorInterface $calculator, + \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, ItemInterface $item = null ) { $this->item = $item; - parent::__construct($saleableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator, $priceCurrency); } /** diff --git a/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php b/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php index 10c5472f8a170..b86518acf69de 100644 --- a/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/FinalPrice.php @@ -43,6 +43,16 @@ class FinalPrice extends AbstractPrice implements FinalPriceInterface */ private $basePrice; + /** + * @var \Magento\Framework\Pricing\Amount\AmountInterface + */ + protected $minimalPrice; + + /** + * @var \Magento\Framework\Pricing\Amount\AmountInterface + */ + protected $maximalPrice; + /** * Get Value * @@ -60,11 +70,16 @@ public function getValue() */ public function getMinimalPrice() { - $minimalPrice = $this->product->getMinimalPrice(); - if ($minimalPrice === null) { - $minimalPrice = $this->getValue(); + if (!$this->minimalPrice) { + $minimalPrice = $this->product->getMinimalPrice(); + if ($minimalPrice === null) { + $minimalPrice = $this->getValue(); + } else { + $minimalPrice = $this->priceCurrency->convertAndRound($minimalPrice); + } + $this->minimalPrice = $this->calculator->getAmount($minimalPrice, $this->product); } - return $this->calculator->getAmount($minimalPrice, $this->product); + return $this->minimalPrice; } /** @@ -74,7 +89,10 @@ public function getMinimalPrice() */ public function getMaximalPrice() { - return $this->calculator->getAmount($this->getValue(), $this->product); + if (!$this->maximalPrice) { + $this->maximalPrice = $this->calculator->getAmount($this->getValue(), $this->product); + } + return $this->maximalPrice; } /** diff --git a/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php b/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php index 626f76151d28e..ba2d4db3d7d46 100644 --- a/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/GroupPrice.php @@ -33,7 +33,7 @@ /** * Group price model */ -class GroupPrice extends AbstractPrice implements GroupPriceInterface, BasePriceProviderInterface +class GroupPrice extends AbstractPrice implements BasePriceProviderInterface { /** * Price type group @@ -54,15 +54,17 @@ class GroupPrice extends AbstractPrice implements GroupPriceInterface, BasePrice * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator + * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency * @param Session $customerSession */ public function __construct( Product $saleableItem, $quantity, CalculatorInterface $calculator, + \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, Session $customerSession ) { - parent::__construct($saleableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator, $priceCurrency); $this->customerSession = $customerSession; } @@ -77,6 +79,9 @@ public function getValue() foreach ($this->getStoredGroupPrice() as $groupPrice) { if ($groupPrice['cust_group'] == $customerGroup) { $this->value = (float) $groupPrice['website_price']; + if (!$this->isPercentageDiscount()) { + $this->value = $this->priceCurrency->convertAndRound($this->value); + } break; } } @@ -98,7 +103,7 @@ protected function getCustomerGroupId() /** * @return array */ - public function getStoredGroupPrice() + protected function getStoredGroupPrice() { if (null === $this->storedGroupPrice) { $resource = $this->product->getResource(); @@ -113,4 +118,12 @@ public function getStoredGroupPrice() } return $this->storedGroupPrice; } + + /** + * @return bool + */ + public function isPercentageDiscount() + { + return false; + } } diff --git a/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php b/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php index e067dc4fa03a7..c9e0370cdef2c 100644 --- a/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/RegularPrice.php @@ -46,7 +46,8 @@ public function getValue() { if ($this->value === null) { $price = $this->product->getPrice(); - $this->value = $price ? floatval($price) : false; + $priceInCurrentCurrency = $this->priceCurrency->convertAndRound($price); + $this->value = $priceInCurrentCurrency ? floatval($priceInCurrentCurrency) : false; } return $this->value; } diff --git a/app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php b/app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php index bab2c64e8132d..4def55e30818c 100644 --- a/app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/SpecialPrice.php @@ -49,15 +49,17 @@ class SpecialPrice extends AbstractPrice implements SpecialPriceInterface, BaseP * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator + * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency * @param TimezoneInterface $localeDate */ public function __construct( Product $saleableItem, $quantity, CalculatorInterface $calculator, + \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, TimezoneInterface $localeDate ) { - parent::__construct($saleableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator, $priceCurrency); $this->localeDate = $localeDate; } @@ -84,7 +86,11 @@ public function getValue() */ public function getSpecialPrice() { - return $this->product->getSpecialPrice(); + $specialPrice = $this->product->getSpecialPrice(); + if (!is_null($specialPrice) && $specialPrice !== false && !$this->isPercentageDiscount()) { + $specialPrice = $this->priceCurrency->convertAndRound($specialPrice); + } + return $specialPrice; } /** @@ -118,4 +124,12 @@ public function isScopeDateInInterval() $this->getSpecialToDate() ); } + + /** + * @return bool + */ + public function isPercentageDiscount() + { + return false; + } } diff --git a/app/code/Magento/Catalog/Pricing/Price/SpecialPriceInterface.php b/app/code/Magento/Catalog/Pricing/Price/SpecialPriceInterface.php index b319b7f66fe1f..3b0bfe633f6e7 100644 --- a/app/code/Magento/Catalog/Pricing/Price/SpecialPriceInterface.php +++ b/app/code/Magento/Catalog/Pricing/Price/SpecialPriceInterface.php @@ -54,4 +54,9 @@ public function getSpecialToDate(); * @return bool */ public function isScopeDateInInterval(); + + /** + * @return bool + */ + public function isPercentageDiscount(); } diff --git a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php index d12080b57a94f..2bae3efb0e145 100644 --- a/app/code/Magento/Catalog/Pricing/Price/TierPrice.php +++ b/app/code/Magento/Catalog/Pricing/Price/TierPrice.php @@ -26,7 +26,7 @@ use Magento\Framework\Pricing\Adjustment\CalculatorInterface; use Magento\Catalog\Model\Product; -use Magento\Customer\Model\Group; +use Magento\Customer\Api\GroupManagementInterface; use Magento\Customer\Model\Session; use Magento\Framework\Pricing\Price\AbstractPrice; use Magento\Framework\Pricing\PriceInfoInterface; @@ -71,17 +71,22 @@ class TierPrice extends AbstractPrice implements TierPriceInterface, BasePricePr * @param Product $saleableItem * @param float $quantity * @param CalculatorInterface $calculator + * @param \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency * @param Session $customerSession + * @param GroupManagementInterface $groupManagement */ public function __construct( Product $saleableItem, $quantity, CalculatorInterface $calculator, - Session $customerSession + \Magento\Framework\Pricing\PriceCurrencyInterface $priceCurrency, + Session $customerSession, + GroupManagementInterface $groupManagement ) { $quantity = $quantity ?: 1; - parent::__construct($saleableItem, $quantity, $calculator); + parent::__construct($saleableItem, $quantity, $calculator, $priceCurrency); $this->customerSession = $customerSession; + $this->groupManagement = $groupManagement; if ($saleableItem->hasCustomerGroupId()) { $this->customerGroup = (int) $saleableItem->getCustomerGroupId(); } else { @@ -100,7 +105,7 @@ public function getValue() $prices = $this->getStoredTierPrices(); $prevQty = PriceInfoInterface::PRODUCT_QUANTITY_DEFAULT; $this->value = $prevPrice = $tierPrice = false; - $priceGroup = Group::CUST_GROUP_ALL; + $priceGroup = $this->groupManagement->getAllCustomersGroup()->getId(); foreach ($prices as $price) { if (!$this->canApplyTierPrice($price, $priceGroup, $prevQty)) { @@ -168,7 +173,7 @@ protected function filterTierPrices(array $priceList) $qtyCache = []; foreach ($priceList as $priceKey => $price) { /* filter price by customer group */ - if ($price['cust_group'] !== $this->customerGroup && $price['cust_group'] !== Group::CUST_GROUP_ALL) { + if ($price['cust_group'] !== $this->customerGroup && $price['cust_group'] !== $this->groupManagement->getAllCustomersGroup()->getId()) { unset($priceList[$priceKey]); continue; } @@ -228,10 +233,11 @@ protected function applyAdjustment($price) */ protected function canApplyTierPrice(array $currentTierPrice, $prevPriceGroup, $prevQty) { + $custGroupAllId = $this->groupManagement->getAllCustomersGroup()->getId(); // Tier price can be applied, if: // tier price is for current customer group or is for all groups if ($currentTierPrice['cust_group'] !== $this->customerGroup - && $currentTierPrice['cust_group'] !== Group::CUST_GROUP_ALL + && $currentTierPrice['cust_group'] !== $custGroupAllId ) { return false; } @@ -245,8 +251,8 @@ protected function canApplyTierPrice(array $currentTierPrice, $prevPriceGroup, $ } // and found tier qty is same as previous tier qty, but current tier group isn't ALL_GROUPS if ($currentTierPrice['price_qty'] == $prevQty - && $prevPriceGroup !== Group::CUST_GROUP_ALL - && $currentTierPrice['cust_group'] === Group::CUST_GROUP_ALL + && $prevPriceGroup !== $custGroupAllId + && $currentTierPrice['cust_group'] === $custGroupAllId ) { return false; } @@ -273,7 +279,27 @@ protected function getStoredTierPrices() if (null === $this->rawPriceList || !is_array($this->rawPriceList)) { $this->rawPriceList = array(); } + if (!$this->isPercentageDiscount()) { + foreach ($this->rawPriceList as $index => $rawPrice) { + if (isset($rawPrice['price'])) { + $this->rawPriceList[$index]['price'] = + $this->priceCurrency->convertAndRound($rawPrice['price']); + } + if (isset($rawPrice['website_price'])) { + $this->rawPriceList[$index]['website_price'] = + $this->priceCurrency->convertAndRound($rawPrice['website_price']); + } + } + } } return $this->rawPriceList; } + + /** + * @return bool + */ + public function isPercentageDiscount() + { + return false; + } } diff --git a/app/code/Magento/Catalog/Pricing/Price/TierPriceInterface.php b/app/code/Magento/Catalog/Pricing/Price/TierPriceInterface.php index 184628b9c6b6e..075cc90f1e024 100644 --- a/app/code/Magento/Catalog/Pricing/Price/TierPriceInterface.php +++ b/app/code/Magento/Catalog/Pricing/Price/TierPriceInterface.php @@ -38,4 +38,9 @@ public function getTierPriceList(); * @return int */ public function getTierPriceCount(); + + /** + * @return bool + */ + public function isPercentageDiscount(); } diff --git a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php index 2085b806b0136..379f2b56df5e5 100644 --- a/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php +++ b/app/code/Magento/Catalog/Pricing/Render/FinalPriceBox.php @@ -64,7 +64,8 @@ protected function _toHtml() MsrpPrice::PRICE_CODE, $this->getSaleableItem(), [ - 'real_price_html' => $result + 'real_price_html' => $result, + 'zone' => $this->getZone(), ] ); $result = $msrpBlock->toHtml(); diff --git a/app/code/Magento/Catalog/Service/V1/Category/Attribute/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/Attribute/ReadServiceInterface.php index 946958e59b185..2ed210b2d81ed 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/Attribute/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/Attribute/ReadServiceInterface.php @@ -35,6 +35,7 @@ interface ReadServiceInterface * @return \Magento\Catalog\Service\V1\Data\Eav\Option[] * * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated */ public function options($id); @@ -45,6 +46,7 @@ public function options($id); * @return \Magento\Catalog\Service\V1\Data\Eav\AttributeMetadata * * @throws \Magento\Framework\Exception\NoSuchEntityException + * @see \Magento\Catalog\Api\CategoryAttributeRepositoryInterface::get */ public function info($id); @@ -53,6 +55,7 @@ public function info($id); * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Catalog\Service\V1\Data\Product\Attribute\SearchResults containing Data\Eav\Attribute objects + * @see \Magento\Catalog\Api\CategoryAttributeRepositoryInterface::getList */ public function search(\Magento\Framework\Api\SearchCriteria $searchCriteria); } diff --git a/app/code/Magento/Catalog/Service/V1/Category/MetadataServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/MetadataServiceInterface.php index e51478b84fb20..48e94bae95c89 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/MetadataServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/MetadataServiceInterface.php @@ -27,6 +27,8 @@ /** * Class Category MetadataServiceInterface + * @deprecated + * @see \Magento\Catalog\Api\CategoryAttributeMetadataRepositoryInterface */ interface MetadataServiceInterface extends \Magento\Framework\Api\MetadataServiceInterface { @@ -37,7 +39,7 @@ interface MetadataServiceInterface extends \Magento\Framework\Api\MetadataServic const DEFAULT_ATTRIBUTE_SET_ID = 3; - const DATA_OBJECT_CLASS_NAME = 'Magento\Catalog\Service\V1\Data\Category'; + const DATA_OBJECT_CLASS_NAME = 'Magento\Catalog\Api\Data\CategoryInterface'; /**#@-*/ /** diff --git a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceInterface.php index 2d9601c55df9c..819a7375e5e76 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/ReadServiceInterface.php @@ -23,12 +23,19 @@ */ namespace Magento\Catalog\Service\V1\Category\ProductLinks; +/** + * @deprecated + * @todo remove this interface + */ interface ReadServiceInterface { /** * @param int $categoryId * @return \Magento\Catalog\Service\V1\Data\Category\ProductLink[] * @throws \Magento\Framework\Exception\NoSuchEntityException + * + * @deprecated + * @see \Magento\Catalog\Api\CategoryLinkManagementInterface::getList */ public function assignedProducts($categoryId); } diff --git a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceInterface.php index bcf6f75250404..4f634e7c9a401 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/ProductLinks/WriteServiceInterface.php @@ -25,6 +25,10 @@ use Magento\Catalog\Service\V1\Data\Category\ProductLink; +/** + * @deprecated + * @todo remove this interface + */ interface WriteServiceInterface { /** @@ -36,6 +40,9 @@ interface WriteServiceInterface * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException + * + * @deprecated + * @see \Magento\Catalog\Api\CategoryLinkManagementInterface::save */ public function assignProduct($categoryId, ProductLink $productLink); @@ -46,6 +53,9 @@ public function assignProduct($categoryId, ProductLink $productLink); * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException + * + * @deprecated + * @see \Magento\Catalog\Api\CategoryLinkManagementInterface::save */ public function updateProduct($categoryId, ProductLink $productLink); @@ -57,6 +67,9 @@ public function updateProduct($categoryId, ProductLink $productLink); * @return bool Will returned True if products sucessfully deleted * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\StateException + * + * @deprecated + * @see \Magento\Catalog\Api\CategoryLinkManagementInterface::delete */ public function removeProduct($categoryId, $productSku); } diff --git a/app/code/Magento/Catalog/Service/V1/Category/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/ReadServiceInterface.php index 2cf1d9146b8a7..a592b09fa334a 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/ReadServiceInterface.php @@ -23,6 +23,9 @@ */ namespace Magento\Catalog\Service\V1\Category; +/** + * @todo remove this interface + */ interface ReadServiceInterface { /** @@ -31,6 +34,8 @@ interface ReadServiceInterface * @param int $categoryId * @return \Magento\Catalog\Service\V1\Data\Eav\Category\Info\Metadata * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Catalog\Api\CategoryRepositoryInterface::get */ public function info($categoryId); } diff --git a/app/code/Magento/Catalog/Service/V1/Category/Tree/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/Tree/ReadServiceInterface.php index 95b7f24a128e9..c3858bcd54dff 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/Tree/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/Tree/ReadServiceInterface.php @@ -28,6 +28,8 @@ /** * Class ReadServiceInterface * @package Magento\Catalog\Service\V1\Category + * + * @todo remove this interface */ interface ReadServiceInterface { @@ -38,6 +40,8 @@ interface ReadServiceInterface * @param int $rootCategoryId * @param int $depth * @return \Magento\Catalog\Service\V1\Data\Eav\Category\Tree containing Tree objects + * @deprecated + * @see \Magento\Catalog\Api\CategoryManagementInterface::getTree */ public function tree($rootCategoryId = null, $depth = null); } diff --git a/app/code/Magento/Catalog/Service/V1/Category/WriteService.php b/app/code/Magento/Catalog/Service/V1/Category/WriteService.php index 307d05be3416c..ab7cc5960d5c7 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/WriteService.php +++ b/app/code/Magento/Catalog/Service/V1/Category/WriteService.php @@ -107,7 +107,6 @@ public function delete($categoryId) } catch (\Exception $e) { throw new StateException('Cannot delete category with id %category_id', ['category_id' => $categoryId], $e); } - return true; } @@ -124,7 +123,6 @@ public function update($categoryId, CategoryDataObject $category) } catch (\Exception $e) { throw new CouldNotSaveException('Could not save category', [], $e); } - return true; } diff --git a/app/code/Magento/Catalog/Service/V1/Category/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Category/WriteServiceInterface.php index 46d46f8729957..318bc56c3f0eb 100644 --- a/app/code/Magento/Catalog/Service/V1/Category/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Category/WriteServiceInterface.php @@ -23,6 +23,9 @@ */ namespace Magento\Catalog\Service\V1\Category; +/** + * @todo remove this interface + */ interface WriteServiceInterface { /** @@ -31,6 +34,8 @@ interface WriteServiceInterface * @param \Magento\Catalog\Service\V1\Data\Category $category * @return int * @throws \Magento\Framework\Exception\CouldNotSaveException + * @deprecated + * @see \Magento\Catalog\Api\CategoryRepositoryInterface::save */ public function create(\Magento\Catalog\Service\V1\Data\Category $category); @@ -42,6 +47,8 @@ public function create(\Magento\Catalog\Service\V1\Data\Category $category); * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\StateException * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Catalog\Api\CategoryRepositoryInterface::delete */ public function delete($categoryId); @@ -53,6 +60,8 @@ public function delete($categoryId); * @return bool * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\InputException + * @deprecated + * @see \Magento\Catalog\Api\CategoryManagementInterface::update */ public function update($categoryId, \Magento\Catalog\Service\V1\Data\Category $category); @@ -65,6 +74,8 @@ public function update($categoryId, \Magento\Catalog\Service\V1\Data\Category $c * @return bool * @throws \Magento\Framework\Model\Exception * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Catalog\Api\CategoryManagementInterface::move */ public function move($categoryId, $parentId, $afterId = null); } diff --git a/app/code/Magento/Catalog/Service/V1/Data/Category.php b/app/code/Magento/Catalog/Service/V1/Data/Category.php index 4c9dc79048db6..e5bd98f81ad3e 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Category.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category.php @@ -27,6 +27,8 @@ /** * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\CategoryInterface */ class Category extends AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Category/Mapper.php b/app/code/Magento/Catalog/Service/V1/Data/Category/Mapper.php index a384ade3e0e90..1a43f1e40569f 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Category/Mapper.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category/Mapper.php @@ -32,13 +32,21 @@ class Mapper /** @var CategoryFactory */ protected $categoryFactory; + /** + * @var \Magento\Framework\Api\ExtensibleDataObjectConverter + */ + protected $extensibleDataObjectConverter; + /** * @param CategoryFactory $categoryFactory + * @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter */ public function __construct( - CategoryFactory $categoryFactory + CategoryFactory $categoryFactory, + \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter ) { $this->categoryFactory = $categoryFactory; + $this->extensibleDataObjectConverter = $extensibleDataObjectConverter; } /** @@ -52,7 +60,7 @@ public function toModel( \Magento\Catalog\Model\Category $categoryModel = null ) { $categoryModel = $categoryModel ?: $this->categoryFactory->create(); - $data = ExtensibleDataObjectConverter::toFlatArray($category); + $data = $this->extensibleDataObjectConverter->toFlatArray($category); /** @see /app/code/Magento/Catalog/Controller/Adminhtml/Category.php method "_filterCategoryPostData" */ if (isset($data['image']) && is_array($data['image'])) { $data['image_additional_data'] = $data['image']; diff --git a/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php index 91ddadbbf7618..d50cce8ffad38 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Category/ProductLink.php @@ -24,7 +24,10 @@ namespace Magento\Catalog\Service\V1\Data\Category; /** - * @codeCoverageIgnore + * @deprecated + * @todo remove this interface + * + * Replaced with @see \Magento\Catalog\Api\Data\CategoryProductLinkInterface */ class ProductLink extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadata.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadata.php index 42af9f3191773..87856a6b63b3a 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadata.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeMetadata.php @@ -30,6 +30,8 @@ * Class AttributeMetadata * * @codeCoverageIgnore + * @deprecated + * @see \Magento\Eav\Api\Data\Entity\Attribute\MetadataInterface */ class AttributeMetadata extends AbstractExtensibleObject implements MetadataObjectInterface { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet.php index 2ab5a6171fe15..aac4a6f14982b 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/AttributeSet.php @@ -27,6 +27,8 @@ * Contains basic attribute set data * * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\AttributeSetInterface */ class AttributeSet extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadata.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadata.php index ec86ba2ccc5a5..839a4c2282ec1 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadata.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/AttributeMetadata.php @@ -28,6 +28,7 @@ /** * @codeCoverageIgnore + * @todo this interface is never used. Recheck and remove it. */ class AttributeMetadata extends AbstractExtensibleObject implements MetadataObjectInterface { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php index a0c36bb855001..61493e7d5366e 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Category/Tree.php @@ -25,6 +25,8 @@ /** * @codeCoverageIgnore + * @see \Magento\Catalog\Api\Data\CategoryTreeInterface + * @deprecated */ class Tree extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Eav/Option.php b/app/code/Magento/Catalog/Service/V1/Data/Eav/Option.php index c5453b69c048d..dc934eabe3331 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Eav/Option.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Eav/Option.php @@ -28,6 +28,8 @@ /** * Class Option * + * @deprecated + * @see \Magento\Eav\Api\Data\AttributeOptionInterface * @codeCoverageIgnore */ class Option extends \Magento\Framework\Api\AbstractExtensibleObject diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product.php b/app/code/Magento/Catalog/Service/V1/Data/Product.php index cd22db48b77e5..a41eafda4728c 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product.php @@ -25,6 +25,8 @@ /** * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Service\V1\Data\Product */ class Product extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php b/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php index da2036c621d2b..e9ac5893ca556 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product/GroupPrice.php @@ -28,6 +28,8 @@ /** * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\ProductGroupPriceInterface */ class GroupPrice extends AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php b/app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php index 948b8af2128be..cd589f9e18d4b 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php +++ b/app/code/Magento/Catalog/Service/V1/Data/Product/TierPrice.php @@ -28,6 +28,8 @@ /** * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\ProductTierPriceInterface */ class TierPrice extends AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Data/ProductMapper.php b/app/code/Magento/Catalog/Service/V1/Data/ProductMapper.php index 034f6db876c0e..3cc08ae91033f 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/ProductMapper.php +++ b/app/code/Magento/Catalog/Service/V1/Data/ProductMapper.php @@ -23,8 +23,9 @@ */ namespace Magento\Catalog\Service\V1\Data; -use \Magento\Framework\Api\ExtensibleDataObjectConverter; - +/** + * @deprecated + */ class ProductMapper { /** @var \Magento\Catalog\Model\ProductFactory */ @@ -33,16 +34,24 @@ class ProductMapper /** @var \Magento\Catalog\Model\Product\Type */ protected $productTypes; + /** + * @var \Magento\Framework\Api\ExtensibleDataObjectConverter + */ + protected $extensibleDataObjectConverter; + /** * @param \Magento\Catalog\Model\ProductFactory $productFactory * @param \Magento\Catalog\Model\Product\Type $productTypes + * @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter */ public function __construct( \Magento\Catalog\Model\ProductFactory $productFactory, - \Magento\Catalog\Model\Product\Type $productTypes + \Magento\Catalog\Model\Product\Type $productTypes, + \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter ) { $this->productFactory = $productFactory; $this->productTypes = $productTypes; + $this->extensibleDataObjectConverter = $extensibleDataObjectConverter; } /** @@ -58,8 +67,8 @@ public function toModel( $customAttributesToSkip = array() ) { /** @var \Magento\Catalog\Model\Product $productModel */ - $productModel = $productModel ? : $this->productFactory->create(); - $productModel->addData(ExtensibleDataObjectConverter::toFlatArray($product, $customAttributesToSkip)); + $productModel = $productModel ?: $this->productFactory->create(); + $productModel->addData($this->extensibleDataObjectConverter->toFlatArray($product, $customAttributesToSkip)); if (!is_numeric($productModel->getAttributeSetId())) { $productModel->setAttributeSetId($productModel->getDefaultAttributeSetId()); } diff --git a/app/code/Magento/Catalog/Service/V1/Data/ProductType.php b/app/code/Magento/Catalog/Service/V1/Data/ProductType.php index 47f458447df85..96351662eed9f 100644 --- a/app/code/Magento/Catalog/Service/V1/Data/ProductType.php +++ b/app/code/Magento/Catalog/Service/V1/Data/ProductType.php @@ -29,6 +29,8 @@ /** * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\ProductTypeInterface */ class ProductType extends AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/MetadataService.php b/app/code/Magento/Catalog/Service/V1/MetadataService.php index f9ee4c10ada4e..a930f292cb66a 100644 --- a/app/code/Magento/Catalog/Service/V1/MetadataService.php +++ b/app/code/Magento/Catalog/Service/V1/MetadataService.php @@ -37,6 +37,8 @@ * * @package Magento\Catalog\Service\V1 * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @deprecated + * @see \Magento\Eav\Api\Entity\Attribute\MetadataRepositoryInterface */ class MetadataService implements MetadataServiceInterface { diff --git a/app/code/Magento/Catalog/Service/V1/MetadataServiceInterface.php b/app/code/Magento/Catalog/Service/V1/MetadataServiceInterface.php index 4137f899c6971..b9b6b6f238356 100644 --- a/app/code/Magento/Catalog/Service/V1/MetadataServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/MetadataServiceInterface.php @@ -39,6 +39,7 @@ interface MetadataServiceInterface * @param string $attributeCode * @return AttributeMetadata * @throws \Magento\Framework\Exception\NoSuchEntityException + * @see \Magento\Eav\Api\AttributeRepositoryInterface::get */ public function getAttributeMetadata($entityType, $attributeCode); @@ -48,6 +49,7 @@ public function getAttributeMetadata($entityType, $attributeCode); * @param string $entityType * @param SearchCriteria $searchCriteria * @return SearchResults + * @see \Magento\Eav\Api\AttributeRepositoryInterface::getList */ public function getAllAttributeMetadata($entityType, SearchCriteria $searchCriteria); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/ReadServiceInterface.php index 020e95b2e2a48..91d894b5b9279 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/ReadServiceInterface.php @@ -24,6 +24,9 @@ */ namespace Magento\Catalog\Service\V1\Product\Attribute\Media; +/** + * @deprecated + */ interface ReadServiceInterface { /** @@ -33,12 +36,14 @@ interface ReadServiceInterface * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException * @return \Magento\Catalog\Service\V1\Product\Attribute\Media\Data\MediaImage[] + * @see \Magento\Catalog\Api\ProductMediaAttributeManagementInterface::getList */ public function types($attributeSetId); /** * @param string $productSku * @return \Magento\Catalog\Service\V1\Product\Attribute\Media\Data\GalleryEntry[] + * @see \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface::getList */ public function getList($productSku); @@ -49,6 +54,7 @@ public function getList($productSku); * @param int $imageId * @throws \Magento\Framework\Exception\NoSuchEntityException * @return \Magento\Catalog\Service\V1\Product\Attribute\Media\Data\GalleryEntry + * @see \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface::get */ public function info($productSku, $imageId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/WriteServiceInterface.php index c5672db0f6384..384032833835c 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Media/WriteServiceInterface.php @@ -28,6 +28,9 @@ use \Magento\Catalog\Service\V1\Product\Attribute\Media\Data\GalleryEntry; use \Magento\Catalog\Service\V1\Product\Attribute\Media\Data\GalleryEntryContent; +/** + * @deprecated + */ interface WriteServiceInterface { /** @@ -41,6 +44,7 @@ interface WriteServiceInterface * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException + * @see \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface::create */ public function create($productSku, GalleryEntry $entry, GalleryEntryContent $entryContent, $storeId = 0); @@ -53,6 +57,7 @@ public function create($productSku, GalleryEntry $entry, GalleryEntryContent $en * @return bool * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException + * @see \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface::update */ public function update($productSku, GalleryEntry $entry, $storeId = 0); @@ -64,6 +69,7 @@ public function update($productSku, GalleryEntry $entry, $storeId = 0); * @return bool * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException + * @see \Magento\Catalog\Api\ProductAttributeMediaGalleryManagementInterface::remove */ public function delete($productSku, $entryId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Option/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Option/ReadServiceInterface.php index 3f84807fe7ddb..ee3c3a4e54a01 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Option/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Option/ReadServiceInterface.php @@ -25,12 +25,17 @@ /** * Interface ReadServiceInterface + * @deprecated + * @see \Magento\Eav\Api\OptionManagementInterface */ interface ReadServiceInterface { /** * Retrieve list of attribute options * + * @deprecated + * @see \Magento\Eav\Api\AttributeOptionManagementInterface::getItems + * * @param string $id * @return \Magento\Catalog\Service\V1\Data\Eav\Option[] */ diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Option/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Option/WriteServiceInterface.php index 8a2237e83ee84..433465f000c8f 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/Option/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/Option/WriteServiceInterface.php @@ -25,12 +25,17 @@ /** * Interface WriteServiceInterface + * @deprecated + * @see \Magento\Eav\Api\AttributeOptionManagementInterface */ interface WriteServiceInterface { /** * Add option to attribute * + * @deprecated + * @see \Magento\Eav\Api\AttributeOptionManagementInterface::addOption + * * @param string $id * @param \Magento\Catalog\Service\V1\Data\Eav\Option $option * @throws \Magento\Framework\Exception\StateException @@ -41,6 +46,9 @@ public function addOption($id, \Magento\Catalog\Service\V1\Data\Eav\Option $opti /** * Delete option from attribute * + * @deprecated + * @see \Magento\Eav\Api\AttributeOptionManagementInterface::removeOption + * * @param string $id * @param int $optionId * @throws \Magento\Framework\Exception\StateException diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceInterface.php index 7af415f863a52..a853b4c4e301a 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/ReadServiceInterface.php @@ -33,6 +33,8 @@ interface ReadServiceInterface * Retrieve list of product attribute types * * @return \Magento\Catalog\Service\V1\Data\Eav\Product\Attribute\Type[] + * @deprecated + * @see \Magento\Catalog\Api\AttributeTypesListInterface::getItems */ public function types(); @@ -43,6 +45,8 @@ public function types(); * @return \Magento\Catalog\Service\V1\Data\Eav\AttributeMetadata * * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Catalog\Api\ProductAttributeRepositoryInterface::get */ public function info($id); @@ -51,6 +55,8 @@ public function info($id); * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Catalog\Service\V1\Data\Product\Attribute\SearchResults containing Data\Eav\Attribute objects + * @deprecated + * @see \Magento\Catalog\Api\ProductAttributeRepositoryInterface::getList */ public function search(\Magento\Framework\Api\SearchCriteria $searchCriteria); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteService.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteService.php index 67148773e41bc..1428ab4da2954 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteService.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteService.php @@ -132,7 +132,7 @@ public function create(\Magento\Catalog\Service\V1\Data\Eav\AttributeMetadata $a */ public function update($id, AttributeMetadata $attribute) { - /** @var \Magento\Catalog\Model\Resource\Eav\Attribute $attributeModel */ + /** @var \Magento\Catalog\Model\Resource\Eav\Attribute $model */ $model = $this->attributeFactory->create(); $model->loadByCode(\Magento\Catalog\Model\Product::ENTITY, $id); if (!$model->getId()) { diff --git a/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteServiceInterface.php index 1458c40ca538f..a0a34ed2f82af 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Attribute/WriteServiceInterface.php @@ -36,6 +36,8 @@ interface WriteServiceInterface * @return string * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Eav\Exception from validate() + * @deprecated + * @see \Magento\Catalog\Api\CategoryAttributeRepositoryInterface::save */ public function create(\Magento\Catalog\Service\V1\Data\Eav\AttributeMetadata $attributeMetadata); @@ -47,6 +49,8 @@ public function create(\Magento\Catalog\Service\V1\Data\Eav\AttributeMetadata $a * @return string * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Catalog\Api\CategoryAttributeRepositoryInterface::save */ public function update($id, \Magento\Catalog\Service\V1\Data\Eav\AttributeMetadata $attribute); @@ -57,6 +61,8 @@ public function update($id, \Magento\Catalog\Service\V1\Data\Eav\AttributeMetada * @throws \Magento\Framework\Exception\NoSuchEntityException If ID is not found * @throws \Exception If something goes wrong during delete * @return bool True if the entity was deleted (always true) + * @deprecated + * @see \Magento\Catalog\Api\CategoryAttributeRepositoryInterface::delete */ public function remove($attributeId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/ReadServiceInterface.php index 74dc98351c95e..6aae2efc8119f 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/ReadServiceInterface.php @@ -32,6 +32,8 @@ interface ReadServiceInterface * @param string $attributeSetId * @return \Magento\Catalog\Service\V1\Data\Eav\AttributeGroup[] * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Eav\Api\AttributeGroupRepositoryInterface::getList */ public function getList($attributeSetId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/WriteServiceInterface.php index 9a2515a06e367..0fc910b776664 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/AttributeGroup/WriteServiceInterface.php @@ -34,6 +34,8 @@ interface WriteServiceInterface * @return \Magento\Catalog\Service\V1\Data\Eav\AttributeGroup * @throws \Magento\Framework\Exception\CouldNotSaveException * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Eav\Api\AttributeGroupRepositoryInterface::save */ public function create($attributeSetId, \Magento\Catalog\Service\V1\Data\Eav\AttributeGroup $groupData); @@ -47,6 +49,8 @@ public function create($attributeSetId, \Magento\Catalog\Service\V1\Data\Eav\Att * @throws \Magento\Framework\Exception\StateException * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool + * @deprecated + * @see \Magento\Eav\Api\AttributeGroupRepositoryInterface::save */ public function update($attributeSetId, $groupId, \Magento\Catalog\Service\V1\Data\Eav\AttributeGroup $groupData); @@ -58,6 +62,8 @@ public function update($attributeSetId, $groupId, \Magento\Catalog\Service\V1\Da * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException * @return bool + * @deprecated + * @see \Magento\Eav\Api\AttributeGroupRepositoryInterface::delete */ public function delete($attributeSetId, $groupId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceInterface.php index 0e6d39281ba0e..b434114cc24b4 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/AttributeServiceInterface.php @@ -29,6 +29,8 @@ interface AttributeServiceInterface * @param int $attributeSetId * @param \Magento\Catalog\Service\V1\Data\Eav\AttributeSet\Attribute $data * @return int + * @deprecated + * @see \Magento\Eav\Api\AttributeManagementInterface::assign */ public function addAttribute($attributeSetId, \Magento\Catalog\Service\V1\Data\Eav\AttributeSet\Attribute $data); @@ -41,6 +43,8 @@ public function addAttribute($attributeSetId, \Magento\Catalog\Service\V1\Data\E * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\StateException * @return bool + * @deprecated + * @see \Magento\Eav\Api\AttributeManagementInterface::unassign */ public function deleteAttribute($attributeSetId, $attributeId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/ReadServiceInterface.php index dc9e766fbab2d..ef4e19dbd6f04 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/ReadServiceInterface.php @@ -27,6 +27,8 @@ interface ReadServiceInterface { /** * @return \Magento\Catalog\Service\V1\Data\Eav\AttributeSet[] + * @deprecated + * @see \Magento\Eav\Api\AttributeSetRepositoryInterface::getList */ public function getList(); @@ -36,6 +38,8 @@ public function getList(); * @param int $attributeSetId * @throws \Magento\Framework\Exception\NoSuchEntityException If $attributeSetId is not found * @return \Magento\Catalog\Service\V1\Data\Eav\AttributeSet + * @deprecated + * @see \Magento\Eav\Api\AttributeSetRepositoryInterface::get */ public function getInfo($attributeSetId); @@ -45,6 +49,8 @@ public function getInfo($attributeSetId); * @param int $attributeSetId * @throws \Magento\Framework\Exception\NoSuchEntityException If $attributeSetId is not found * @return \Magento\Catalog\Service\V1\Data\Eav\Attribute[] + * @deprecated + * @see \Magento\Eav\Api\AttributeManagementInterface::getAttributes */ public function getAttributeList($attributeSetId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/WriteServiceInterface.php index 700c71892921a..15a02de37a210 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/AttributeSet/WriteServiceInterface.php @@ -39,6 +39,8 @@ interface WriteServiceInterface * @return int * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Eav\Api\AttributeSetManagementInterface::create */ public function create(AttributeSet $attributeSet, $skeletonId); @@ -48,6 +50,8 @@ public function create(AttributeSet $attributeSet, $skeletonId); * @param \Magento\Catalog\Service\V1\Data\Eav\AttributeSet $attributeSetData * @return int attribute set ID * @throws \Magento\Framework\Model\Exception If attribute set is not found + * @deprecated + * @see \Magento\Eav\Api\AttributeSetRepositoryInterface::save */ public function update(AttributeSet $attributeSetData); @@ -58,6 +62,8 @@ public function update(AttributeSet $attributeSetData); * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\InputException * @return bool + * @deprecated + * @see \Magento\Eav\Api\AttributeSetRepositoryInterface::delete */ public function remove($attributeSetId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option.php index cbd06da93bee7..e96aaddc6cbcb 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option.php @@ -25,7 +25,9 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data; /** - * @codeCoverageIgnore + * @deprecate + * @todo remove this interface + * @see \Magento\Catalog\Api\Data\ProductCustomOptionsOptionInterface */ class Option extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata.php index 8cf6d86e2bb19..ccac7129cab1e 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/Option/Metadata.php @@ -25,7 +25,8 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option; /** - * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\ProductCustomOptionAttributeInterface */ class Metadata extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionType.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionType.php index 46b542b96cad0..2eab270d5d6b5 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionType.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/Data/OptionType.php @@ -25,7 +25,9 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions\Data; /** - * @codeCoverageIgnore + * @deprecate + * @todo remove this interface + * @see \Magento\Catalog\Api\Data\ProductCustomOptionTypeInterface */ class OptionType extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/ReadServiceInterface.php index f5381e836aefe..9382a7dd605b1 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/ReadServiceInterface.php @@ -24,12 +24,20 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions; +/** + * @deprecated + * @todo remove this interface + * @see \Magento\Catalog\Api\Product\CustomOptionManagementInterface + */ interface ReadServiceInterface { /** * Get custom option types * * @return \Magento\Catalog\Service\V1\Product\CustomOptions\Data\OptionType[] + * + * @deprecated + * @see \Magento\Catalog\Api\ProductCustomOptionTypeListInterface::getItems */ public function getTypes(); @@ -39,6 +47,9 @@ public function getTypes(); * @param string $productSku * @return \Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option[] * @throws \Magento\Framework\Exception\NoSuchEntityException + * + * @deprecated + * @see \Magento\Catalog\Api\ProductCustomOptionManagementInterface::getList */ public function getList($productSku); @@ -49,6 +60,9 @@ public function getList($productSku); * @param string $optionId * @return \Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option * @throws \Magento\Framework\Exception\NoSuchEntityException + * + * @deprecated + * @see \Magento\Catalog\Api\ProductCustomOptionManagementInterface::get */ public function get($productSku, $optionId); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/WriteServiceInterface.php index 000cb68e728b4..d7735560a21b9 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/CustomOptions/WriteServiceInterface.php @@ -24,6 +24,11 @@ namespace Magento\Catalog\Service\V1\Product\CustomOptions; +/** + * @deprecated + * @todo remove this interface + * @see \Magento\Catalog\Api\Product\CustomOptionManagementInterface + */ interface WriteServiceInterface { /** @@ -33,6 +38,9 @@ interface WriteServiceInterface * @param int $optionId * @throws \Magento\Framework\Exception\NoSuchEntityException|\Magento\Framework\Exception\CouldNotSaveException * @return bool + * + * @deprecated + * @see \Magento\Catalog\Api\ProductCustomOptionManagementInterface::remove */ public function remove($productSku, $optionId); @@ -44,6 +52,9 @@ public function remove($productSku, $optionId); * @return \Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option * @throws \Magento\Framework\Exception\InputException * @throws \Magento\Framework\Exception\CouldNotSaveException + * + * @deprecated + * @see \Magento\Catalog\Api\ProductCustomOptionManagementInterface::add */ public function add($productSku, \Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option $option); @@ -55,6 +66,9 @@ public function add($productSku, \Magento\Catalog\Service\V1\Product\CustomOptio * @param \Magento\Catalog\Service\V1\Product\CustomOptions\Data\Option $option * @return bool * @throws \Magento\Framework\Exception\NoSuchEntityException + * + * @deprecated + * @see \Magento\Catalog\Api\ProductCustomOptionManagementInterface::update */ public function update( $productSku, diff --git a/app/code/Magento/Catalog/Service/V1/Product/GroupPriceService.php b/app/code/Magento/Catalog/Service/V1/Product/GroupPriceService.php index e8bb6563cfa8c..c657220dec0c5 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/GroupPriceService.php +++ b/app/code/Magento/Catalog/Service/V1/Product/GroupPriceService.php @@ -48,9 +48,9 @@ class GroupPriceService implements GroupPriceServiceInterface protected $storeManager; /** - * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface + * @var \Magento\Customer\Api\GroupRepositoryInterface */ - protected $customerGroupService; + protected $groupRepository; /** * @var \Magento\Catalog\Model\Product\PriceModifier @@ -66,7 +66,7 @@ class GroupPriceService implements GroupPriceServiceInterface * @param ProductRepository $productRepository * @param Product\GroupPriceBuilder $groupPriceBuilder * @param \Magento\Framework\StoreManagerInterface $storeManager - * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroupService + * @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository * @param \Magento\Catalog\Model\Product\PriceModifier $priceModifier * @param \Magento\Framework\App\Config\ScopeConfigInterface $config */ @@ -74,14 +74,14 @@ public function __construct( ProductRepository $productRepository, Product\GroupPriceBuilder $groupPriceBuilder, \Magento\Framework\StoreManagerInterface $storeManager, - \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroupService, + \Magento\Customer\Api\GroupRepositoryInterface $groupRepository, \Magento\Catalog\Model\Product\PriceModifier $priceModifier, \Magento\Framework\App\Config\ScopeConfigInterface $config ) { $this->productRepository = $productRepository; $this->groupPriceBuilder = $groupPriceBuilder; $this->storeManager = $storeManager; - $this->customerGroupService = $customerGroupService; + $this->groupRepository = $groupRepository; $this->priceModifier = $priceModifier; $this->config = $config; } @@ -94,8 +94,8 @@ public function __construct( */ public function set($productSku, \Magento\Catalog\Service\V1\Data\Product\GroupPrice $price) { - $customerGroup = $this->customerGroupService->getGroup($price->getCustomerGroupId()); - $product = $this->productRepository->get($productSku, true); + $customerGroup = $this->groupRepository->getById($price->getCustomerGroupId()); + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); $groupPrices = $product->getData('group_price'); $websiteId = 0; @@ -141,7 +141,7 @@ public function set($productSku, \Magento\Catalog\Service\V1\Data\Product\GroupP */ public function delete($productSku, $customerGroupId) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) == 0) { $websiteId = 0; } else { @@ -156,7 +156,7 @@ public function delete($productSku, $customerGroupId) */ public function getList($productSku) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); $priceKey = 'website_price'; if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) == 0) { $priceKey = 'price'; diff --git a/app/code/Magento/Catalog/Service/V1/Product/GroupPriceServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/GroupPriceServiceInterface.php index fa8a40f81122c..139a090d2b53d 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/GroupPriceServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/GroupPriceServiceInterface.php @@ -24,6 +24,10 @@ */ namespace Magento\Catalog\Service\V1\Product; +/** + * @todo remove this interface + * @see \Magento\Catalog\Api\ProductGroupPriceManagementInterface + */ interface GroupPriceServiceInterface { /** @@ -34,6 +38,8 @@ interface GroupPriceServiceInterface * @return boolean * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException + * @deprecated + * @see \Magento\Catalog\Api\ProductGroupPriceManagementInterface::add */ public function set($productSku, \Magento\Catalog\Service\V1\Data\Product\GroupPrice $price); @@ -45,6 +51,8 @@ public function set($productSku, \Magento\Catalog\Service\V1\Data\Product\GroupP * @return boolean * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException + * @deprecated + * @see \Magento\Catalog\Api\ProductGroupPriceManagementInterface::remove */ public function delete($productSku, $customerGroupId); @@ -54,6 +62,8 @@ public function delete($productSku, $customerGroupId); * @param string $productSku * @return \Magento\Catalog\Service\V1\Data\Product\GroupPrice[] * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Catalog\Api\ProductGroupPriceManagementInterface::getList */ public function getList($productSku); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttribute.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttribute.php index 33809b9a546c3..d312358ca99b2 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttribute.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkAttribute.php @@ -28,6 +28,8 @@ * LinkAttribute Service Data Object * * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\ProductLinkAttributeInterface */ class LinkAttribute extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkType.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkType.php index 89d9d939f7d0b..50db1b46b5009 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkType.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/LinkType.php @@ -28,6 +28,8 @@ * LinkType Service Data Object * * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\ProductLinkTypeInterface */ class LinkType extends \Magento\Framework\Api\AbstractExtensibleObject { diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink.php b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink.php index 8af1173061128..9a567825d7677 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/Data/ProductLink.php @@ -28,6 +28,8 @@ * ProductLink Service Data Object * * @codeCoverageIgnore + * @deprecated + * @see \Magento\Catalog\Api\Data\ProductLinkInterface */ class ProductLink extends \Magento\Framework\Api\AbstractExtensibleObject { @@ -35,7 +37,6 @@ class ProductLink extends \Magento\Framework\Api\AbstractExtensibleObject * Constants for Data Object keys */ const TYPE = 'type'; - const ATTRIBUTE_SET_ID = 'attribute_set_id'; const SKU = 'sku'; const POSITION = 'position'; diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/ReadService.php b/app/code/Magento/Catalog/Service/V1/Product/Link/ReadService.php index b4b2837552159..1fc840df2ea39 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/ReadService.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/ReadService.php @@ -57,12 +57,12 @@ class ReadService implements ReadServiceInterface protected $linkTypeResolver; /** - * @var Data\ProductLinkBuilder + * @var \Magento\Catalog\Model\Product\Link\ProductLinkBuilder */ protected $productEntityBuilder; /** - * @var Data\ProductLink\CollectionProvider + * @var \Magento\Catalog\Model\ProductLink\CollectionProvider */ protected $entityCollectionProvider; @@ -79,9 +79,9 @@ class ReadService implements ReadServiceInterface /** * @param LinkTypeProvider $linkTypeProvider * @param Data\LinkTypeBuilder $builder - * @param Data\ProductLinkBuilder $productEntityBuilder + * @param \Magento\Catalog\Service\V1\Product\Link\Data\ProductLinkBuilder $productEntityBuilder * @param ProductLoader $productLoader - * @param ProductLink\CollectionProvider $entityCollectionProvider + * @param \Magento\Catalog\Model\ProductLink\CollectionProvider $entityCollectionProvider * @param Data\LinkAttributeBuilder $linkAttributeBuilder * @param \Magento\Catalog\Model\Product\LinkFactory $linkFactory * @param LinkTypeResolver $linkTypeResolver @@ -89,9 +89,9 @@ class ReadService implements ReadServiceInterface public function __construct( LinkTypeProvider $linkTypeProvider, Data\LinkTypeBuilder $builder, - Data\ProductLinkBuilder $productEntityBuilder, + \Magento\Catalog\Service\V1\Product\Link\Data\ProductLinkBuilder $productEntityBuilder, ProductLoader $productLoader, - Data\ProductLink\CollectionProvider $entityCollectionProvider, + \Magento\Catalog\Model\ProductLink\CollectionProvider $entityCollectionProvider, Data\LinkAttributeBuilder $linkAttributeBuilder, \Magento\Catalog\Model\Product\LinkFactory $linkFactory, LinkTypeResolver $linkTypeResolver diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/ReadServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/Link/ReadServiceInterface.php index 9a063cc52100d..1bc605044b000 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/ReadServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/ReadServiceInterface.php @@ -24,12 +24,18 @@ namespace Magento\Catalog\Service\V1\Product\Link; +/** + * @todo remove this interface + * @deprecated + */ interface ReadServiceInterface { /** * Provide the list of product link types * * @return \Magento\Catalog\Service\V1\Product\Link\Data\LinkType[] + * @deprecated + * @see \Magento\Catalog\Api\Product\Link\ProductLinkTypeListInterface::getItems */ public function getProductLinkTypes(); @@ -40,6 +46,9 @@ public function getProductLinkTypes(); * @param string $type * @throws \Magento\Framework\Exception\NoSuchEntityException * @return \Magento\Catalog\Service\V1\Product\Link\Data\ProductLink[] + * + * @deprecated + * @see \Magento\Catalog\Api\ProductLinkManagementInterface::getList */ public function getLinkedProducts($productSku, $type); @@ -49,6 +58,9 @@ public function getLinkedProducts($productSku, $type); * @param string $type * @throws \Magento\Framework\Exception\NoSuchEntityException * @return \Magento\Catalog\Service\V1\Product\Link\Data\LinkAttribute[] + * + * @deprecated + * @see \Magento\Catalog\Api\Product\Link\ProductLinkTypeListInterface::getItemAttributes */ public function getLinkAttributes($type); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/WriteService.php b/app/code/Magento/Catalog/Service/V1/Product/Link/WriteService.php index 686e986983f2e..db10e74ffc0d9 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/WriteService.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/WriteService.php @@ -55,23 +55,23 @@ class WriteService implements WriteServiceInterface protected $productResource; /** - * @var Data\ProductLink\DataMapperInterface + * @var \Magento\Catalog\Service\V1\Product\Link\Data\ProductLink\DataMapperInterface */ protected $dataMapper; /** * @param LinksInitializer $linkInitializer - * @param ProductLink\CollectionProvider $entityCollectionProvider + * @param \Magento\Catalog\Model\ProductLink\CollectionProvider $entityCollectionProvider * @param ProductLoader $productLoader * @param ProductResource $productResource - * @param ProductLink\DataMapperInterface $dataMapper + * @param \Magento\Catalog\Service\V1\Product\Link\Data\ProductLink\DataMapperInterface $dataMapper */ public function __construct( LinksInitializer $linkInitializer, - ProductLink\CollectionProvider $entityCollectionProvider, + \Magento\Catalog\Model\ProductLink\CollectionProvider $entityCollectionProvider, ProductLoader $productLoader, ProductResource $productResource, - Data\ProductLink\DataMapperInterface $dataMapper + \Magento\Catalog\Service\V1\Product\Link\Data\ProductLink\DataMapperInterface $dataMapper ) { $this->linkInitializer = $linkInitializer; $this->entityCollectionProvider = $entityCollectionProvider; @@ -175,8 +175,12 @@ public function remove($productSku, $linkedProductSku, $type) //Remove product from the linked product list unset($links[$linkedProduct->getId()]); - $this->saveLinks($product, [$type => $links]); - + $this->linkInitializer->initializeLinks($product, $links); + try { + $product->save(); + } catch (\Exception $exception) { + throw new CouldNotSaveException('Invalid data provided for linked products'); + } return true; } } diff --git a/app/code/Magento/Catalog/Service/V1/Product/Link/WriteServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/Link/WriteServiceInterface.php index f4a4569616120..2420003a4ecac 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/Link/WriteServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/Link/WriteServiceInterface.php @@ -24,6 +24,10 @@ namespace Magento\Catalog\Service\V1\Product\Link; +/** + * @todo remove this interface + * @deprecated + */ interface WriteServiceInterface { /** @@ -35,6 +39,9 @@ interface WriteServiceInterface * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool + * + * @deprecated + * @see \Magento\Catalog\Api\ProductLinkManagementInterface::assign */ public function assign($productSku, array $assignedProducts, $type); @@ -47,6 +54,9 @@ public function assign($productSku, array $assignedProducts, $type); * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool + * + * @deprecated + * @see \Magento\Catalog\Api\ProductLinkManagementInterface::update */ public function update($productSku, Data\ProductLink $linkedProduct, $type); @@ -59,6 +69,9 @@ public function update($productSku, Data\ProductLink $linkedProduct, $type); * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException * @return bool + * + * @deprecated + * @see \Magento\Catalog\Api\ProductLinkManagementInterface::remove */ public function remove($productSku, $linkedProductSku, $type); } diff --git a/app/code/Magento/Catalog/Service/V1/Product/MetadataServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/MetadataServiceInterface.php index ad2ecd32ed96d..f1b69ebb5bac7 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/MetadataServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/MetadataServiceInterface.php @@ -25,6 +25,8 @@ /** * Class Product MetadataServiceInterface + * @deprecated + * @see \Magento\Catalog\Api\Product\Attribute\MetadataRepositoryInterface */ interface MetadataServiceInterface extends \Magento\Framework\Api\MetadataServiceInterface { diff --git a/app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php b/app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php index 51f3a20764c6c..efacfc13c7fb4 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php +++ b/app/code/Magento/Catalog/Service/V1/Product/TierPriceService.php @@ -26,9 +26,13 @@ use Magento\Catalog\Model\ProductFactory; use Magento\Catalog\Model\ProductRepository; use Magento\Catalog\Service\V1\Data\Product; +use Magento\Customer\Api\GroupManagementInterface; use Magento\Framework\Exception\CouldNotSaveException; use Magento\Framework\Exception\InputException; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class TierPriceService implements TierPriceServiceInterface { /** @@ -57,9 +61,14 @@ class TierPriceService implements TierPriceServiceInterface protected $config; /** - * @var \Magento\Customer\Service\V1\CustomerGroupServiceInterface + * @var \Magento\Customer\Api\GroupRepositoryInterface + */ + protected $groupRepository; + + /** + * @var GroupManagementInterface */ - protected $customerGroupService; + protected $groupManagement; /** * @param ProductRepository $productRepository @@ -67,7 +76,8 @@ class TierPriceService implements TierPriceServiceInterface * @param \Magento\Framework\StoreManagerInterface $storeManager * @param \Magento\Catalog\Model\Product\PriceModifier $priceModifier * @param \Magento\Framework\App\Config\ScopeConfigInterface $config - * @param \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroupService + * @param \Magento\Customer\Api\GroupRepositoryInterface $groupRepository + * @param GroupManagementInterface $groupManagement */ public function __construct( ProductRepository $productRepository, @@ -75,14 +85,16 @@ public function __construct( \Magento\Framework\StoreManagerInterface $storeManager, \Magento\Catalog\Model\Product\PriceModifier $priceModifier, \Magento\Framework\App\Config\ScopeConfigInterface $config, - \Magento\Customer\Service\V1\CustomerGroupServiceInterface $customerGroupService + \Magento\Customer\Api\GroupRepositoryInterface $groupRepository, + GroupManagementInterface $groupManagement ) { $this->productRepository = $productRepository; $this->priceBuilder = $priceBuilder; $this->storeManager = $storeManager; $this->priceModifier = $priceModifier; $this->config = $config; - $this->customerGroupService = $customerGroupService; + $this->groupRepository = $groupRepository; + $this->groupManagement = $groupManagement; } /** @@ -92,7 +104,7 @@ public function __construct( */ public function set($productSku, $customerGroupId, \Magento\Catalog\Service\V1\Data\Product\TierPrice $price) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); $tierPrices = $product->getData('tier_price'); $websiteId = 0; @@ -117,8 +129,8 @@ public function set($productSku, $customerGroupId, \Magento\Catalog\Service\V1\D } if (!$found) { $mappedCustomerGroupId = 'all' == $customerGroupId - ? \Magento\Customer\Service\V1\CustomerGroupServiceInterface::CUST_GROUP_ALL - : $this->customerGroupService->getGroup($customerGroupId)->getId(); + ? $this->groupManagement->getAllCustomersGroup()->getId() + : $this->groupRepository->getById($customerGroupId)->getId(); $tierPrices[] = array( 'cust_group' => $mappedCustomerGroupId, @@ -150,7 +162,7 @@ public function set($productSku, $customerGroupId, \Magento\Catalog\Service\V1\D */ public function delete($productSku, $customerGroupId, $qty) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) == 0) { $websiteId = 0; } else { @@ -165,7 +177,7 @@ public function delete($productSku, $customerGroupId, $qty) */ public function getList($productSku, $customerGroupId) { - $product = $this->productRepository->get($productSku, true); + $product = $this->productRepository->get($productSku, ['edit_mode' => true]); $priceKey = 'website_price'; if ($this->config->getValue('catalog/price/scope', \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITE) == 0) { diff --git a/app/code/Magento/Catalog/Service/V1/Product/TierPriceServiceInterface.php b/app/code/Magento/Catalog/Service/V1/Product/TierPriceServiceInterface.php index 83a941fdd5cdc..ad1bc1cfa8cd4 100644 --- a/app/code/Magento/Catalog/Service/V1/Product/TierPriceServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/Product/TierPriceServiceInterface.php @@ -24,6 +24,10 @@ */ namespace Magento\Catalog\Service\V1\Product; +/** + * @todo remove this interface + * @see \Magento\Catalog\Api\Product\TierPriceManagementInterface + */ interface TierPriceServiceInterface { /** @@ -35,6 +39,8 @@ interface TierPriceServiceInterface * @return boolean * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException + * @deprecated + * @see \Magento\Catalog\Api\ProductTierPriceManagementInterface::add */ public function set($productSku, $customerGroupId, \Magento\Catalog\Service\V1\Data\Product\TierPrice $price); @@ -47,6 +53,8 @@ public function set($productSku, $customerGroupId, \Magento\Catalog\Service\V1\D * @return boolean * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException + * @deprecated + * @see \Magento\Catalog\Api\ProductTierPriceManagementInterface::remove */ public function delete($productSku, $customerGroupId, $qty); @@ -57,6 +65,8 @@ public function delete($productSku, $customerGroupId, $qty); * @param string $customerGroupId * @return \Magento\Catalog\Service\V1\Data\Product\TierPrice[] * @throws \Magento\Framework\Exception\NoSuchEntityException + * @deprecated + * @see \Magento\Catalog\Api\ProductTierPriceManagementInterface::getList */ public function getList($productSku, $customerGroupId); } diff --git a/app/code/Magento/Catalog/Service/V1/ProductService.php b/app/code/Magento/Catalog/Service/V1/ProductService.php index 6f253cd2fe685..1a202172cc625 100644 --- a/app/code/Magento/Catalog/Service/V1/ProductService.php +++ b/app/code/Magento/Catalog/Service/V1/ProductService.php @@ -34,6 +34,7 @@ /** * Class ProductService + * @deprecated * @package Magento\Catalog\Service\V1 * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ diff --git a/app/code/Magento/Catalog/Service/V1/ProductServiceInterface.php b/app/code/Magento/Catalog/Service/V1/ProductServiceInterface.php index b5336b43e6c0d..5eea05795a697 100644 --- a/app/code/Magento/Catalog/Service/V1/ProductServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/ProductServiceInterface.php @@ -26,6 +26,8 @@ /** * Class ProductServiceInterface * @package Magento\Catalog\Service\V1 + * @deprecated + * @todo remove this interface */ interface ProductServiceInterface { @@ -35,6 +37,8 @@ interface ProductServiceInterface * @param string $id * @throws \Magento\Framework\Exception\NoSuchEntityException If ID is not found * @return \Magento\Catalog\Service\V1\Data\Product $product + * @deprecated + * @see \Magento\Catalog\Api\ProductRepositoryInterface::get */ public function get($id); @@ -45,6 +49,8 @@ public function get($id); * @throws \Magento\Framework\Exception\NoSuchEntityException If ID is not found * @throws \Exception If something goes wrong during delete * @return bool True if the entity was deleted (always true) + * @deprecated + * @see \Magento\Catalog\Api\ProductRepositoryInterface::delete */ public function delete($id); @@ -56,6 +62,8 @@ public function delete($id); * @throws \Magento\Framework\Exception\NoSuchEntityException If a ID is sent but the entity does not exist * @throws \Magento\Framework\Model\Exception If something goes wrong during save * @return string id + * @deprecated + * @see \Magento\Catalog\Api\ProductRepositoryInterface::save */ public function create(\Magento\Catalog\Service\V1\Data\Product $product); @@ -68,6 +76,8 @@ public function create(\Magento\Catalog\Service\V1\Data\Product $product); * @throws \Magento\Framework\Exception\NoSuchEntityException If a ID is sent but the entity does not exist * @throws \Magento\Framework\Model\Exception If something goes wrong during save * @return string id + * @deprecated + * @see \Magento\Catalog\Api\ProductManagementInterface::update */ public function update($id, \Magento\Catalog\Service\V1\Data\Product $product); @@ -76,6 +86,8 @@ public function update($id, \Magento\Catalog\Service\V1\Data\Product $product); * * @param \Magento\Framework\Api\SearchCriteria $searchCriteria * @return \Magento\Catalog\Service\V1\Data\Product\SearchResults containing Data\Product objects + * @deprecated + * @see \Magento\Catalog\Api\ProductRepositoryInterface::getList */ public function search(\Magento\Framework\Api\SearchCriteria $searchCriteria); } diff --git a/app/code/Magento/Catalog/Service/V1/ProductTypeServiceInterface.php b/app/code/Magento/Catalog/Service/V1/ProductTypeServiceInterface.php index 9ad7a4011b5ea..95ca2bffd0c10 100644 --- a/app/code/Magento/Catalog/Service/V1/ProductTypeServiceInterface.php +++ b/app/code/Magento/Catalog/Service/V1/ProductTypeServiceInterface.php @@ -25,12 +25,17 @@ */ namespace Magento\Catalog\Service\V1; +/** + * @deprecated + */ interface ProductTypeServiceInterface { /** * Retrieve the list of product types * * @return \Magento\Catalog\Service\V1\Data\ProductType[] + * @deprecated + * @see \Magento\Catalog\Api\ProductTypeListInterface::getProductTypes */ public function getProductTypes(); } diff --git a/app/code/Magento/Catalog/composer.json b/app/code/Magento/Catalog/composer.json index 72024bf3461e2..6e4e4ae54c50d 100644 --- a/app/code/Magento/Catalog/composer.json +++ b/app/code/Magento/Catalog/composer.json @@ -3,33 +3,33 @@ "description": "N/A", "require": { "php": "~5.4.11|~5.5.0", - "magento/module-store": "0.1.0-alpha105", - "magento/module-eav": "0.1.0-alpha105", - "magento/module-cms": "0.1.0-alpha105", - "magento/module-indexer": "0.1.0-alpha105", - "magento/module-customer": "0.1.0-alpha105", - "magento/module-core": "0.1.0-alpha105", - "magento/module-theme": "0.1.0-alpha105", - "magento/module-checkout": "0.1.0-alpha105", - "magento/module-log": "0.1.0-alpha105", - "magento/module-backend": "0.1.0-alpha105", - "magento/module-widget": "0.1.0-alpha105", - "magento/module-wishlist": "0.1.0-alpha105", - "magento/module-tax": "0.1.0-alpha105", - "magento/module-msrp": "0.1.0-alpha105", - "magento/module-catalog-inventory": "0.1.0-alpha105", - "magento/module-directory": "0.1.0-alpha105", - "magento/module-catalog-rule": "0.1.0-alpha105", - "magento/module-sales": "0.1.0-alpha105", - "magento/module-product-alert": "0.1.0-alpha105", - "magento/module-url-rewrite": "0.1.0-alpha105", - "magento/module-catalog-url-rewrite": "0.1.0-alpha105", - "magento/module-page-cache": "0.1.0-alpha105", - "magento/framework": "0.1.0-alpha105", + "magento/module-store": "0.1.0-alpha106", + "magento/module-eav": "0.1.0-alpha106", + "magento/module-cms": "0.1.0-alpha106", + "magento/module-indexer": "0.1.0-alpha106", + "magento/module-customer": "0.1.0-alpha106", + "magento/module-core": "0.1.0-alpha106", + "magento/module-theme": "0.1.0-alpha106", + "magento/module-checkout": "0.1.0-alpha106", + "magento/module-log": "0.1.0-alpha106", + "magento/module-backend": "0.1.0-alpha106", + "magento/module-widget": "0.1.0-alpha106", + "magento/module-wishlist": "0.1.0-alpha106", + "magento/module-tax": "0.1.0-alpha106", + "magento/module-msrp": "0.1.0-alpha106", + "magento/module-catalog-inventory": "0.1.0-alpha106", + "magento/module-directory": "0.1.0-alpha106", + "magento/module-catalog-rule": "0.1.0-alpha106", + "magento/module-sales": "0.1.0-alpha106", + "magento/module-product-alert": "0.1.0-alpha106", + "magento/module-url-rewrite": "0.1.0-alpha106", + "magento/module-catalog-url-rewrite": "0.1.0-alpha106", + "magento/module-page-cache": "0.1.0-alpha106", + "magento/framework": "0.1.0-alpha106", "magento/magento-composer-installer": "*" }, "type": "magento2-module", - "version": "0.1.0-alpha105", + "version": "0.1.0-alpha106", "extra": { "map": [ [ diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php b/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php deleted file mode 100644 index 451386d11d2d5..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-install-1.6.0.0.php +++ /dev/null @@ -1,166 +0,0 @@ -installEntities(); -// Create Root Catalog Node -$installer->createCategory()->load( - 1 -)->setId( - 1 -)->setStoreId( - 0 -)->setPath( - 1 -)->setLevel( - 0 -)->setPosition( - 0 -)->setChildrenCount( - 0 -)->setName( - 'Root Catalog' -)->setInitialSetupFlag( - true -)->save(); - -$category = $installer->createCategory(); - -$installer->createCategory()->setStoreId( - 0 -)->setName( - 'Default Category' -)->setDisplayMode( - 'PRODUCTS' -)->setAttributeSetId( - $category->getDefaultAttributeSetId() -)->setIsActive( - 1 -)->setPath( - '1' -)->setInitialSetupFlag( - true -)->save(); - -$data = array( - 'scope' => 'default', - 'scope_id' => 0, - 'path' => \Magento\Catalog\Helper\Category::XML_PATH_CATEGORY_ROOT_ID, - 'value' => $category->getId() -); -$installer->getConnection()->insertOnDuplicate($installer->getTable('core_config_data'), $data, array('value')); - -$installer->addAttributeGroup(\Magento\Catalog\Model\Product::ENTITY, 'Default', 'Design', 6); - -$entityTypeId = $installer->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY); -$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId); -$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); - -// update General Group -//$installer->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'attribute_group_name', 'General Information'); -$installer->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'sort_order', '10'); - -$groups = array( - 'display' => array('name' => 'Display Settings', 'sort' => 20, 'id' => null), - 'design' => array('name' => 'Custom Design', 'sort' => 30, 'id' => null) -); - -foreach ($groups as $k => $groupProp) { - $installer->addAttributeGroup($entityTypeId, $attributeSetId, $groupProp['name'], $groupProp['sort']); - $groups[$k]['id'] = $installer->getAttributeGroupId($entityTypeId, $attributeSetId, $groupProp['name']); -} - -// update attributes group and sort -$attributes = array( - 'custom_design' => array('group' => 'design', 'sort' => 10), - // 'custom_design_apply' => array('group' => 'design', 'sort' => 20), - 'custom_design_from' => array('group' => 'design', 'sort' => 30), - 'custom_design_to' => array('group' => 'design', 'sort' => 40), - 'page_layout' => array('group' => 'design', 'sort' => 50), - 'custom_layout_update' => array('group' => 'design', 'sort' => 60), - 'display_mode' => array('group' => 'display', 'sort' => 10), - 'landing_page' => array('group' => 'display', 'sort' => 20), - 'is_anchor' => array('group' => 'display', 'sort' => 30), - 'available_sort_by' => array('group' => 'display', 'sort' => 40), - 'default_sort_by' => array('group' => 'display', 'sort' => 50) -); - -foreach ($attributes as $attributeCode => $attributeProp) { - $installer->addAttributeToGroup( - $entityTypeId, - $attributeSetId, - $groups[$attributeProp['group']]['id'], - $attributeCode, - $attributeProp['sort'] - ); -} - -/** - * Install product link types - */ -$data = array( - array('link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, 'code' => 'relation'), - array('link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, 'code' => 'up_sell'), - array('link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, 'code' => 'cross_sell') -); - -foreach ($data as $bind) { - $installer->getConnection()->insertForce($installer->getTable('catalog_product_link_type'), $bind); -} - -/** - * install product link attributes - */ -$data = array( - array( - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, - 'product_link_attribute_code' => 'position', - 'data_type' => 'int' - ), - array( - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, - 'product_link_attribute_code' => 'position', - 'data_type' => 'int' - ), - array( - 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, - 'product_link_attribute_code' => 'position', - 'data_type' => 'int' - ) -); - -$installer->getConnection()->insertMultiple($installer->getTable('catalog_product_link_attribute'), $data); - -/** - * Remove Catalog specified attribute options (columns) from eav/attribute table - * - */ -$describe = $installer->getConnection()->describeTable($installer->getTable('catalog_eav_attribute')); -foreach ($describe as $columnData) { - if ($columnData['COLUMN_NAME'] == 'attribute_id') { - continue; - } - $installer->getConnection()->dropColumn($installer->getTable('eav_attribute'), $columnData['COLUMN_NAME']); -} diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php b/app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php new file mode 100644 index 0000000000000..a73fd8a6791ba --- /dev/null +++ b/app/code/Magento/Catalog/data/catalog_setup/data-install-2.0.0.php @@ -0,0 +1,267 @@ +installEntities(); +// Create Root Catalog Node +$installer->createCategory() + ->load(1) + ->setId(1) + ->setStoreId(0) + ->setPath(1) + ->setLevel(0) + ->setPosition(0) + ->setChildrenCount(0) + ->setName('Root Catalog') + ->setInitialSetupFlag(true) + ->save(); + +$category = $installer->createCategory(); + +$installer->createCategory() + ->setStoreId(0) + ->setName('Default Category') + ->setDisplayMode('PRODUCTS') + ->setAttributeSetId($category->getDefaultAttributeSetId()) + ->setIsActive(1) + ->setPath('1') + ->setInitialSetupFlag(true) + ->save(); + +$data = [ + 'scope' => 'default', + 'scope_id' => 0, + 'path' => \Magento\Catalog\Helper\Category::XML_PATH_CATEGORY_ROOT_ID, + 'value' => $category->getId() +]; +$installer->getConnection() + ->insertOnDuplicate($installer->getTable('core_config_data'), $data, ['value']); + +$installer->addAttributeGroup(\Magento\Catalog\Model\Product::ENTITY, 'Default', 'Design', 6); + +$entityTypeId = $installer->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY); +$attributeSetId = $installer->getDefaultAttributeSetId($entityTypeId); +$attributeGroupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); + +// update General Group +//$installer->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'attribute_group_name', 'General Information'); +$installer->updateAttributeGroup($entityTypeId, $attributeSetId, $attributeGroupId, 'sort_order', '10'); + +$groups = [ + 'display' => ['name' => 'Display Settings', 'sort' => 20, 'id' => null], + 'design' => ['name' => 'Custom Design', 'sort' => 30, 'id' => null] +]; + +foreach ($groups as $k => $groupProp) { + $installer->addAttributeGroup($entityTypeId, $attributeSetId, $groupProp['name'], $groupProp['sort']); + $groups[$k]['id'] = $installer->getAttributeGroupId($entityTypeId, $attributeSetId, $groupProp['name']); +} + +// update attributes group and sort +$attributes = [ + 'custom_design' => ['group' => 'design', 'sort' => 10], + // 'custom_design_apply' => array('group' => 'design', 'sort' => 20), + 'custom_design_from' => ['group' => 'design', 'sort' => 30], + 'custom_design_to' => ['group' => 'design', 'sort' => 40], + 'page_layout' => ['group' => 'design', 'sort' => 50], + 'custom_layout_update' => ['group' => 'design', 'sort' => 60], + 'display_mode' => ['group' => 'display', 'sort' => 10], + 'landing_page' => ['group' => 'display', 'sort' => 20], + 'is_anchor' => ['group' => 'display', 'sort' => 30], + 'available_sort_by' => ['group' => 'display', 'sort' => 40], + 'default_sort_by' => ['group' => 'display', 'sort' => 50] +]; + +foreach ($attributes as $attributeCode => $attributeProp) { + $installer->addAttributeToGroup( + $entityTypeId, + $attributeSetId, + $groups[$attributeProp['group']]['id'], + $attributeCode, + $attributeProp['sort'] + ); +} + +/** + * Install product link types + */ +$data = [ + ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, 'code' => 'relation'], + ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, 'code' => 'up_sell'], + ['link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, 'code' => 'cross_sell'] +]; + +foreach ($data as $bind) { + $installer->getConnection() + ->insertForce($installer->getTable('catalog_product_link_type'), $bind); +} + +/** + * install product link attributes + */ +$data = [ + [ + 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_RELATED, + 'product_link_attribute_code' => 'position', + 'data_type' => 'int' + ], + [ + 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_UPSELL, + 'product_link_attribute_code' => 'position', + 'data_type' => 'int' + ], + [ + 'link_type_id' => \Magento\Catalog\Model\Product\Link::LINK_TYPE_CROSSSELL, + 'product_link_attribute_code' => 'position', + 'data_type' => 'int' + ] +]; + +$installer->getConnection() + ->insertMultiple($installer->getTable('catalog_product_link_attribute'), $data); + +/** + * Remove Catalog specified attribute options (columns) from eav/attribute table + * + */ +$describe = $installer->getConnection() + ->describeTable($installer->getTable('catalog_eav_attribute')); +foreach ($describe as $columnData) { + if ($columnData['COLUMN_NAME'] == 'attribute_id') { + continue; + } + $installer->getConnection() + ->dropColumn($installer->getTable('eav_attribute'), $columnData['COLUMN_NAME']); +} + +$newGeneralTabName = 'Product Details'; +$newPriceTabName = 'Advanced Pricing'; +$newImagesTabName = 'Image Management'; +$newMetaTabName = 'Search Engine Optimization'; +$autosettingsTabName = 'Autosettings'; +$tabNames = [ + 'General' => [ + 'attribute_group_name' => $newGeneralTabName, + 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newGeneralTabName)), + 'tab_group_code' => 'basic', + 'sort_order' => 10 + ], + 'Images' => [ + 'attribute_group_name' => $newImagesTabName, + 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newImagesTabName)), + 'tab_group_code' => 'basic', + 'sort_order' => 20 + ], + 'Meta Information' => [ + 'attribute_group_name' => $newMetaTabName, + 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newMetaTabName)), + 'tab_group_code' => 'basic', + 'sort_order' => 30 + ], + 'Prices' => [ + 'attribute_group_name' => $newPriceTabName, + 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newPriceTabName)), + 'tab_group_code' => 'advanced', + 'sort_order' => 40 + ], + 'Design' => ['attribute_group_code' => 'design', 'tab_group_code' => 'advanced', 'sort_order' => 50] +]; + +$entityTypeId = $installer->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); +$attributeSetId = $installer->getAttributeSetId($entityTypeId, 'Default'); + +//Rename attribute tabs +foreach ($tabNames as $tabName => $tab) { + $groupId = $installer->getAttributeGroupId($entityTypeId, $attributeSetId, $tabName); + if ($groupId) { + foreach ($tab as $propertyName => $propertyValue) { + $installer->updateAttributeGroup($entityTypeId, $attributeSetId, $groupId, $propertyName, $propertyValue); + } + } +} + +//Add new tab +$installer->addAttributeGroup($entityTypeId, $attributeSetId, $autosettingsTabName, 60); +$installer->updateAttributeGroup( + $entityTypeId, + $attributeSetId, + 'Autosettings', + 'attribute_group_code', + 'autosettings' +); +$installer->updateAttributeGroup($entityTypeId, $attributeSetId, 'Autosettings', 'tab_group_code', 'advanced'); + +//New attributes order and properties +$properties = ['is_required', 'default_value', 'frontend_input_renderer']; +$attributesOrder = [ + //Product Details tab + 'name' => [$newGeneralTabName => 10], + 'sku' => [$newGeneralTabName => 20], + 'price' => [$newGeneralTabName => 30], + 'image' => [$newGeneralTabName => 50], + 'weight' => [$newGeneralTabName => 70, 'is_required' => 0], + 'category_ids' => [$newGeneralTabName => 80], + 'description' => [$newGeneralTabName => 90, 'is_required' => 0], + 'status' => [ + $newGeneralTabName => 100, + 'is_required' => 0, + 'default_value' => 1, + 'frontend_input_renderer' => 'Magento\Framework\Data\Form\Element\Hidden' + ], + //Autosettings tab + 'short_description' => [$autosettingsTabName => 0, 'is_required' => 0], + 'visibility' => [$autosettingsTabName => 20, 'is_required' => 0], + 'news_from_date' => [$autosettingsTabName => 30], + 'news_to_date' => [$autosettingsTabName => 40], + 'country_of_manufacture' => [$autosettingsTabName => 50] +]; + +foreach ($attributesOrder as $key => $value) { + $attribute = $installer->getAttribute($entityTypeId, $key); + if ($attribute) { + foreach ($value as $propertyName => $propertyValue) { + if (in_array($propertyName, $properties)) { + $installer->updateAttribute($entityTypeId, $attribute['attribute_id'], $propertyName, $propertyValue); + } else { + $installer->addAttributeToGroup( + $entityTypeId, + $attributeSetId, + $propertyName, + $attribute['attribute_id'], + $propertyValue + ); + } + } + } +} + +foreach (['status', 'visibility'] as $attributeCode) { + $installer->updateAttribute( + \Magento\Catalog\Model\Product::ENTITY, + $attributeCode, + 'is_required_in_admin_store', + '1' + ); +} diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php deleted file mode 100644 index ec040bd6b70bb..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.1-1.6.0.0.2.php +++ /dev/null @@ -1,50 +0,0 @@ -addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'country_of_manufacture', - array( - 'group' => 'General', - 'type' => 'varchar', - 'backend' => '', - 'frontend' => '', - 'label' => 'Country of Manufacture', - 'input' => 'select', - 'class' => '', - 'source' => 'Magento\Catalog\Model\Product\Attribute\Source\Countryofmanufacture', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, - 'visible' => true, - 'required' => false, - 'user_defined' => false, - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'visible_on_front' => false, - 'unique' => false, - 'apply_to' => 'simple,bundle' - ) -); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.12-1.6.0.0.13.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.12-1.6.0.0.13.php deleted file mode 100644 index 56a8bc5542575..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.12-1.6.0.0.13.php +++ /dev/null @@ -1,61 +0,0 @@ -getAttribute('catalog_product', 'group_price', 'attribute_id'); -$priceAttrId = $installer->getAttribute('catalog_product', 'price', 'attribute_id'); -$connection = $installer->getConnection(); - -// update sort_order of Group Price attribute to be after Price -$select = $connection->select()->join( - array('t2' => $installer->getTable('eav_entity_attribute')), - 't1.attribute_group_id = t2.attribute_group_id', - array('sort_order' => new \Zend_Db_Expr('t2.sort_order + 1')) -)->where( - 't1.attribute_id = ?', - $groupPriceAttrId -)->where( - 't2.attribute_id = ?', - $priceAttrId -); -$query = $select->crossUpdateFromSelect(array('t1' => $installer->getTable('eav_entity_attribute'))); -$connection->query($query); - -// update sort_order of all other attributes to be after Group Price -$select = $connection->select()->join( - array('t2' => $installer->getTable('eav_entity_attribute')), - 't1.attribute_group_id = t2.attribute_group_id', - array('sort_order' => new \Zend_Db_Expr('t1.sort_order + 1')) -)->where( - 't1.attribute_id != ?', - $groupPriceAttrId -)->where( - 't1.sort_order >= t2.sort_order' -)->where( - 't2.attribute_id = ?', - $groupPriceAttrId -); -$query = $select->crossUpdateFromSelect(array('t1' => $installer->getTable('eav_entity_attribute'))); -$connection->query($query); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.13-1.6.0.0.14.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.13-1.6.0.0.14.php deleted file mode 100644 index 74639c8a0a559..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.13-1.6.0.0.14.php +++ /dev/null @@ -1,74 +0,0 @@ -getConnection(); - -$installer->startSetup(); - -$entityTypeId = $installer->getEntityTypeId(\Magento\Catalog\Model\Category::ENTITY); -$attributeId = $installer->getAttributeId($entityTypeId, 'filter_price_range'); -$attributeTableOld = $installer->getAttributeTable($entityTypeId, $attributeId); - -$installer->updateAttribute($entityTypeId, $attributeId, 'backend_type', 'decimal'); - -$attributeTableNew = $installer->getAttributeTable($entityTypeId, $attributeId); - -if ($attributeTableOld != $attributeTableNew) { - $connection->disableTableKeys($attributeTableOld)->disableTableKeys($attributeTableNew); - - $select = $connection->select()->from( - $attributeTableOld, - array('entity_type_id', 'attribute_id', 'store_id', 'entity_id', 'value') - )->where( - 'entity_type_id = ?', - $entityTypeId - )->where( - 'attribute_id = ?', - $attributeId - ); - - $query = $select->insertFromSelect( - $attributeTableNew, - array('entity_type_id', 'attribute_id', 'store_id', 'entity_id', 'value') - ); - - $connection->query($query); - - $connection->delete( - $attributeTableOld, - $connection->quoteInto( - 'entity_type_id = ?', - $entityTypeId - ) . $connection->quoteInto( - ' AND attribute_id = ?', - $attributeId - ) - ); - - $connection->enableTableKeys($attributeTableOld)->enableTableKeys($attributeTableNew); -} - -$installer->endSetup(); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.14-1.6.0.0.15.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.14-1.6.0.0.15.php deleted file mode 100644 index 96c255fff1b81..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.14-1.6.0.0.15.php +++ /dev/null @@ -1,35 +0,0 @@ -updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - $attributeCode, - 'backend_model', - 'Magento\Catalog\Model\Product\Attribute\Backend\Startdate' - ); -} diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.16-1.6.0.0.17.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.16-1.6.0.0.17.php deleted file mode 100644 index 64e3753492211..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.16-1.6.0.0.17.php +++ /dev/null @@ -1,58 +0,0 @@ -createMigrationSetup(); -$installer->startSetup(); - -$attributeData = $this->getAttribute('catalog_category', 'custom_layout_update'); -$installer->appendClassAliasReplace( - 'catalog_category_entity_text', - 'value', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, - array('value_id'), - 'attribute_id = ' . (int)$attributeData['attribute_id'] -); - -$attributeData = $this->getAttribute('catalog_product', 'custom_layout_update'); -$installer->appendClassAliasReplace( - 'catalog_product_entity_text', - 'value', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_XML, - array('value_id'), - 'attribute_id = ' . (int)$attributeData['attribute_id'] -); - -$installer->appendClassAliasReplace( - 'catalog_eav_attribute', - 'frontend_input_renderer', - \Magento\Framework\Module\Setup\Migration::ENTITY_TYPE_BLOCK, - \Magento\Framework\Module\Setup\Migration::FIELD_CONTENT_TYPE_PLAIN, - array('attribute_id') -); -$installer->doUpdateClassAliases(); - -$installer->endSetup(); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.17-1.6.0.0.18.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.17-1.6.0.0.18.php deleted file mode 100644 index 6474ef2f3cf10..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.17-1.6.0.0.18.php +++ /dev/null @@ -1,66 +0,0 @@ -getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'category_ids'); -if ($attribute) { - $properties = array( - 'sort_order' => 9, - 'is_visible' => true, - 'frontend_label' => 'Categories', - 'input' => 'categories', - 'group' => 'General Information', - 'backend_model' => 'Magento\Catalog\Model\Product\Attribute\Backend\Category', - 'frontend_input_renderer' => 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Category' - ); - foreach ($properties as $key => $value) { - $this->updateAttribute($attribute['entity_type_id'], $attribute['attribute_id'], $key, $value); - } -} - -$this->addAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'quantity_and_stock_status', - array( - 'group' => 'General', - 'type' => 'int', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Stock', - 'frontend' => '', - 'label' => 'Quantity', - 'input' => 'select', - 'class' => '', - 'input_renderer' => 'Magento\CatalogInventory\Block\Adminhtml\Form\Field\Stock', - 'source' => 'Magento\CatalogInventory\Model\Source\Stock', - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_GLOBAL, - 'default' => \Magento\CatalogInventory\Model\Stock::STOCK_IN_STOCK, - 'user_defined' => false, - 'visible' => true, - 'required' => false, - 'searchable' => false, - 'filterable' => false, - 'comparable' => false, - 'unique' => false - ) -); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.18-1.6.0.0.19.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.18-1.6.0.0.19.php deleted file mode 100644 index ace9f91db52cf..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.18-1.6.0.0.19.php +++ /dev/null @@ -1,51 +0,0 @@ -getAttribute(\Magento\Catalog\Model\Product::ENTITY, 'image'); - -if ($attribute) { - $this->addAttributeToGroup( - $attribute['entity_type_id'], - $this->getAttributeSetId($attribute['entity_type_id'], 'Default'), - 'General', - $attribute['attribute_id'], - 0 - ); - - $this->updateAttribute( - $attribute['entity_type_id'], - $attribute['attribute_id'], - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\BaseImage' - ); - - $this->updateAttribute( - $attribute['entity_type_id'], - $attribute['attribute_id'], - 'used_in_product_listing', - '1' - ); -} diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php deleted file mode 100644 index f8656fc61349e..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.20-1.6.0.0.21.php +++ /dev/null @@ -1,120 +0,0 @@ - array( - 'attribute_group_name' => $newGeneralTabName, - 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newGeneralTabName)), - 'tab_group_code' => 'basic', - 'sort_order' => 10 - ), - 'Images' => array( - 'attribute_group_name' => $newImagesTabName, - 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newImagesTabName)), - 'tab_group_code' => 'basic', - 'sort_order' => 20 - ), - 'Meta Information' => array( - 'attribute_group_name' => $newMetaTabName, - 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newMetaTabName)), - 'tab_group_code' => 'basic', - 'sort_order' => 30 - ), - 'Prices' => array( - 'attribute_group_name' => $newPriceTabName, - 'attribute_group_code' => preg_replace('/[^a-z0-9]+/', '-', strtolower($newPriceTabName)), - 'tab_group_code' => 'advanced', - 'sort_order' => 40 - ), - 'Design' => array('attribute_group_code' => 'design', 'tab_group_code' => 'advanced', 'sort_order' => 50) -); - -$entityTypeId = $this->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); -$attributeSetId = $this->getAttributeSetId($entityTypeId, 'Default'); - -//Rename attribute tabs -foreach ($tabNames as $tabName => $tab) { - $groupId = $this->getAttributeGroupId($entityTypeId, $attributeSetId, $tabName); - if ($groupId) { - foreach ($tab as $propertyName => $propertyValue) { - $this->updateAttributeGroup($entityTypeId, $attributeSetId, $groupId, $propertyName, $propertyValue); - } - } -} - -//Add new tab -$this->addAttributeGroup($entityTypeId, $attributeSetId, $autosettingsTabName, 60); -$this->updateAttributeGroup($entityTypeId, $attributeSetId, 'Autosettings', 'attribute_group_code', 'autosettings'); -$this->updateAttributeGroup($entityTypeId, $attributeSetId, 'Autosettings', 'tab_group_code', 'advanced'); - -//New attributes order and properties -$properties = array('is_required', 'default_value', 'frontend_input_renderer'); -$attributesOrder = array( - //Product Details tab - 'name' => array($newGeneralTabName => 10), - 'sku' => array($newGeneralTabName => 20), - 'price' => array($newGeneralTabName => 30), - 'image' => array($newGeneralTabName => 50), - 'weight' => array($newGeneralTabName => 70, 'is_required' => 0), - 'category_ids' => array($newGeneralTabName => 80), - 'description' => array($newGeneralTabName => 90, 'is_required' => 0), - 'status' => array( - $newGeneralTabName => 100, - 'is_required' => 0, - 'default_value' => 1, - 'frontend_input_renderer' => 'Magento\Framework\Data\Form\Element\Hidden' - ), - //Autosettings tab - 'short_description' => array($autosettingsTabName => 0, 'is_required' => 0), - 'visibility' => array($autosettingsTabName => 20, 'is_required' => 0), - 'news_from_date' => array($autosettingsTabName => 30), - 'news_to_date' => array($autosettingsTabName => 40), - 'country_of_manufacture' => array($autosettingsTabName => 50) -); - -foreach ($attributesOrder as $key => $value) { - $attribute = $this->getAttribute($entityTypeId, $key); - if ($attribute) { - foreach ($value as $propertyName => $propertyValue) { - if (in_array($propertyName, $properties)) { - $this->updateAttribute($entityTypeId, $attribute['attribute_id'], $propertyName, $propertyValue); - } else { - $this->addAttributeToGroup( - $entityTypeId, - $attributeSetId, - $propertyName, - $attribute['attribute_id'], - $propertyValue - ); - } - } - } -} diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.21-1.6.0.0.22.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.21-1.6.0.0.22.php deleted file mode 100644 index ed4cab5cc3617..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.21-1.6.0.0.22.php +++ /dev/null @@ -1,56 +0,0 @@ -updateAttribute( - $this->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY), - 'weight', - 'backend_model', - 'Magento\Catalog\Model\Product\Attribute\Backend\Weight' -); -$this->updateAttribute( - $this->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY), - 'name', - 'frontend_class', - 'validate-length maximum-length-255' -); -$this->updateAttribute( - $this->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY), - 'sku', - 'frontend_class', - 'validate-length maximum-length-64' -); -$this->updateAttribute( - $this->getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY), - 'qty', - 'frontend_class', - 'validate-number' -); -$this->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'weight', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Weight' -); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.23-1.6.0.0.24.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.23-1.6.0.0.24.php deleted file mode 100644 index eaa6c462be4b1..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.23-1.6.0.0.24.php +++ /dev/null @@ -1,67 +0,0 @@ -updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'category_ids', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Category' -); - -$this->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'image', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\BaseImage' -); - -$this->updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'weight', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Weight' -); - -$this->updateAttribute( - \Magento\Catalog\Model\Category::ENTITY, - 'available_sort_by', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Category\Helper\Sortby\Available' -); - -$this->updateAttribute( - \Magento\Catalog\Model\Category::ENTITY, - 'default_sort_by', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Category\Helper\Sortby\DefaultSortby' -); - -$this->updateAttribute( - \Magento\Catalog\Model\Category::ENTITY, - 'filter_price_range', - 'frontend_input_renderer', - 'Magento\Catalog\Block\Adminhtml\Category\Helper\Pricestep' -); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.24-1.6.0.0.25.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.24-1.6.0.0.25.php deleted file mode 100644 index 1202e785c6b07..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.24-1.6.0.0.25.php +++ /dev/null @@ -1,31 +0,0 @@ -updateAttribute( - \Magento\Catalog\Model\Product::ENTITY, - 'status', - 'source_model', - 'Magento\Catalog\Model\Product\Attribute\Source\Status' -); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.28-1.6.0.0.29.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.28-1.6.0.0.29.php deleted file mode 100644 index e3fd6521cb6ba..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.28-1.6.0.0.29.php +++ /dev/null @@ -1,39 +0,0 @@ -getEntityTypeId(\Magento\Catalog\Model\Product::ENTITY); -$attributeSetId = $this->getAttributeSetId($entityTypeId, 'Default'); -$groupId = $this->getAttributeGroupId($entityTypeId, $attributeSetId, $oldTabName); - -$this->updateAttributeGroup($entityTypeId, $attributeSetId, $groupId, 'attribute_group_name', $newTabName); -$this->updateAttributeGroup( - $entityTypeId, - $attributeSetId, - $groupId, - 'attribute_group_code', - preg_replace('/[^a-z0-9]+/', '-', strtolower($newTabName)) -); diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.4-1.6.0.0.5.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.4-1.6.0.0.5.php deleted file mode 100644 index dc149b98540a7..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.4-1.6.0.0.5.php +++ /dev/null @@ -1,64 +0,0 @@ -createEavAttributeResource(); - -$multiSelectAttributeCodes = $eavResource->getAttributeCodesByFrontendType('multiselect'); - -foreach ($multiSelectAttributeCodes as $attributeCode) { - /** @var $attribute \Magento\Catalog\Model\Resource\Eav\Attribute */ - $attribute = $installer->getAttribute('catalog_product', $attributeCode); - if ($attribute) { - $attributeTable = $installer->getAttributeTable('catalog_product', $attributeCode); - $select = $installer->getConnection()->select()->from( - array('e' => $attributeTable) - )->where( - "e.attribute_id=?", - $attribute['attribute_id'] - )->where( - 'e.value LIKE "%,,%"' - ); - $result = $installer->getConnection()->fetchAll($select); - - if ($result) { - foreach ($result as $row) { - if (isset($row['value']) && !empty($row['value'])) { - // 1,2,,,3,5 --> 1,2,3,5 - $row['value'] = preg_replace('/,{2,}/', ',', $row['value'], -1, $replaceCnt); - - if ($replaceCnt) { - $installer->getConnection()->update( - $attributeTable, - array('value' => $row['value']), - "value_id=" . $row['value_id'] - ); - } - } - } - } - } -} diff --git a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.9-1.6.0.0.10.php b/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.9-1.6.0.0.10.php deleted file mode 100644 index 7dbbc001ebc58..0000000000000 --- a/app/code/Magento/Catalog/data/catalog_setup/data-upgrade-1.6.0.0.9-1.6.0.0.10.php +++ /dev/null @@ -1,42 +0,0 @@ -addAttribute( - 'catalog_product', - 'group_price', - array( - 'type' => 'decimal', - 'label' => 'Group Price', - 'input' => 'text', - 'backend' => 'Magento\Catalog\Model\Product\Attribute\Backend\Groupprice', - 'required' => false, - 'sort_order' => 6, - 'global' => \Magento\Catalog\Model\Resource\Eav\Attribute::SCOPE_WEBSITE, - 'apply_to' => 'simple,virtual', - 'group' => 'Prices' - ) -); diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml index fffae3fe39e52..eb3b702fd823e 100644 --- a/app/code/Magento/Catalog/etc/di.xml +++ b/app/code/Magento/Catalog/etc/di.xml @@ -26,13 +26,16 @@ - - + + + + + - + @@ -59,7 +62,6 @@ - @@ -68,6 +70,29 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -193,7 +218,7 @@ - + @@ -210,7 +235,7 @@ - + @@ -266,11 +291,6 @@ Magento\Catalog\Model\Indexer\Product\Flat\TableData - - - Magento\Catalog\Model\Layer\Category - - Magento\Catalog\Model\Layer\Category\FilterableAttributeList @@ -291,6 +311,11 @@ Magento\Catalog\Model\Layer\Search + + + Magento\Indexer\Model\IndexerInterface + + @@ -347,19 +372,19 @@ - + - Magento\Catalog\Service\V1\Product\Link\Data\ProductLink\CollectionProvider\Crosssell - Magento\Catalog\Service\V1\Product\Link\Data\ProductLink\CollectionProvider\Upsell - Magento\Catalog\Service\V1\Product\Link\Data\ProductLink\CollectionProvider\Related + Magento\Catalog\Model\ProductLink\CollectionProvider\Crosssell + Magento\Catalog\Model\ProductLink\CollectionProvider\Upsell + Magento\Catalog\Model\ProductLink\CollectionProvider\Related - + - \Magento\Catalog\Service\V1\Product\Link\Data\ProductLink\ProductEntity\DefaultConverter + Magento\Catalog\Model\ProductLink\Converter\DefaultConverter @@ -465,14 +490,83 @@ - + + + Magento\Catalog\Model\Product\Option\Type\File\ValidatorInfo\Proxy + Magento\Catalog\Model\Product\Option\Type\File\ValidatorFile\Proxy + + + Magento\Catalog\Model\Layer\Search\ItemCollectionProvider Magento\Catalog\Model\Layer\Category\StateKey Magento\Catalog\Model\Layer\Search\CollectionFilter + + + + Magento\Catalog\Model\Layer\Category\ItemCollectionProvider + Magento\Catalog\Model\Layer\Category\StateKey + Magento\Catalog\Model\Layer\Category\CollectionFilter + + + + + Magento\Catalog\Model\Layer\Search\Context + + + + + Magento\Catalog\Model\Layer\Category\Context + + + + + + Magento\Catalog\Model\Layer\Filter\Dynamic\Auto + Magento\Catalog\Model\Layer\Filter\Dynamic\Improved + Magento\Catalog\Model\Layer\Filter\Dynamic\Manual + + + + + + + Magento\Catalog\Model\Layer\Category + Magento\Catalog\Model\Layer\Search + + + + + Magento\Catalog\Model\Category\AttributeRepository\Proxy + + + + + Magento\Catalog\Model\Product\Attribute\Repository\Proxy + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Catalog/etc/module.xml b/app/code/Magento/Catalog/etc/module.xml index 916a5eaf8a343..e5e324bb5fb56 100644 --- a/app/code/Magento/Catalog/etc/module.xml +++ b/app/code/Magento/Catalog/etc/module.xml @@ -24,7 +24,7 @@ */ --> - + diff --git a/app/code/Magento/Catalog/etc/webapi.xml b/app/code/Magento/Catalog/etc/webapi.xml index 6f3bd03167932..5d29ad8e5428e 100644 --- a/app/code/Magento/Catalog/etc/webapi.xml +++ b/app/code/Magento/Catalog/etc/webapi.xml @@ -25,400 +25,402 @@ --> + + - + - - + + - - + + - - + + - - + + + - + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - + - - + + - + - + - + - - + + - + - - + + - - + + - - + + - - + + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - + + - - + + - + - + - - + + - + - + - - + + + + - - + + - - + + + + - + - - + + - + + - + - + - - + + - - + + - - + + - - + + - - + + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/code/Magento/Catalog/i18n/de_DE.csv b/app/code/Magento/Catalog/i18n/de_DE.csv index 5248fb6353e76..8b0df7438ce01 100644 --- a/app/code/Magento/Catalog/i18n/de_DE.csv +++ b/app/code/Magento/Catalog/i18n/de_DE.csv @@ -255,7 +255,6 @@ Categories,Kategorien "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." diff --git a/app/code/Magento/Catalog/i18n/en_US.csv b/app/code/Magento/Catalog/i18n/en_US.csv index 5887784287b99..2cfe7083932dd 100644 --- a/app/code/Magento/Catalog/i18n/en_US.csv +++ b/app/code/Magento/Catalog/i18n/en_US.csv @@ -255,7 +255,6 @@ Categories,Categories "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." diff --git a/app/code/Magento/Catalog/i18n/es_ES.csv b/app/code/Magento/Catalog/i18n/es_ES.csv index d86c9b05058a1..83b48a5ad10cb 100644 --- a/app/code/Magento/Catalog/i18n/es_ES.csv +++ b/app/code/Magento/Catalog/i18n/es_ES.csv @@ -255,7 +255,6 @@ Categories,Categorías "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." diff --git a/app/code/Magento/Catalog/i18n/fr_FR.csv b/app/code/Magento/Catalog/i18n/fr_FR.csv index 4c2595d01bf68..62cb82be60950 100644 --- a/app/code/Magento/Catalog/i18n/fr_FR.csv +++ b/app/code/Magento/Catalog/i18n/fr_FR.csv @@ -255,7 +255,6 @@ Categories,catégories "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." diff --git a/app/code/Magento/Catalog/i18n/nl_NL.csv b/app/code/Magento/Catalog/i18n/nl_NL.csv index 8a3940a19a4e9..ee1eb9baee9d9 100644 --- a/app/code/Magento/Catalog/i18n/nl_NL.csv +++ b/app/code/Magento/Catalog/i18n/nl_NL.csv @@ -255,7 +255,6 @@ Categories,Categoriën "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." diff --git a/app/code/Magento/Catalog/i18n/pt_BR.csv b/app/code/Magento/Catalog/i18n/pt_BR.csv index 5717e8f7b64b1..3e0887c87547d 100644 --- a/app/code/Magento/Catalog/i18n/pt_BR.csv +++ b/app/code/Magento/Catalog/i18n/pt_BR.csv @@ -255,7 +255,6 @@ Categories,Categorias "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." diff --git a/app/code/Magento/Catalog/i18n/zh_CN.csv b/app/code/Magento/Catalog/i18n/zh_CN.csv index 9a431375ea5e7..4774b64706d9a 100644 --- a/app/code/Magento/Catalog/i18n/zh_CN.csv +++ b/app/code/Magento/Catalog/i18n/zh_CN.csv @@ -255,7 +255,6 @@ Categories,分类 "A total of %1 record(s) have been updated.","A total of %1 record(s) have been updated." "Something went wrong while updating the product(s) status.","Something went wrong while updating the product(s) status." "Please make sure to define SKU values for all processed products.","Please make sure to define SKU values for all processed products." -"Please refresh "Product EAV" in System -> Index Management.","Please refresh "Product EAV" in System -> Index Management." "A total of %1 record(s) were updated.","A total of %1 record(s) were updated." "Something went wrong while updating the product(s) attributes.","Something went wrong while updating the product(s) attributes." "Please select products for attributes update.","Please select products for attributes update." diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php deleted file mode 100644 index faf56feb30d41..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/install-1.6.0.0.0.php +++ /dev/null @@ -1,3889 +0,0 @@ -startSetup(); - -/** - * Create table 'catalog_product_entity' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute Set ID' -)->addColumn( - 'type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - array('nullable' => false, 'default' => 'simple'), - 'Type ID' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - array(), - 'SKU' -)->addColumn( - 'has_options', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('nullable' => false, 'default' => '0'), - 'Has Options' -)->addColumn( - 'required_options', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Required Options' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - array(), - 'Creation Time' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - array(), - 'Update Time' -)->addIndex( - $installer->getIdxName('catalog_product_entity', array('entity_type_id')), - array('entity_type_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity', array('attribute_set_id')), - array('attribute_set_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity', array('sku')), - array('sku') -)->addForeignKey( - $installer->getFkName('catalog_product_entity', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), - 'attribute_set_id', - $installer->getTable('eav_attribute_set'), - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), - 'entity_type_id', - $installer->getTable('eav_entity_type'), - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Table' -); -$installer->getConnection()->createTable($table); - - - -/** - * Create table 'catalog_product_entity_datetime' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_datetime') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_product_entity_datetime', - array('entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_entity_datetime', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_datetime', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Datetime Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_decimal' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_decimal') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_product_entity_decimal', - array('entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_entity_decimal', array('store_id')), - array('store_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_decimal', array('attribute_id')), - array('attribute_id') -)->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Decimal Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_int' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_int') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_product_entity_int', - array('entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_entity_int', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_int', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_int', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Integer Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_text' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_text') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_product_entity_text', - array('entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_entity_text', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_text', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_text', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Text Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_varchar' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_varchar') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_product_entity_varchar', - array('entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_entity_varchar', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_varchar', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Varchar Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_gallery' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_gallery') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'default' => '0'), - 'Position' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => true, 'default' => null), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_product_entity_gallery', - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', array('entity_id')), - array('entity_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_gallery', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Gallery Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_entity') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_set_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attriute Set ID' -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Parent Category ID' -)->addColumn( - 'created_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - array(), - 'Creation Time' -)->addColumn( - 'updated_at', - \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, - null, - array(), - 'Update Time' -)->addColumn( - 'path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => false), - 'Tree Path' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false), - 'Position' -)->addColumn( - 'level', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'default' => '0'), - 'Tree Level' -)->addColumn( - 'children_count', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false), - 'Child Count' -)->addIndex( - $installer->getIdxName('catalog_category_entity', array('level')), - array('level') -)->setComment( - 'Catalog Category Table' -); -$installer->getConnection()->createTable($table); - - -/** - * Create table 'catalog_category_entity_datetime' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_entity_datetime') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, - null, - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_category_entity_datetime', - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', array('entity_id')), - array('entity_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_datetime', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Category Datetime Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_decimal' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_entity_decimal') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_category_entity_decimal', - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', array('entity_id')), - array('entity_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_decimal', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Category Decimal Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_int' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_entity_int') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_category_entity_int', - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_category_entity_int', array('entity_id')), - array('entity_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_int', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_int', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_int', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Category Integer Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_text' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_entity_text') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - '64k', - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_category_entity_text', - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_category_entity_text', array('entity_id')), - array('entity_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_text', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_text', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_text', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Category Text Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_entity_varchar' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_entity_varchar') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity Type ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array(), - 'Value' -)->addIndex( - $installer->getIdxName( - 'catalog_category_entity_varchar', - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_type_id', 'entity_id', 'attribute_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', array('entity_id')), - array('entity_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_category_entity_varchar', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'entity_id', 'catalog_category_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Category Varchar Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_product' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_product') -)->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Category ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Product ID' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'default' => '0'), - 'Position' - /* ->addIndex($installer->getIdxName('catalog_category_product', array('category_id')), - array('category_id'))*/ -)->addIndex( - $installer->getIdxName('catalog_category_product', array('product_id')), - array('product_id') -)->addForeignKey( - $installer->getFkName('catalog_category_product', 'category_id', 'catalog_category_entity', 'entity_id'), - 'category_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_product', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product To Category Linkage Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_product_index' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_product_index') -)->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Category ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Product ID' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true), - 'Position' -)->addColumn( - 'is_parent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Parent' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Store ID' -)->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false), - 'Visibility' -)->addIndex( - $installer->getIdxName( - 'catalog_category_product_index', - array('product_id', 'store_id', 'category_id', 'visibility') - ), - array('product_id', 'store_id', 'category_id', 'visibility') -)->addIndex( - $installer->getIdxName( - 'catalog_category_product_index', - array('store_id', 'category_id', 'visibility', 'is_parent', 'position') - ), - array('store_id', 'category_id', 'visibility', 'is_parent', 'position') -)->addForeignKey( - $installer->getFkName('catalog_category_product_index', 'category_id', 'catalog_category_entity', 'entity_id'), - 'category_id', - $installer->getTable('catalog_category_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_product_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_category_product_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Category Product Index' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_compare_item' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_compare_item') -)->addColumn( - 'catalog_compare_item_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Compare Item ID' -)->addColumn( - 'visitor_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Visitor ID' -)->addColumn( - 'customer_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true), - 'Customer ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true), - 'Store ID' -)->addIndex( - $installer->getIdxName('catalog_compare_item', array('product_id')), - array('product_id') -)->addIndex( - $installer->getIdxName('catalog_compare_item', array('visitor_id', 'product_id')), - array('visitor_id', 'product_id') -)->addIndex( - $installer->getIdxName('catalog_compare_item', array('customer_id', 'product_id')), - array('customer_id', 'product_id') -)->addIndex( - $installer->getIdxName('catalog_compare_item', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_compare_item', 'customer_id', 'customer_entity', 'entity_id'), - 'customer_id', - $installer->getTable('customer_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_compare_item', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_compare_item', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Compare Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_website' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_website') -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Product ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addIndex( - $installer->getIdxName('catalog_product_website', array('website_id')), - array('website_id') -)->addForeignKey( - $installer->getFkName('catalog_product_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_website', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product To Website Linkage Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_enabled_index' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_enabled_index') -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Product ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Store ID' -)->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Visibility' -)->addIndex( - $installer->getIdxName('catalog_product_enabled_index', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_product_enabled_index', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_enabled_index', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Visibility Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_link_type' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_link_type') -)->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Link Type ID' -)->addColumn( - 'code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - array('nullable' => true, 'default' => null), - 'Code' -)->setComment( - 'Catalog Product Link Type Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_link' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_link') -)->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Link ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->addColumn( - 'linked_product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Linked Product ID' -)->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Link Type ID' -)->addIndex( - $installer->getIdxName( - 'catalog_product_link', - array('link_type_id', 'product_id', 'linked_product_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('link_type_id', 'product_id', 'linked_product_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_link', array('product_id')), - array('product_id') -)->addIndex( - $installer->getIdxName('catalog_product_link', array('linked_product_id')), - array('linked_product_id') -)->addForeignKey( - $installer->getFkName('catalog_product_link', 'linked_product_id', 'catalog_product_entity', 'entity_id'), - 'linked_product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_link', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_link', 'link_type_id', 'catalog_product_link_type', 'link_type_id'), - 'link_type_id', - $installer->getTable('catalog_product_link_type'), - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product To Product Linkage Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_link_attribute' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_link_attribute') -)->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Product Link Attribute ID' -)->addColumn( - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Link Type ID' -)->addColumn( - 'product_link_attribute_code', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - array('nullable' => true, 'default' => null), - 'Product Link Attribute Code' -)->addColumn( - 'data_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 32, - array('nullable' => true, 'default' => null), - 'Data Type' -)->addIndex( - $installer->getIdxName('catalog_product_link_attribute', array('link_type_id')), - array('link_type_id') -)->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute', - 'link_type_id', - 'catalog_product_link_type', - 'link_type_id' - ), - 'link_type_id', - $installer->getTable('catalog_product_link_type'), - 'link_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Link Attribute Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_link_attribute_decimal' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_link_attribute_decimal') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true), - 'Product Link Attribute ID' -)->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'unsigned' => true), - 'Link ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'default' => '0.0000'), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_link_attribute_decimal', array('link_id')), - array('link_id') -)->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_decimal', - array('product_link_attribute_id', 'link_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('product_link_attribute_id', 'link_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_decimal', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_decimal', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Link Decimal Attribute Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_link_attribute_int' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_link_attribute_int') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true), - 'Product Link Attribute ID' -)->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'unsigned' => true), - 'Link ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'default' => '0'), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_link_attribute_int', array('link_id')), - array('link_id') -)->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_int', - array('product_link_attribute_id', 'link_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('product_link_attribute_id', 'link_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_int', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_int', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Link Integer Attribute Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_link_attribute_varchar' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_link_attribute_varchar') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product Link Attribute ID' -)->addColumn( - 'link_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'unsigned' => true), - 'Link ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array(), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_link_attribute_varchar', array('link_id')), - array('link_id') -)->addIndex( - $installer->getIdxName( - 'catalog_product_link_attribute_varchar', - array('product_link_attribute_id', 'link_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('product_link_attribute_id', 'link_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addForeignKey( - $installer->getFkName('catalog_product_link_attribute_varchar', 'link_id', 'catalog_product_link', 'link_id'), - 'link_id', - $installer->getTable('catalog_product_link'), - 'link_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName( - 'catalog_product_link_attribute_varchar', - 'product_link_attribute_id', - 'catalog_product_link_attribute', - 'product_link_attribute_id' - ), - 'product_link_attribute_id', - $installer->getTable('catalog_product_link_attribute'), - 'product_link_attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Link Varchar Attribute Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_tier_price' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_tier_price') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'all_groups', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '1'), - 'Is Applicable To All Customer Groups' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Customer Group ID' -)->addColumn( - 'qty', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'default' => '1.0000'), - 'QTY' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'default' => '0.0000'), - 'Value' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false), - 'Website ID' -)->addIndex( - $installer->getIdxName( - 'catalog_product_entity_tier_price', - array('entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_entity_tier_price', array('customer_group_id')), - array('customer_group_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_tier_price', array('website_id')), - array('website_id') -)->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_tier_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Tier Price Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_media_gallery' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_media_gallery') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Attribute ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array(), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery', array('entity_id')), - array('entity_id') -)->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Media Gallery Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_entity_media_gallery_value' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_media_gallery_value') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Value ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Store ID' -)->addColumn( - 'label', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array(), - 'Label' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true), - 'Position' -)->addColumn( - 'disabled', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Disabled' -)->addIndex( - $installer->getIdxName('catalog_product_entity_media_gallery_value', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_media_gallery_value', - 'value_id', - 'catalog_product_entity_media_gallery', - 'value_id' - ), - 'value_id', - $installer->getTable('catalog_product_entity_media_gallery'), - 'value_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Media Gallery Attribute Value Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_option' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_option') -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Option ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->addColumn( - 'type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - array('nullable' => true, 'default' => null), - 'Type' -)->addColumn( - 'is_require', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('nullable' => false, 'default' => '1'), - 'Is Required' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - array(), - 'SKU' -)->addColumn( - 'max_characters', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true), - 'Max Characters' -)->addColumn( - 'file_extension', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, - array(), - 'File Extension' -)->addColumn( - 'image_size_x', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true), - 'Image Size X' -)->addColumn( - 'image_size_y', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true), - 'Image Size Y' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Sort Order' -)->addIndex( - $installer->getIdxName('catalog_product_option', array('product_id')), - array('product_id') -)->addForeignKey( - $installer->getFkName('catalog_product_option', 'product_id', 'catalog_product_entity', 'entity_id'), - 'product_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Option Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_option_price' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_option_price') -)->addColumn( - 'option_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Option Price ID' -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Option ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'default' => '0.0000'), - 'Price' -)->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - array('nullable' => false, 'default' => 'fixed'), - 'Price Type' -)->addIndex( - $installer->getIdxName( - 'catalog_product_option_price', - array('option_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('option_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_option_price', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_product_option_price', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_option_price', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Option Price Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_option_title' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_option_title') -)->addColumn( - 'option_title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Option Title ID' -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Option ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => true, 'default' => null), - 'Title' -)->addIndex( - $installer->getIdxName( - 'catalog_product_option_title', - array('option_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('option_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_option_title', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName('catalog_product_option_title', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_option_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Option Title Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_option_type_value' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_option_type_value') -)->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Option Type ID' -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Option ID' -)->addColumn( - 'sku', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 64, - array(), - 'SKU' -)->addColumn( - 'sort_order', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Sort Order' -)->addIndex( - $installer->getIdxName('catalog_product_option_type_value', array('option_id')), - array('option_id') -)->addForeignKey( - $installer->getFkName('catalog_product_option_type_value', 'option_id', 'catalog_product_option', 'option_id'), - 'option_id', - $installer->getTable('catalog_product_option'), - 'option_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Option Type Value Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_option_type_price' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_option_type_price') -)->addColumn( - 'option_type_price_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Option Type Price ID' -)->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Option Type ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'default' => '0.0000'), - 'Price' -)->addColumn( - 'price_type', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 7, - array('nullable' => false, 'default' => 'fixed'), - 'Price Type' -)->addIndex( - $installer->getIdxName( - 'catalog_product_option_type_price', - array('option_type_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('option_type_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_option_type_price', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName( - 'catalog_product_option_type_price', - 'option_type_id', - 'catalog_product_option_type_value', - 'option_type_id' - ), - 'option_type_id', - $installer->getTable('catalog_product_option_type_value'), - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_option_type_price', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Option Type Price Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_option_type_title' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_option_type_title') -)->addColumn( - 'option_type_title_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true), - 'Option Type Title ID' -)->addColumn( - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Option Type ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'title', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => true, 'default' => null), - 'Title' -)->addIndex( - $installer->getIdxName( - 'catalog_product_option_type_title', - array('option_type_id', 'store_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('option_type_id', 'store_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_option_type_title', array('store_id')), - array('store_id') -)->addForeignKey( - $installer->getFkName( - 'catalog_product_option_type_title', - 'option_type_id', - 'catalog_product_option_type_value', - 'option_type_id' - ), - 'option_type_id', - $installer->getTable('catalog_product_option_type_value'), - 'option_type_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_option_type_title', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Option Type Title Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_eav_attribute' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_eav_attribute') -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Attribute ID' -)->addColumn( - 'frontend_input_renderer', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array(), - 'Frontend Input Renderer' -)->addColumn( - 'is_global', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '1'), - 'Is Global' -)->addColumn( - 'is_visible', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '1'), - 'Is Visible' -)->addColumn( - 'is_searchable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Searchable' -)->addColumn( - 'is_filterable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Filterable' -)->addColumn( - 'is_comparable', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Comparable' -)->addColumn( - 'is_visible_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Visible On Front' -)->addColumn( - 'is_html_allowed_on_front', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is HTML Allowed On Front' -)->addColumn( - 'is_used_for_price_rules', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Used For Price Rules' -)->addColumn( - 'is_filterable_in_search', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Filterable In Search' -)->addColumn( - 'used_in_product_listing', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Used In Product Listing' -)->addColumn( - 'used_for_sort_by', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Used For Sorting' -)->addColumn( - 'apply_to', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => true), - 'Apply To' -)->addColumn( - 'is_visible_in_advanced_search', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Visible In Advanced Search' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'default' => '0'), - 'Position' -)->addColumn( - 'is_wysiwyg_enabled', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is WYSIWYG Enabled' -)->addColumn( - 'is_used_for_promo_rules', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Used For Promo Rules' -)->addIndex( - $installer->getIdxName('catalog_eav_attribute', array('used_for_sort_by')), - array('used_for_sort_by') -)->addIndex( - $installer->getIdxName('catalog_eav_attribute', array('used_in_product_listing')), - array('used_in_product_listing') -)->addForeignKey( - $installer->getFkName('catalog_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog EAV Attribute Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_relation' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_relation') -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Parent ID' -)->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Child ID' -)->addIndex( - $installer->getIdxName('catalog_product_relation', array('child_id')), - array('child_id') -)->addForeignKey( - $installer->getFkName('catalog_product_relation', 'child_id', 'catalog_product_entity', 'entity_id'), - 'child_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_relation', 'parent_id', 'catalog_product_entity', 'entity_id'), - 'parent_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Relation Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_eav' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_eav') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Store ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_index_eav', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav', array('store_id')), - array('store_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav', array('value')), - array('value') -)->addForeignKey( - $installer->getFkName('catalog_product_index_eav', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_eav', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_eav', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product EAV Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_eav_decimal' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_eav_decimal') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Store ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'primary' => true), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', array('store_id')), - array('store_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal', array('value')), - array('value') -)->addForeignKey( - $installer->getFkName('catalog_product_index_eav_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), - 'attribute_id', - $installer->getTable('eav_attribute'), - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_eav_decimal', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_eav_decimal', 'store_id', 'store', 'store_id'), - 'store_id', - $installer->getTable('store'), - 'store_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product EAV Decimal Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'default' => '0'), - 'Tax Class ID' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Price' -)->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Final Price' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->addIndex( - $installer->getIdxName('catalog_product_index_price', array('customer_group_id')), - array('customer_group_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_price', array('min_price')), - array('min_price') -)->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'customer_group_id', 'customer_group', 'customer_group_id'), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Price Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_tier_price' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_tier_price') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addIndex( - $installer->getIdxName('catalog_product_index_tier_price', array('customer_group_id')), - array('customer_group_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_tier_price', array('website_id')), - array('website_id') -)->addForeignKey( - $installer->getFkName( - 'catalog_product_index_tier_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Tier Price Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_website' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_website') -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'website_date', - \Magento\Framework\DB\Ddl\Table::TYPE_DATE, - null, - array(), - 'Website Date' -)->addColumn( - 'rate', - \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, - null, - array('default' => '1.0000'), - 'Rate' -)->addIndex( - $installer->getIdxName('catalog_product_index_website', array('website_date')), - array('website_date') -)->addForeignKey( - $installer->getFkName('catalog_product_index_website', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Website Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_cfg_opt_agr_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_agr_idx') -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Parent ID' -)->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Child ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->setComment( - 'Catalog Product Price Indexer Config Option Aggregate Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_cfg_opt_agr_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_agr_tmp') -)->addColumn( - 'parent_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Parent ID' -)->addColumn( - 'child_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Child ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->setComment( - 'Catalog Product Price Indexer Config Option Aggregate Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_cfg_opt_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_idx') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->setComment( - 'Catalog Product Price Indexer Config Option Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_cfg_opt_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_cfg_opt_tmp') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->setComment( - 'Catalog Product Price Indexer Config Option Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_final_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_final_idx') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'default' => '0'), - 'Tax Class ID' -)->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Original Price' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Price' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Base Tier' -)->setComment( - 'Catalog Product Price Indexer Final Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_final_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_final_tmp') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'default' => '0'), - 'Tax Class ID' -)->addColumn( - 'orig_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Original Price' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Price' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->addColumn( - 'base_tier', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Base Tier' -)->setComment( - 'Catalog Product Price Indexer Final Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_opt_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_opt_idx') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->setComment( - 'Catalog Product Price Indexer Option Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_opt_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_opt_tmp') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->setComment( - 'Catalog Product Price Indexer Option Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_opt_agr_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_opt_agr_idx') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Option ID' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->setComment( - 'Catalog Product Price Indexer Option Aggregate Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_opt_agr_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_opt_agr_tmp') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'option_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'), - 'Option ID' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->setComment( - 'Catalog Product Price Indexer Option Aggregate Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_eav_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_eav_idx') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Store ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', array('store_id')), - array('store_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_idx', array('value')), - array('value') -)->setComment( - 'Catalog Product EAV Indexer Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_eav_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_eav_tmp') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Store ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', array('store_id')), - array('store_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_tmp', array('value')), - array('value') -)->setComment( - 'Catalog Product EAV Indexer Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_eav_decimal_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_eav_decimal_idx') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Store ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'primary' => true), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', array('store_id')), - array('store_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_idx', array('value')), - array('value') -)->setComment( - 'Catalog Product EAV Decimal Indexer Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_eav_decimal_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_eav_decimal_tmp') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'attribute_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Attribute ID' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Store ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'primary' => true), - 'Value' -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', array('attribute_id')), - array('attribute_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', array('store_id')), - array('store_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_eav_decimal_tmp', array('value')), - array('value') -)->setComment( - 'Catalog Product EAV Decimal Indexer Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_idx') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'default' => '0'), - 'Tax Class ID' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Price' -)->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Final Price' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', array('customer_group_id')), - array('customer_group_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', array('website_id')), - array('website_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_price_idx', array('min_price')), - array('min_price') -)->setComment( - 'Catalog Product Price Indexer Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_price_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_index_price_tmp') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'tax_class_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'default' => '0'), - 'Tax Class ID' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Price' -)->addColumn( - 'final_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Final Price' -)->addColumn( - 'min_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addColumn( - 'max_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Max Price' -)->addColumn( - 'tier_price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Tier Price' -)->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', array('customer_group_id')), - array('customer_group_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', array('website_id')), - array('website_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_price_tmp', array('min_price')), - array('min_price') -)->setComment( - 'Catalog Product Price Indexer Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_product_index_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_product_index_idx') -)->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Category ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'default' => '0'), - 'Position' -)->addColumn( - 'is_parent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Parent' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false), - 'Visibility' -)->addIndex( - $installer->getIdxName('catalog_category_product_index_idx', array('product_id', 'category_id', 'store_id')), - array('product_id', 'category_id', 'store_id') -)->setComment( - 'Catalog Category Product Indexer Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_product_index_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_product_index_tmp') -)->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Category ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('nullable' => false, 'default' => '0'), - 'Position' -)->addColumn( - 'is_parent', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Is Parent' -)->addColumn( - 'store_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Store ID' -)->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false), - 'Visibility' -)->setComment( - 'Catalog Category Product Indexer Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_product_index_enbl_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_product_index_enbl_idx') -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Visibility' -)->addIndex( - $installer->getIdxName('catalog_category_product_index_enbl_idx', array('product_id')), - array('product_id') -)->setComment( - 'Catalog Category Product Enabled Indexer Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_product_index_enbl_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_product_index_enbl_tmp') -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->addColumn( - 'visibility', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Visibility' -)->addIndex( - $installer->getIdxName('catalog_category_product_index_enbl_tmp', array('product_id')), - array('product_id') -)->setComment( - 'Catalog Category Product Enabled Indexer Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_anc_categs_index_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_anc_categs_index_idx') -)->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Category ID' -)->addColumn( - 'path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => true, 'default' => null), - 'Path' -)->addIndex( - $installer->getIdxName('catalog_category_anc_categs_index_idx', array('category_id')), - array('category_id') -)->setComment( - 'Catalog Category Anchor Indexer Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_anc_categs_index_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_anc_categs_index_tmp') -)->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Category ID' -)->addColumn( - 'path', - \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, - array('nullable' => true, 'default' => null), - 'Path' -)->addIndex( - $installer->getIdxName('catalog_category_anc_categs_index_tmp', array('category_id')), - array('category_id') -)->setComment( - 'Catalog Category Anchor Indexer Temp Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_anc_products_index_idx' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_anc_products_index_idx') -)->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Category ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->addColumn( - 'position', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true), - 'Position' -)->setComment( - 'Catalog Category Anchor Product Indexer Index Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_category_anc_products_index_tmp' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_category_anc_products_index_tmp') -)->addColumn( - 'category_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Category ID' -)->addColumn( - 'product_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Product ID' -)->setComment( - 'Catalog Category Anchor Product Indexer Temp Table' -); -$installer->getConnection()->createTable($table); - -$installer->endSetup(); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php b/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php new file mode 100644 index 0000000000000..8e57e4ec2e23c --- /dev/null +++ b/app/code/Magento/Catalog/sql/catalog_setup/install-2.0.0.php @@ -0,0 +1,4530 @@ +startSetup(); + +/** + * Create table 'catalog_product_entity' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute Set ID' + ) + ->addColumn( + 'type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => false, 'default' => 'simple'], + 'Type ID' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'has_options', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '0'], + 'Has Options' + ) + ->addColumn( + 'required_options', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Required Options' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Update Time' + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity', ['entity_type_id']), + ['entity_type_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity', ['attribute_set_id']), + ['attribute_set_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity', ['sku']), + ['sku'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity', 'attribute_set_id', 'eav_attribute_set', 'attribute_set_id'), + 'attribute_set_id', + $installer->getTable('eav_attribute_set'), + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity', 'entity_type_id', 'eav_entity_type', 'entity_type_id'), + 'entity_type_id', + $installer->getTable('eav_entity_type'), + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_datetime' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_datetime')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_datetime', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_datetime', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Datetime Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_decimal' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_decimal')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_decimal', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Decimal Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_int' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_int')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_int', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_int', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_int', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Integer Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_text' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_text')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_text', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_text', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_text', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Text Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_varchar' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_varchar')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_varchar', + ['entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_varchar', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Varchar Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_product_entity_gallery' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_product_entity_gallery')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_gallery', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_gallery', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_gallery', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product Gallery Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity')) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_set_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attriute Set ID' + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Parent Category ID' + ) + ->addColumn( + 'created_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Creation Time' + ) + ->addColumn( + 'updated_at', + \Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP, + null, + [], + 'Update Time' + ) + ->addColumn( + 'path', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => false], + 'Tree Path' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Position' + ) + ->addColumn( + 'level', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Tree Level' + ) + ->addColumn( + 'children_count', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false], + 'Child Count' + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity', ['level']), + ['level'] + ) + ->setComment('Catalog Category Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_datetime' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_datetime')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DATETIME, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_datetime', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_datetime', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_datetime', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Datetime Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_decimal' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_decimal')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_decimal', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_decimal', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_decimal', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Decimal Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_int' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_int')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_int', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_int', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_int', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Integer Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_text' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_text')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + '64k', + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_text', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_text', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_text', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Text Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_entity_varchar' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_entity_varchar')) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity Type ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_entity_varchar', + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_type_id', 'entity_id', 'attribute_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['entity_id']), + ['entity_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_category_entity_varchar', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'entity_id', 'catalog_category_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_entity_varchar', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Category Varchar Attribute Backend Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_product' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_product')) + ->addColumn( + 'category_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Category ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addIndex( + $installer->getIdxName('catalog_category_product', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_category_product', 'category_id', 'catalog_category_entity', 'entity_id'), + 'category_id', + $installer->getTable('catalog_category_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_category_product', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment('Catalog Product To Category Linkage Table'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_category_product_index' + */ +$table = $installer->getConnection() + ->newTable($installer->getTable('catalog_category_product_index')) + ->addColumn( + 'category_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Category ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => false, 'nullable' => true, 'default' => null], + 'Position' + ) + ->addColumn( + 'is_parent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Parent' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'visibility', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Visibility' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_product_index', + ['product_id', 'store_id', 'category_id', 'visibility'] + ), + ['product_id', 'store_id', 'category_id', 'visibility'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_category_product_index', + ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] + ), + ['store_id', 'category_id', 'visibility', 'is_parent', 'position'] + ) + ->setComment('Catalog Category Product Index'); +$installer->getConnection()->createTable($table); + +/** + * Create table 'catalog_compare_item' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_compare_item') + ) + ->addColumn( + 'catalog_compare_item_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Compare Item ID' + ) + ->addColumn( + 'visitor_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Visitor ID' + ) + ->addColumn( + 'customer_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Customer ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Store ID' + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['product_id']), + ['product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['visitor_id', 'product_id']), + ['visitor_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['customer_id', 'product_id']), + ['customer_id', 'product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_compare_item', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'customer_id', 'customer_entity', 'entity_id'), + 'customer_id', + $installer->getTable('customer_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_compare_item', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_SET_NULL, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Compare Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_website' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_website') + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_website', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_website', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product To Website Linkage Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_link_type' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_type') + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link Type ID' + ) + ->addColumn( + 'code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Code' + ) + ->setComment( + 'Catalog Product Link Type Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_link' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link') + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Link ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'linked_product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Linked Product ID' + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link Type ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link', + ['link_type_id', 'product_id', 'linked_product_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['link_type_id', 'product_id', 'linked_product_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_link', ['product_id']), + ['product_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_link', ['linked_product_id']), + ['linked_product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', 'linked_product_id', 'catalog_product_entity', 'entity_id'), + 'linked_product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link', 'link_type_id', 'catalog_product_link_type', 'link_type_id'), + 'link_type_id', + $installer->getTable('catalog_product_link_type'), + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product To Product Linkage Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_link_attribute' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute') + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Link Type ID' + ) + ->addColumn( + 'product_link_attribute_code', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Product Link Attribute Code' + ) + ->addColumn( + 'data_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 32, + ['nullable' => true, 'default' => null], + 'Data Type' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute', ['link_type_id']), + ['link_type_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute', + 'link_type_id', + 'catalog_product_link_type', + 'link_type_id' + ), + 'link_type_id', + $installer->getTable('catalog_product_link_type'), + 'link_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Attribute Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_link_attribute_decimal' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_decimal') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_decimal', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_decimal', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_decimal', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_decimal', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Decimal Attribute Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_link_attribute_int' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_int') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_int', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_int', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_int', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_int', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Integer Attribute Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_link_attribute_varchar' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_link_attribute_varchar') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product Link Attribute ID' + ) + ->addColumn( + 'link_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'unsigned' => true], + 'Link ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_link_attribute_varchar', ['link_id']), + ['link_id'] + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_link_attribute_varchar', + ['product_link_attribute_id', 'link_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['product_link_attribute_id', 'link_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_link_attribute_varchar', 'link_id', 'catalog_product_link', 'link_id'), + 'link_id', + $installer->getTable('catalog_product_link'), + 'link_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_link_attribute_varchar', + 'product_link_attribute_id', + 'catalog_product_link_attribute', + 'product_link_attribute_id' + ), + 'product_link_attribute_id', + $installer->getTable('catalog_product_link_attribute'), + 'product_link_attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Link Varchar Attribute Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_entity_tier_price' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_tier_price') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'all_groups', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Applicable To All Customer Groups' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group ID' + ) + ->addColumn( + 'qty', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '1.0000'], + 'QTY' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_tier_price', + ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'all_groups', 'customer_group_id', 'qty', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_tier_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_tier_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_tier_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Tier Price Attribute Backend Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_entity_media_gallery' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_media_gallery') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Attribute ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery', ['entity_id']), + ['entity_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery', + 'entity_id', + 'catalog_product_entity', + 'entity_id' + ), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Media Gallery Attribute Backend Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_entity_media_gallery_value' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_media_gallery_value') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Value ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'label', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Label' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Position' + ) + ->addColumn( + 'disabled', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Disabled' + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_media_gallery_value', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_media_gallery_value', + 'value_id', + 'catalog_product_entity_media_gallery', + 'value_id' + ), + 'value_id', + $installer->getTable('catalog_product_entity_media_gallery'), + 'value_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_media_gallery_value', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Media Gallery Attribute Value Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_option' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option') + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + ['nullable' => true, 'default' => null], + 'Type' + ) + ->addColumn( + 'is_require', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => '1'], + 'Is Required' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'max_characters', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true], + 'Max Characters' + ) + ->addColumn( + 'file_extension', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 50, + [], + 'File Extension' + ) + ->addColumn( + 'image_size_x', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Image Size X' + ) + ->addColumn( + 'image_size_y', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true], + 'Image Size Y' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addIndex( + $installer->getIdxName('catalog_product_option', ['product_id']), + ['product_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option', 'product_id', 'catalog_product_entity', 'entity_id'), + 'product_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_option_price' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_price') + ) + ->addColumn( + 'option_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Price ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 7, + ['nullable' => false, 'default' => 'fixed'], + 'Price Type' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_price', + ['option_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_price', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_price', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_price', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Price Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_option_title' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_title') + ) + ->addColumn( + 'option_title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Title ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_title', + ['option_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_title', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_title', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Title Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_option_type_value' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_value') + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'sku', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 64, + [], + 'SKU' + ) + ->addColumn( + 'sort_order', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Sort Order' + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_value', ['option_id']), + ['option_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_value', 'option_id', 'catalog_product_option', 'option_id'), + 'option_id', + $installer->getTable('catalog_product_option'), + 'option_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Value Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_option_type_price' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_price') + ) + ->addColumn( + 'option_type_price_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type Price ID' + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option Type ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Price' + ) + ->addColumn( + 'price_type', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 7, + ['nullable' => false, 'default' => 'fixed'], + 'Price Type' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_type_price', + ['option_type_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_type_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_price', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_option_type_price', + 'option_type_id', + 'catalog_product_option_type_value', + 'option_type_id' + ), + 'option_type_id', + $installer->getTable('catalog_product_option_type_value'), + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_price', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Price Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_option_type_title' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_option_type_title') + ) + ->addColumn( + 'option_type_title_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Option Type Title ID' + ) + ->addColumn( + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Option Type ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'title', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true, 'default' => null], + 'Title' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_option_type_title', + ['option_type_id', 'store_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['option_type_id', 'store_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_option_type_title', ['store_id']), + ['store_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_option_type_title', + 'option_type_id', + 'catalog_product_option_type_value', + 'option_type_id' + ), + 'option_type_id', + $installer->getTable('catalog_product_option_type_value'), + 'option_type_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_option_type_title', 'store_id', 'store', 'store_id'), + 'store_id', + $installer->getTable('store'), + 'store_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Option Type Title Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_eav_attribute' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_eav_attribute') + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'frontend_input_renderer', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + [], + 'Frontend Input Renderer' + ) + ->addColumn( + 'is_global', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Global' + ) + ->addColumn( + 'is_visible', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Visible' + ) + ->addColumn( + 'is_searchable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Searchable' + ) + ->addColumn( + 'is_filterable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Filterable' + ) + ->addColumn( + 'is_comparable', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Comparable' + ) + ->addColumn( + 'is_visible_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible On Front' + ) + ->addColumn( + 'is_html_allowed_on_front', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is HTML Allowed On Front' + ) + ->addColumn( + 'is_used_for_price_rules', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Price Rules' + ) + ->addColumn( + 'is_filterable_in_search', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Filterable In Search' + ) + ->addColumn( + 'used_in_product_listing', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used In Product Listing' + ) + ->addColumn( + 'used_for_sort_by', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Sorting' + ) + ->addColumn( + 'apply_to', + \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, + 255, + ['nullable' => true], + 'Apply To' + ) + ->addColumn( + 'is_visible_in_advanced_search', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Visible In Advanced Search' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'is_wysiwyg_enabled', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is WYSIWYG Enabled' + ) + ->addColumn( + 'is_used_for_promo_rules', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Used For Promo Rules' + ) + ->addColumn( + 'is_required_in_admin_store', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Required In Admin Store' + ) + ->addIndex( + $installer->getIdxName('catalog_eav_attribute', ['used_for_sort_by']), + ['used_for_sort_by'] + ) + ->addIndex( + $installer->getIdxName('catalog_eav_attribute', ['used_in_product_listing']), + ['used_in_product_listing'] + ) + ->addForeignKey( + $installer->getFkName('catalog_eav_attribute', 'attribute_id', 'eav_attribute', 'attribute_id'), + 'attribute_id', + $installer->getTable('eav_attribute'), + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog EAV Attribute Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_relation' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_relation') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addIndex( + $installer->getIdxName('catalog_product_relation', ['child_id']), + ['child_id'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_relation', 'child_id', 'catalog_product_entity', 'entity_id'), + 'child_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_relation', 'parent_id', 'catalog_product_entity', 'entity_id'), + 'parent_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Relation Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_eav' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_eav_decimal' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => false], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Decimal Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['min_price']), + ['min_price'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price', ['website_id', 'customer_group_id', 'min_price']), + ['website_id', 'customer_group_id', 'min_price'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Price Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_tier_price' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_tier_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_tier_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_tier_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_tier_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_tier_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_tier_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Tier Price Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_website' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_website') + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'website_date', + \Magento\Framework\DB\Ddl\Table::TYPE_DATE, + null, + [], + 'Website Date' + ) + ->addColumn( + 'rate', + \Magento\Framework\DB\Ddl\Table::TYPE_FLOAT, + null, + ['default' => '1.0000'], + 'Rate' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_website', ['website_date']), + ['website_date'] + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_website', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Website Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_cfg_opt_agr_idx' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_agr_idx') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Aggregate Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_cfg_opt_agr_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_agr_tmp') + ) + ->addColumn( + 'parent_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Parent ID' + ) + ->addColumn( + 'child_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Child ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Aggregate Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_cfg_opt_idx' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_cfg_opt_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_cfg_opt_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Config Option Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_final_idx' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_final_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->setComment( + 'Catalog Product Price Indexer Final Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_final_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_final_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'orig_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Original Price' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'base_tier', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Tier' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addColumn( + 'base_group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Base Group Price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Final Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_opt_idx' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Option Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_opt_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Option Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_opt_agr_idx' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_agr_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setComment( + 'Catalog Product Price Indexer Option Aggregate Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_opt_agr_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_opt_agr_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'option_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true, 'default' => '0'], + 'Option ID' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Option Aggregate Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_eav_idx' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_idx', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Indexer Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_eav_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_tmp', ['value']), + ['value'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product EAV Indexer Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_eav_decimal_idx' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => true], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_idx', ['value']), + ['value'] + ) + ->setComment( + 'Catalog Product EAV Decimal Indexer Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_eav_decimal_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_eav_decimal_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'attribute_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Attribute ID' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Store ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'primary' => false], + 'Value' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['attribute_id']), + ['attribute_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['store_id']), + ['store_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_eav_decimal_tmp', ['value']), + ['value'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product EAV Decimal Indexer Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_idx' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_idx') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_idx', ['min_price']), + ['min_price'] + ) + ->setComment( + 'Catalog Product Price Indexer Index Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_price_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_price_tmp') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'tax_class_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'default' => '0'], + 'Tax Class ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Price' + ) + ->addColumn( + 'final_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Final Price' + ) + ->addColumn( + 'min_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addColumn( + 'max_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Max Price' + ) + ->addColumn( + 'tier_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Tier Price' + ) + ->addColumn( + 'group_price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Group price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['website_id']), + ['website_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_price_tmp', ['min_price']), + ['min_price'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Product Price Indexer Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_category_product_index_tmp' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_category_product_index_tmp') + ) + ->addColumn( + 'category_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Category ID' + ) + ->addColumn( + 'product_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Product ID' + ) + ->addColumn( + 'position', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['nullable' => false, 'default' => '0'], + 'Position' + ) + ->addColumn( + 'is_parent', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Is Parent' + ) + ->addColumn( + 'store_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Store ID' + ) + ->addColumn( + 'visibility', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Visibility' + ) + ->addIndex( + $installer->getIdxName('catalog_category_product_index_tmp', ['product_id', 'category_id', 'store_id']), + ['product_id', 'category_id', 'store_id'] + ) + ->setOption( + 'type', + \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY + ) + ->setComment( + 'Catalog Category Product Indexer Temp Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_entity_group_price' + */ +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_entity_group_price') + ) + ->addColumn( + 'value_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'nullable' => false, 'primary' => true], + 'Value ID' + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Entity ID' + ) + ->addColumn( + 'all_groups', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '1'], + 'Is Applicable To All Customer Groups' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => '0'], + 'Customer Group ID' + ) + ->addColumn( + 'value', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + ['nullable' => false, 'default' => '0.0000'], + 'Value' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false], + 'Website ID' + ) + ->addIndex( + $installer->getIdxName( + 'catalog_product_entity_group_price', + ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + ), + ['entity_id', 'all_groups', 'customer_group_id', 'website_id'], + ['type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_group_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_entity_group_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_entity_group_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_entity_group_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Group Price Attribute Backend Table' + ); +$installer->getConnection() + ->createTable($table); + +/** + * Create table 'catalog_product_index_group_price' + */ + +$table = $installer->getConnection() + ->newTable( + $installer->getTable('catalog_product_index_group_price') + ) + ->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity ID' + ) + ->addColumn( + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Customer Group ID' + ) + ->addColumn( + 'website_id', + \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'primary' => true], + 'Website ID' + ) + ->addColumn( + 'price', + \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, + '12,4', + [], + 'Min Price' + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_group_price', ['customer_group_id']), + ['customer_group_id'] + ) + ->addIndex( + $installer->getIdxName('catalog_product_index_group_price', ['website_id']), + ['website_id'] + ) + ->addForeignKey( + $installer->getFkName( + 'catalog_product_index_group_price', + 'customer_group_id', + 'customer_group', + 'customer_group_id' + ), + 'customer_group_id', + $installer->getTable('customer_group'), + 'customer_group_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), + 'entity_id', + $installer->getTable('catalog_product_entity'), + 'entity_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->addForeignKey( + $installer->getFkName('catalog_product_index_group_price', 'website_id', 'store_website', 'website_id'), + 'website_id', + $installer->getTable('store_website'), + 'website_id', + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, + \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE + ) + ->setComment( + 'Catalog Product Group Price Index Table' + ); +$installer->getConnection() + ->createTable($table); + +$installer->endSetup(); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.11-1.6.0.0.12.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.11-1.6.0.0.12.php deleted file mode 100644 index 23e7f5ecd9744..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.11-1.6.0.0.12.php +++ /dev/null @@ -1,32 +0,0 @@ -getConnection()->addIndex( - $installer->getTable('catalog_product_index_price'), - $installer->getIdxName('catalog_product_index_price', $indexFields), - $indexFields -); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.2-1.6.0.0.3.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.2-1.6.0.0.3.php deleted file mode 100644 index ef3572333cb6c..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.2-1.6.0.0.3.php +++ /dev/null @@ -1,48 +0,0 @@ -getTable('catalog_product_index_eav_decimal'); -$indexName = $installer->getConnection()->getPrimaryKeyName($tableName); - - -$tableNameTmp = $installer->getTable('catalog_product_index_eav_decimal_tmp'); -$indexNameTmp = $installer->getConnection()->getPrimaryKeyName($tableNameTmp); - -$fields = array('entity_id', 'attribute_id', 'store_id'); - -$installer->getConnection()->addIndex( - $tableName, - $indexName, - $fields, - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY -); - -$installer->getConnection()->addIndex( - $tableNameTmp, - $indexNameTmp, - $fields, - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_PRIMARY -); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php deleted file mode 100644 index fe4401d846063..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.25-1.6.0.0.26.php +++ /dev/null @@ -1,46 +0,0 @@ -getConnection(); - -$connection->dropForeignKey( - $this->getTable('catalog_category_product_index'), - $this->getFkName('catalog_category_product_index', 'category_id', 'catalog_category_entity', 'entity_id') -)->dropForeignKey( - $this->getTable('catalog_category_product_index'), - $this->getFkName('catalog_category_product_index', 'product_id', 'catalog_product_entity', 'entity_id') -)->dropForeignKey( - $this->getTable('catalog_category_product_index'), - $this->getFkName('catalog_category_product_index', 'store_id', 'store', 'store_id') -); - -$connection->dropTable($this->getTable('catalog_product_enabled_index')); -$connection->dropTable($this->getTable('catalog_category_product_index_idx')); -$connection->dropTable($this->getTable('catalog_category_product_index_enbl_idx')); -$connection->dropTable($this->getTable('catalog_category_product_index_enbl_tmp')); -$connection->dropTable($this->getTable('catalog_category_anc_categs_index_idx')); -$connection->dropTable($this->getTable('catalog_category_anc_categs_index_tmp')); -$connection->dropTable($this->getTable('catalog_category_anc_products_index_idx')); -$connection->dropTable($this->getTable('catalog_category_anc_products_index_tmp')); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.26-1.6.0.0.27.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.26-1.6.0.0.27.php deleted file mode 100644 index d96ff3e253e5c..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.26-1.6.0.0.27.php +++ /dev/null @@ -1,59 +0,0 @@ -startSetup(); - -$this->getConnection()->dropForeignKey( - $this->getTable('catalog_product_index_eav'), - $this->getFkName('catalog_product_index_eav', 'attribute_id', 'eav_attribute', 'attribute_id') -); - -$this->getConnection()->dropForeignKey( - $this->getTable('catalog_product_index_eav'), - $this->getFkName('catalog_product_index_eav', 'entity_id', 'catalog_product_entity', 'entity_id') -); - -$this->getConnection()->dropForeignKey( - $this->getTable('catalog_product_index_eav'), - $this->getFkName('catalog_product_index_eav', 'store_id', 'store', 'store_id') -); - -$this->getConnection()->dropForeignKey( - $this->getTable('catalog_product_index_eav_decimal'), - $this->getFkName('catalog_product_index_eav_decimal', 'attribute_id', 'eav_attribute', 'attribute_id') -); - -$this->getConnection()->dropForeignKey( - $this->getTable('catalog_product_index_eav_decimal'), - $this->getFkName('catalog_product_index_eav_decimal', 'entity_id', 'catalog_product_entity', 'entity_id') -); - -$this->getConnection()->dropForeignKey( - $this->getTable('catalog_product_index_eav_decimal'), - $this->getFkName('catalog_product_index_eav_decimal', 'store_id', 'store', 'store_id') -); - -$this->endSetup(); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.27-1.6.0.0.28.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.27-1.6.0.0.28.php deleted file mode 100644 index 2c6b5eaf8ef8e..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.27-1.6.0.0.28.php +++ /dev/null @@ -1,36 +0,0 @@ -getConnection()->addColumn( - $this->getTable('catalog_eav_attribute'), - 'is_required_in_admin_store', - array( - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - 'unsigned' => true, - 'nullable' => false, - 'default' => '0', - 'comment' => 'Is Required In Admin Store' - ) -); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.4-1.6.0.0.5.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.4-1.6.0.0.5.php deleted file mode 100644 index 03e31c841eac9..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.4-1.6.0.0.5.php +++ /dev/null @@ -1,38 +0,0 @@ -getConnection()->modifyColumn( - $installer->getTable('catalog_category_product_index'), - 'position', - array( - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 'unsigned' => false, - 'nullable' => true, - 'default' => null, - 'comment' => 'Position' - ) -); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.6-1.6.0.0.7.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.6-1.6.0.0.7.php deleted file mode 100644 index ce665c8663617..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.6-1.6.0.0.7.php +++ /dev/null @@ -1,37 +0,0 @@ -getConnection()->addColumn( - $installer->getTable('catalog_category_anc_products_index_tmp'), - 'position', - array( - 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - 'unsigned' => true, - 'nullable' => true, - 'comment' => 'Position' - ) -); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.7-1.6.0.0.8.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.7-1.6.0.0.8.php deleted file mode 100644 index 0eafd3ea2c44f..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.7-1.6.0.0.8.php +++ /dev/null @@ -1,74 +0,0 @@ -getConnection(); - -$connection->addIndex( - $installer->getTable('catalog_category_product_index_tmp'), - $installer->getIdxName('catalog_category_product_index_tmp', array('product_id', 'category_id', 'store_id')), - array('product_id', 'category_id', 'store_id') -); - -$table = $installer->getTable('catalog_category_product_index_enbl_idx'); -$connection->dropIndex($table, 'IDX_CATALOG_CATEGORY_PRODUCT_INDEX_ENBL_IDX_PRODUCT_ID'); -$connection->addIndex( - $table, - $installer->getIdxName('catalog_category_product_index_enbl_idx', array('product_id', 'visibility')), - array('product_id', 'visibility') -); - - -$table = $installer->getTable('catalog_category_product_index_enbl_tmp'); -$connection->dropIndex($table, 'IDX_CATALOG_CATEGORY_PRODUCT_INDEX_ENBL_TMP_PRODUCT_ID'); -$connection->addIndex( - $table, - $installer->getIdxName('catalog_category_product_index_enbl_tmp', array('product_id', 'visibility')), - array('product_id', 'visibility') -); - -$connection->addIndex( - $installer->getTable('catalog_category_anc_products_index_idx'), - $installer->getIdxName('catalog_category_anc_products_index_idx', array('category_id', 'product_id', 'position')), - array('category_id', 'product_id', 'position') -); - -$connection->addIndex( - $installer->getTable('catalog_category_anc_products_index_tmp'), - $installer->getIdxName('catalog_category_anc_products_index_tmp', array('category_id', 'product_id', 'position')), - array('category_id', 'product_id', 'position') -); - -$connection->addIndex( - $installer->getTable('catalog_category_anc_categs_index_idx'), - $installer->getIdxName('catalog_category_anc_categs_index_idx', array('path', 'category_id')), - array('path', 'category_id') -); - -$connection->addIndex( - $installer->getTable('catalog_category_anc_categs_index_tmp'), - $installer->getIdxName('catalog_category_anc_categs_index_tmp', array('path', 'category_id')), - array('path', 'category_id') -); diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.8-1.6.0.0.9.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.8-1.6.0.0.9.php deleted file mode 100644 index c0f00870705a9..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.8-1.6.0.0.9.php +++ /dev/null @@ -1,46 +0,0 @@ -getConnection(); -$memoryTables = array( - 'catalog_category_anc_categs_index_tmp', - 'catalog_category_anc_products_index_tmp', - 'catalog_category_product_index_enbl_tmp', - 'catalog_category_product_index_tmp', - 'catalog_product_index_eav_decimal_tmp', - 'catalog_product_index_eav_tmp', - 'catalog_product_index_price_cfg_opt_agr_tmp', - 'catalog_product_index_price_cfg_opt_tmp', - 'catalog_product_index_price_final_tmp', - 'catalog_product_index_price_opt_agr_tmp', - 'catalog_product_index_price_opt_tmp', - 'catalog_product_index_price_tmp' -); - -foreach ($memoryTables as $table) { - $connection->changeTableEngine($this->getTable($table), \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY); -} diff --git a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php b/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php deleted file mode 100644 index 5822843b12924..0000000000000 --- a/app/code/Magento/Catalog/sql/catalog_setup/upgrade-1.6.0.0.9-1.6.0.0.10.php +++ /dev/null @@ -1,216 +0,0 @@ -getConnection(); - -/** - * Create table 'catalog_product_entity_group_price' - */ -$table = $installer->getConnection()->newTable( - $installer->getTable('catalog_product_entity_group_price') -)->addColumn( - 'value_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('identity' => true, 'nullable' => false, 'primary' => true), - 'Value ID' -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Entity ID' -)->addColumn( - 'all_groups', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '1'), - 'Is Applicable To All Customer Groups' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'default' => '0'), - 'Customer Group ID' -)->addColumn( - 'value', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array('nullable' => false, 'default' => '0.0000'), - 'Value' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false), - 'Website ID' -)->addIndex( - $installer->getIdxName( - 'catalog_product_entity_group_price', - array('entity_id', 'all_groups', 'customer_group_id', 'website_id'), - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE - ), - array('entity_id', 'all_groups', 'customer_group_id', 'website_id'), - array('type' => \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE) -)->addIndex( - $installer->getIdxName('catalog_product_entity_group_price', array('customer_group_id')), - array('customer_group_id') -)->addIndex( - $installer->getIdxName('catalog_product_entity_group_price', array('website_id')), - array('website_id') -)->addForeignKey( - $installer->getFkName( - 'catalog_product_entity_group_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_entity_group_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Group Price Attribute Backend Table' -); -$installer->getConnection()->createTable($table); - -/** - * Create table 'catalog_product_index_group_price' - */ -$table = $connection->newTable( - $installer->getTable('catalog_product_index_group_price') -)->addColumn( - 'entity_id', - \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Entity ID' -)->addColumn( - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Customer Group ID' -)->addColumn( - 'website_id', - \Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT, - null, - array('unsigned' => true, 'nullable' => false, 'primary' => true), - 'Website ID' -)->addColumn( - 'price', - \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, - '12,4', - array(), - 'Min Price' -)->addIndex( - $installer->getIdxName('catalog_product_index_group_price', array('customer_group_id')), - array('customer_group_id') -)->addIndex( - $installer->getIdxName('catalog_product_index_group_price', array('website_id')), - array('website_id') -)->addForeignKey( - $installer->getFkName( - 'catalog_product_index_group_price', - 'customer_group_id', - 'customer_group', - 'customer_group_id' - ), - 'customer_group_id', - $installer->getTable('customer_group'), - 'customer_group_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', 'entity_id', 'catalog_product_entity', 'entity_id'), - 'entity_id', - $installer->getTable('catalog_product_entity'), - 'entity_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->addForeignKey( - $installer->getFkName('catalog_product_index_group_price', 'website_id', 'store_website', 'website_id'), - 'website_id', - $installer->getTable('store_website'), - 'website_id', - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE, - \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE -)->setComment( - 'Catalog Product Group Price Index Table' -); -$connection->createTable($table); - -$finalPriceIndexerTables = array('catalog_product_index_price_final_idx', 'catalog_product_index_price_final_tmp'); - -$priceIndexerTables = array( - 'catalog_product_index_price_opt_agr_idx', - 'catalog_product_index_price_opt_agr_tmp', - 'catalog_product_index_price_opt_idx', - 'catalog_product_index_price_opt_tmp', - 'catalog_product_index_price_idx', - 'catalog_product_index_price_tmp', - 'catalog_product_index_price_cfg_opt_agr_idx', - 'catalog_product_index_price_cfg_opt_agr_tmp', - 'catalog_product_index_price_cfg_opt_idx', - 'catalog_product_index_price_cfg_opt_tmp', - 'catalog_product_index_price' -); - -foreach ($finalPriceIndexerTables as $table) { - $connection->addColumn( - $installer->getTable($table), - 'group_price', - array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'comment' => 'Group price') - ); - $connection->addColumn( - $installer->getTable($table), - 'base_group_price', - array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'comment' => 'Base Group Price') - ); -} - -foreach ($priceIndexerTables as $table) { - $connection->addColumn( - $installer->getTable($table), - 'group_price', - array('type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL, 'length' => '12,4', 'comment' => 'Group price') - ); -} diff --git a/app/code/Magento/Ui/view/base/templates/filter/default.phtml b/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js similarity index 65% rename from app/code/Magento/Ui/view/base/templates/filter/default.phtml rename to app/code/Magento/Catalog/view/adminhtml/requirejs-config.js index 04fc20ce0a2f1..9bea1b0cdb824 100644 --- a/app/code/Magento/Ui/view/base/templates/filter/default.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/requirejs-config.js @@ -1,4 +1,3 @@ - - - -
- -
\ No newline at end of file +var config = { + map: { + '*': { + categoryForm: 'Magento_Catalog/catalog/category/form', + newCategoryDialog: 'Magento_Catalog/js/new-category-dialog', + categoryTree: 'Magento_Catalog/js/category-tree', + productGallery: 'Magento_Catalog/js/product-gallery', + baseImage: 'Magento_Catalog/catalog/base-image-uploader' + } + }, + deps: [ + "Magento_Catalog/catalog/product" + ] +}; \ No newline at end of file diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml index 04c32963cab2b..577a7ae607e59 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit.phtml @@ -57,7 +57,7 @@ require([ if (confirm('')){ if (useAjax){ tree.nodeForDelete = categoryId; - updateContent(url, {}, true); + updateContent(url, {}, true, true); } else { location.href = url; } @@ -67,14 +67,19 @@ require([ /** * Update category content area */ - function updateContent(url, params, refreshTree) { - var win = this; - var params = jQuery.extend(params || {}, { + function updateContent(url, params, refreshTree, deleteAction) { + var node = tree.getNodeById(tree.currentNodeId), + parentNode = node && node.parentNode, + parentId, + redirectUrl, + params; + + params = jQuery.extend(params || {}, { form_key: FORM_KEY }); - + if (params.node_name) { - this.tree.getNodeById(tree.currentNodeId).currentNode.setText(params.node_name); + node.setText(params.node_name); } (function($){ @@ -85,6 +90,16 @@ require([ context: $('body'), showLoader: true }).done(function(data){ + if (deleteAction && parentNode) { + parentId = parentNode.id; + + redirectUrl = !parentNode.isRoot ? + tree.buildUrl(parentId) : + tree.getBaseUrl(); + + location.href = redirectUrl; + } + if (data.content) { $('.page-actions').floatingHeader('destroy'); try { @@ -92,7 +107,7 @@ require([ tinyMCE.execCommand('mceRemoveControl', false, $(element).attr('id')); }); $categoryContainer.html(''); - } catch(e) { + } catch (e) { alert(e.message); } $categoryContainer.html(data.content).trigger('contentUpdated'); @@ -101,16 +116,19 @@ require([ tinyMCE.execCommand('mceRemoveControl', false, $(element).attr('id')); tinyMCE.execCommand('mceAddControl', true, $(element).attr('id')); }); - $('.page-actions').floatingHeader({ 'title': '.category-edit-title'}); + $('.page-actions').floatingHeader({ + 'title': '.category-edit-title' + }); try { if (refreshTree) { - win.refreshTreeArea(); + window.refreshTreeArea(); } } catch (e) { alert(e.message); }; }, 25); } + if (data.messages && data.messages.length > 0) { $('.messages').html(data.messages); } @@ -123,6 +141,9 @@ require([ */ function refreshTreeArea(transport) { + var config, + url; + if (tree && window.editingCategoryBreadcrumbs) { // category deleted - delete its node if (tree.nodeForDelete) { @@ -140,24 +161,9 @@ require([ tree.addNodeTo = false; if (parent) { // Check maybe tree became somehow not synced with ajax and we're trying to add to unknown node - var node = new Ext.tree.AsyncTreeNode(editingCategoryBreadcrumbs[editingCategoryBreadcrumbs.length - 1]); - node.loaded = true; - tree.currentNodeId = node.id; - parent.appendChild(node); - - if (parent.expanded) { - tree.selectCurrentNode(); - } else { - var timer; - parent.expand(); - var f = function(){ - if(parent.expanded){ // done expanding - clearInterval(timer); - tree.selectCurrentNode(); - } - }; - timer = setInterval(f, 200); - } + config = editingCategoryBreadcrumbs[editingCategoryBreadcrumbs.length - 1]; + + window.location.href = tree.buildUrl(config.id); } } diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml index 698ead9021ddc..fa2f9a280819e 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/edit/form.phtml @@ -21,6 +21,10 @@ * @copyright Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com) * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */ + +/** @var \Magento\Catalog\Block\Adminhtml\Category\Edit\Form $this */ +$parentId = $this->getParentCategoryId(); +$categoryId = $this->getCategoryId(); ?>

escapeHtml($this->getHeader()) . ($this->getCategoryId() ? ' (' . __('ID: %1', $this->getCategoryId()) . ')' : '') ?>

@@ -42,13 +46,19 @@ -
+ + + + + +
@@ -56,7 +66,7 @@
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml index 4a36c8ff9b0de..3286c15781286 100644 --- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml +++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit.phtml @@ -31,7 +31,7 @@
-