diff --git a/app/code/Magento/Catalog/Setup/UpgradeSchema.php b/app/code/Magento/Catalog/Setup/UpgradeSchema.php index aeb5d7cd95a7d..a7e29ebe21e12 100644 --- a/app/code/Magento/Catalog/Setup/UpgradeSchema.php +++ b/app/code/Magento/Catalog/Setup/UpgradeSchema.php @@ -31,22 +31,32 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con 'FK_CAT_PRD_ENTT_ENTT_TYPE_ID_EAV_ENTT_TYPE_ENTT_TYPE_ID' ); - //Drop entity_type_id column for catalog product entities - $connection->dropColumn($installer->getTable('catalog_product_entity'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_product_entity_datetime'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_product_entity_decimal'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_product_entity_gallery'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_product_entity_int'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_product_entity_text'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_product_entity_varchar'), 'entity_type_id'); - - //Drop entity_type_id column for catalog category entities - $connection->dropColumn($installer->getTable('catalog_category_entity'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_category_entity_datetime'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_category_entity_decimal'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_category_entity_int'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_category_entity_text'), 'entity_type_id'); - $connection->dropColumn($installer->getTable('catalog_category_entity_varchar'), 'entity_type_id'); + $dropTablesColumn = [ + 'catalog_product_entity', + 'catalog_product_entity_datetime', + 'catalog_product_entity_decimal', + 'catalog_product_entity_gallery', + 'catalog_product_entity_int', + 'catalog_product_entity_text', + 'catalog_product_entity_varchar', + 'catalog_category_entity', + 'catalog_category_entity_datetime', + 'catalog_category_entity_decimal', + 'catalog_category_entity_int', + 'catalog_category_entity_text', + 'catalog_category_entity_varchar' + ]; + foreach ($dropTablesColumn as $table) { + $connection->dropIndex( + $installer->getTable($table), + $installer->getIdxName( + $table, + 'entity_type_id', + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX + ) + ); + $connection->dropColumn($installer->getTable($table), 'entity_type_id'); + } $installer->endSetup(); } diff --git a/app/code/Magento/Customer/Setup/UpgradeSchema.php b/app/code/Magento/Customer/Setup/UpgradeSchema.php index 2b7a160eb3de8..1094a6d1d3d4e 100644 --- a/app/code/Magento/Customer/Setup/UpgradeSchema.php +++ b/app/code/Magento/Customer/Setup/UpgradeSchema.php @@ -46,7 +46,7 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con $installer->getIdxName( $installer->getTable($table), ['entity_type_id'], - \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_UNIQUE + \Magento\Framework\DB\Adapter\AdapterInterface::INDEX_TYPE_INDEX ) ); $connection->dropColumn($installer->getTable($table), 'entity_type_id'); diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestBillingAddressManagement.php b/app/code/Magento/Quote/Model/GuestCart/GuestBillingAddressManagement.php index 61788f4920def..c77b12338e59f 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestBillingAddressManagement.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestBillingAddressManagement.php @@ -46,7 +46,7 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->billingAddressManagement->assign($quoteIdMask->getId(), $address); + return $this->billingAddressManagement->assign($quoteIdMask->getQuoteId(), $address); } /** @@ -56,6 +56,6 @@ public function get($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->billingAddressManagement->get($quoteIdMask->getId()); + return $this->billingAddressManagement->get($quoteIdMask->getQuoteId()); } } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestCartItemRepository.php b/app/code/Magento/Quote/Model/GuestCart/GuestCartItemRepository.php index a3750601070b8..c0519dbf6fcac 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestCartItemRepository.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestCartItemRepository.php @@ -47,7 +47,7 @@ public function getList($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - $cartItemList = $this->repository->getList($quoteIdMask->getId()); + $cartItemList = $this->repository->getList($quoteIdMask->getQuoteId()); /** @var $item CartItemInterface */ foreach ($cartItemList as $item) { $item->setQuoteId($quoteIdMask->getMaskedId()); @@ -62,7 +62,7 @@ public function save(\Magento\Quote\Api\Data\CartItemInterface $cartItem) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartItem->getQuoteId(), 'masked_id'); - $cartItem->setQuoteId($quoteIdMask->getId()); + $cartItem->setQuoteId($quoteIdMask->getQuoteId()); return $this->repository->save($cartItem); } @@ -73,6 +73,6 @@ public function deleteById($cartId, $itemId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->repository->deleteById($quoteIdMask->getId(), $itemId); + return $this->repository->deleteById($quoteIdMask->getQuoteId(), $itemId); } } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestCartManagement.php b/app/code/Magento/Quote/Model/GuestCart/GuestCartManagement.php index c62fab57f1bc5..7fe6ef0cfa982 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestCartManagement.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestCartManagement.php @@ -51,7 +51,7 @@ public function createEmptyCart() /** @var $quoteIdMask \Magento\Quote\Model\QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create(); $cartId = $this->quoteManagement->createEmptyCart(); - $quoteIdMask->setId($cartId)->save(); + $quoteIdMask->setQuoteId($cartId)->save(); return $quoteIdMask->getMaskedId(); } @@ -62,7 +62,7 @@ public function assignCustomer($cartId, $customerId, $storeId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->quoteManagement->assignCustomer($quoteIdMask->getId(), $customerId, $storeId); + return $this->quoteManagement->assignCustomer($quoteIdMask->getQuoteId(), $customerId, $storeId); } /** @@ -72,6 +72,6 @@ public function placeOrder($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->quoteManagement->placeOrder($quoteIdMask->getId()); + return $this->quoteManagement->placeOrder($quoteIdMask->getQuoteId()); } } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestCartRepository.php b/app/code/Magento/Quote/Model/GuestCart/GuestCartRepository.php index 577f2b2a76b03..55fb1ffee5686 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestCartRepository.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestCartRepository.php @@ -46,6 +46,6 @@ public function get($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->quoteRepository->get($quoteIdMask->getId()); + return $this->quoteRepository->get($quoteIdMask->getQuoteId()); } } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestCartTotalRepository.php b/app/code/Magento/Quote/Model/GuestCart/GuestCartTotalRepository.php index 1ab5f5eeb8c43..0f942804eb0c5 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestCartTotalRepository.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestCartTotalRepository.php @@ -47,6 +47,6 @@ public function get($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->cartTotalRepository->get($quoteIdMask->getId()); + return $this->cartTotalRepository->get($quoteIdMask->getQuoteId()); } } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestCouponManagement.php b/app/code/Magento/Quote/Model/GuestCart/GuestCouponManagement.php index 90b1047ee3c86..b5abd2ab507ba 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestCouponManagement.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestCouponManagement.php @@ -47,7 +47,7 @@ public function get($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->couponManagement->get($quoteIdMask->getId()); + return $this->couponManagement->get($quoteIdMask->getQuoteId()); } /** @@ -57,7 +57,7 @@ public function set($cartId, $couponCode) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->couponManagement->set($quoteIdMask->getId(), $couponCode); + return $this->couponManagement->set($quoteIdMask->getQuoteId(), $couponCode); } /** @@ -67,6 +67,6 @@ public function remove($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->couponManagement->remove($quoteIdMask->getId()); + return $this->couponManagement->remove($quoteIdMask->getQuoteId()); } } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestPaymentMethodManagement.php b/app/code/Magento/Quote/Model/GuestCart/GuestPaymentMethodManagement.php index b0b99599ef14d..cbfb9f167458f 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestPaymentMethodManagement.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestPaymentMethodManagement.php @@ -46,7 +46,7 @@ public function set($cartId, \Magento\Quote\Api\Data\PaymentInterface $method) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->paymentMethodManagement->set($quoteIdMask->getId(), $method); + return $this->paymentMethodManagement->set($quoteIdMask->getQuoteId(), $method); } /** @@ -56,7 +56,7 @@ public function get($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->paymentMethodManagement->get($quoteIdMask->getId()); + return $this->paymentMethodManagement->get($quoteIdMask->getQuoteId()); } /** @@ -66,6 +66,6 @@ public function getList($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->paymentMethodManagement->getList($quoteIdMask->getId()); + return $this->paymentMethodManagement->getList($quoteIdMask->getQuoteId()); } } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestShippingAddressManagement.php b/app/code/Magento/Quote/Model/GuestCart/GuestShippingAddressManagement.php index f2ce3fb46fcf9..789466d1e0421 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestShippingAddressManagement.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestShippingAddressManagement.php @@ -46,7 +46,7 @@ public function assign($cartId, \Magento\Quote\Api\Data\AddressInterface $addres { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->shippingAddressManagement->assign($quoteIdMask->getId(), $address); + return $this->shippingAddressManagement->assign($quoteIdMask->getQuoteId(), $address); } /** @@ -56,6 +56,6 @@ public function get($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->shippingAddressManagement->get($quoteIdMask->getId()); + return $this->shippingAddressManagement->get($quoteIdMask->getQuoteId()); } } diff --git a/app/code/Magento/Quote/Model/GuestCart/GuestShippingMethodManagement.php b/app/code/Magento/Quote/Model/GuestCart/GuestShippingMethodManagement.php index e847e1bd36051..0687ca395de86 100644 --- a/app/code/Magento/Quote/Model/GuestCart/GuestShippingMethodManagement.php +++ b/app/code/Magento/Quote/Model/GuestCart/GuestShippingMethodManagement.php @@ -47,7 +47,7 @@ public function get($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->shippingMethodManagement->get($quoteIdMask->getId()); + return $this->shippingMethodManagement->get($quoteIdMask->getQuoteId()); } /** @@ -57,7 +57,7 @@ public function getList($cartId) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->shippingMethodManagement->getList($quoteIdMask->getId()); + return $this->shippingMethodManagement->getList($quoteIdMask->getQuoteId()); } /** @@ -67,6 +67,6 @@ public function set($cartId, $carrierCode, $methodCode) { /** @var $quoteIdMask QuoteIdMask */ $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id'); - return $this->shippingMethodManagement->set($quoteIdMask->getId(), $carrierCode, $methodCode); + return $this->shippingMethodManagement->set($quoteIdMask->getQuoteId(), $carrierCode, $methodCode); } } diff --git a/app/code/Magento/Quote/Model/Resource/Quote/QuoteIdMask.php b/app/code/Magento/Quote/Model/Resource/Quote/QuoteIdMask.php index 8fa2507073a2e..2312a25be806a 100644 --- a/app/code/Magento/Quote/Model/Resource/Quote/QuoteIdMask.php +++ b/app/code/Magento/Quote/Model/Resource/Quote/QuoteIdMask.php @@ -20,7 +20,6 @@ class QuoteIdMask extends AbstractDb */ protected function _construct() { - $this->_init('quote_id_mask', 'quote_id'); - $this->_isPkAutoIncrement = false; + $this->_init('quote_id_mask', 'entity_id'); } } diff --git a/app/code/Magento/Quote/Setup/InstallSchema.php b/app/code/Magento/Quote/Setup/InstallSchema.php index 905cfba567826..80279e7c2aade 100644 --- a/app/code/Magento/Quote/Setup/InstallSchema.php +++ b/app/code/Magento/Quote/Setup/InstallSchema.php @@ -390,7 +390,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'address_type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 10, [], 'Address Type' )->addColumn( @@ -408,19 +408,19 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'firstname', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 20, [], 'Firstname' )->addColumn( 'middlename', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 40, + 20, [], 'Middlename' )->addColumn( 'lastname', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 20, [], 'Lastname' )->addColumn( @@ -438,19 +438,19 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'street', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 40, [], 'Street' )->addColumn( 'city', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 40, [], 'City' )->addColumn( 'region', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 40, [], 'Region' )->addColumn( @@ -462,25 +462,25 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'postcode', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 20, [], 'Postcode' )->addColumn( 'country_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 30, [], 'Country Id' )->addColumn( 'telephone', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 20, [], 'Phone Number' )->addColumn( 'fax', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 20, [], 'Fax' )->addColumn( @@ -498,7 +498,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'shipping_method', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 40, [], 'Shipping Method' )->addColumn( @@ -1540,14 +1540,23 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con */ $table = $installer->getConnection()->newTable( $installer->getTable('quote_id_mask') + )->addColumn( + 'entity_id', + \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, + null, + ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true], + 'Entity Id' )->addColumn( 'quote_id', \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER, null, - ['identity' => true, 'unsigned' => true, 'nullable' => false], + ['unsigned' => true, 'nullable' => false, 'primary' => true], 'Quote ID' + )->addIndex( + $installer->getIdxName('quote_id_mask', ['quote_id']), + ['quote_id'] )->addForeignKey( - 'quote_id', + $installer->getFkName('quote_id_mask', 'quote_id', 'quote', 'entity_id'), 'quote_id', $installer->getTable('quote'), 'entity_id', diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartManagementTest.php index 444aa62322a04..8cc66a238ca8f 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartManagementTest.php +++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartManagementTest.php @@ -56,7 +56,7 @@ protected function setUp() ); $this->quoteIdMaskMock = $this->getMock( 'Magento\Quote\Model\QuoteIdMask', - ['getId', 'getMaskedId', 'load', 'save', 'setId'], + ['getQuoteId', 'getMaskedId', 'load', 'save', 'setQuoteId'], [], '', false @@ -76,7 +76,7 @@ public function testCreateEmptyCart() $maskedCartId = 'masked1cart2id3'; $cartId = 1; - $this->quoteIdMaskMock->expects($this->once())->method('setId')->with($cartId)->willReturnSelf(); + $this->quoteIdMaskMock->expects($this->once())->method('setQuoteId')->with($cartId)->willReturnSelf(); $this->quoteIdMaskMock->expects($this->once())->method('save')->willReturnSelf(); $this->quoteIdMaskMock->expects($this->once())->method('getMaskedId')->willreturn($maskedCartId); $this->quoteIdMaskFactoryMock->expects($this->once())->method('create')->willReturn($this->quoteIdMaskMock); @@ -93,7 +93,7 @@ public function testAssignCustomer() $storeId = 1; $this->quoteIdMaskMock->expects($this->once())->method('load')->with($cartId, 'masked_id')->willReturnSelf(); - $this->quoteIdMaskMock->expects($this->once())->method('getId')->willReturn($maskedCartId); + $this->quoteIdMaskMock->expects($this->once())->method('getQuoteId')->willReturn($maskedCartId); $this->quoteIdMaskFactoryMock->expects($this->once())->method('create')->willReturn($this->quoteIdMaskMock); $this->quoteManagementMock->expects($this->once())->method('assignCustomer')->willReturn(true); @@ -107,7 +107,7 @@ public function testPlaceOrder() $orderId = 1; $this->quoteIdMaskMock->expects($this->once())->method('load')->with($cartId, 'masked_id')->willReturnSelf(); - $this->quoteIdMaskMock->expects($this->once())->method('getId')->willReturn($maskedCartId); + $this->quoteIdMaskMock->expects($this->once())->method('getQuoteId')->willReturn($maskedCartId); $this->quoteIdMaskFactoryMock->expects($this->once())->method('create')->willReturn($this->quoteIdMaskMock); $this->quoteManagementMock->expects($this->once())->method('placeOrder')->willReturn($orderId); diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTestHelper.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTestHelper.php index 25649077b5fd6..c8f6074a62778 100644 --- a/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTestHelper.php +++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCart/GuestCartTestHelper.php @@ -40,7 +40,7 @@ public function mockQuoteIdMask($maskedCartId, $cartId) { $quoteIdMaskMock = $this->testCase->getMock( 'Magento\Quote\Model\QuoteIdMask', - ['load', 'getId', 'getMaskedId'], + ['load', 'getQuoteId', 'getMaskedId'], [], '', false @@ -48,7 +48,7 @@ public function mockQuoteIdMask($maskedCartId, $cartId) $quoteIdMaskFactoryMock = $this->testCase->getMock('Magento\Quote\Model\QuoteIdMaskFactory', [], [], '', false); $quoteIdMaskFactoryMock->expects($this->testCase->once())->method('create')->willReturn($quoteIdMaskMock); $quoteIdMaskMock->expects($this->testCase->once())->method('load')->with($maskedCartId)->willReturnSelf(); - $quoteIdMaskMock->expects($this->testCase->once())->method('getId')->willReturn($cartId); + $quoteIdMaskMock->expects($this->testCase->once())->method('getQuoteId')->willReturn($cartId); return [$quoteIdMaskFactoryMock, $quoteIdMaskMock]; } } diff --git a/app/code/Magento/Sales/Setup/InstallSchema.php b/app/code/Magento/Sales/Setup/InstallSchema.php index 93192e49bb663..21014f444dcc2 100644 --- a/app/code/Magento/Sales/Setup/InstallSchema.php +++ b/app/code/Magento/Sales/Setup/InstallSchema.php @@ -584,13 +584,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'increment_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, + 32, [], 'Increment Id' )->addColumn( 'applied_rule_ids', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Applied Rule Ids' )->addColumn( @@ -602,43 +602,43 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'customer_email', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Customer Email' )->addColumn( 'customer_firstname', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Customer Firstname' )->addColumn( 'customer_lastname', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Customer Lastname' )->addColumn( 'customer_middlename', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Customer Middlename' )->addColumn( 'customer_prefix', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Customer Prefix' )->addColumn( 'customer_suffix', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Customer Suffix' )->addColumn( 'customer_taxvat', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Customer Taxvat' )->addColumn( @@ -650,13 +650,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'ext_customer_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Ext Customer Id' )->addColumn( 'ext_order_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Ext Order Id' )->addColumn( @@ -668,25 +668,25 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'hold_before_state', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Hold Before State' )->addColumn( 'hold_before_status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Hold Before Status' )->addColumn( 'order_currency_code', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 3, [], 'Order Currency Code' )->addColumn( 'original_increment_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 50, + 32, [], 'Original Increment Id' )->addColumn( @@ -716,13 +716,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'remote_ip', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Remote Ip' )->addColumn( 'shipping_method', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Shipping Method' )->addColumn( @@ -734,13 +734,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'store_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Store Name' )->addColumn( 'x_forwarded_for', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'X Forwarded For' )->addColumn( @@ -1845,79 +1845,79 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'cc_exp_month', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 12, [], 'Cc Exp Month' )->addColumn( 'cc_ss_start_year', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 12, [], 'Cc Ss Start Year' )->addColumn( 'echeck_bank_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Echeck Bank Name' )->addColumn( 'method', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Method' )->addColumn( 'cc_debug_request_body', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Debug Request Body' )->addColumn( 'cc_secure_verify', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Secure Verify' )->addColumn( 'protection_eligibility', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Protection Eligibility' )->addColumn( 'cc_approval', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Approval' )->addColumn( 'cc_last_4', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 4, [], 'Cc Last 4' )->addColumn( 'cc_status_description', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Status Description' )->addColumn( 'echeck_type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Echeck Type' )->addColumn( 'cc_debug_response_serialized', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Debug Response Serialized' )->addColumn( 'cc_ss_start_month', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Cc Ss Start Month' )->addColumn( @@ -1929,103 +1929,103 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con )->addColumn( 'last_trans_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Last Trans Id' )->addColumn( 'cc_cid_status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Cid Status' )->addColumn( 'cc_owner', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 128, [], 'Cc Owner' )->addColumn( 'cc_type', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Type' )->addColumn( 'po_number', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Po Number' )->addColumn( 'cc_exp_year', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 4, ['nullable' => true, 'default' => null], 'Cc Exp Year' )->addColumn( 'cc_status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 4, [], 'Cc Status' )->addColumn( 'echeck_routing_number', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Echeck Routing Number' )->addColumn( 'account_status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Account Status' )->addColumn( 'anet_trans_method', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Anet Trans Method' )->addColumn( 'cc_debug_response_body', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Debug Response Body' )->addColumn( 'cc_ss_issue', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Ss Issue' )->addColumn( 'echeck_account_name', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Echeck Account Name' )->addColumn( 'cc_avs_status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Avs Status' )->addColumn( 'cc_number_enc', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Number Enc' )->addColumn( 'cc_trans_id', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Cc Trans Id' )->addColumn( 'address_status', \Magento\Framework\DB\Ddl\Table::TYPE_TEXT, - 255, + 32, [], 'Address Status' )->addColumn( diff --git a/app/code/Magento/SalesRule/Setup/InstallSchema.php b/app/code/Magento/SalesRule/Setup/InstallSchema.php index 0e319cccfc9fb..babe9d02c969b 100644 --- a/app/code/Magento/SalesRule/Setup/InstallSchema.php +++ b/app/code/Magento/SalesRule/Setup/InstallSchema.php @@ -732,7 +732,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con 'rule_id', \Magento\Framework\DB\Ddl\Table::ACTION_CASCADE )->addForeignKey( - $installer->getFkName('salesrule_website', 'website_id', 'core/website', 'website_id'), + $installer->getFkName('salesrule_website', 'website_id', 'store_website', 'website_id'), 'website_id', $websitesTable, 'website_id', diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestBillingAddressManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestBillingAddressManagementTest.php index 97838fe9f2639..58e551fe3cb5f 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestBillingAddressManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestBillingAddressManagementTest.php @@ -29,7 +29,7 @@ protected function getQuoteMaskedId($quoteId) { /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMaskFactory')->create(); - $quoteIdMask->load($quoteId); + $quoteIdMask->load($quoteId, 'quote_id'); return $quoteIdMask->getMaskedId(); } diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartItemRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartItemRepositoryTest.php index 7287cd3020082..e36284a6f9803 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartItemRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartItemRepositoryTest.php @@ -38,7 +38,7 @@ public function testGetList() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -93,7 +93,7 @@ public function testAddItem() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -135,7 +135,7 @@ public function testRemoveItem() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -179,7 +179,7 @@ public function testUpdateItem() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php index 9058a930b196d..8cde626d6b222 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartManagementTest.php @@ -55,7 +55,8 @@ public function tearDown() $quote->delete(); /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMask'); - $quoteIdMask->delete($quote->getId()); + $quoteIdMask->load($quoteId, 'quote_id'); + $quoteIdMask->delete(); } } @@ -72,7 +73,7 @@ public function testAssignCustomer() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -187,7 +188,7 @@ public function testAssignCustomerThrowsExceptionIfTargetCartIsNotAnonymous() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -232,7 +233,7 @@ public function testAssignCustomerThrowsExceptionIfCartIsAssignedToDifferentStor $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -280,7 +281,7 @@ public function testAssignCustomerThrowsExceptionIfCustomerAlreadyHasActiveCart( $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -318,7 +319,7 @@ public function testPlaceOrder() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartRepositoryTest.php index b3c8e3f024e70..4aa7276f30fd9 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartRepositoryTest.php @@ -24,10 +24,12 @@ protected function tearDown() { try { $cart = $this->getCart('test01'); + $cartId = $cart->getId(); $cart->delete(); /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMask'); - $quoteIdMask->delete($cart->getId()); + $quoteIdMask->load($cartId, 'quote_id'); + $quoteIdMask->delete(); } catch (\InvalidArgumentException $e) { // Do nothing if cart fixture was not used } @@ -64,8 +66,7 @@ public function testGetCart() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); - + $quoteIdMask->load($cartId, 'quote_id'); $serviceInfo = [ 'rest' => [ diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartTotalRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartTotalRepositoryTest.php index 87cbbbdaaf40e..1ecbfbc80e108 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartTotalRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCartTotalRepositoryTest.php @@ -45,7 +45,7 @@ protected function getQuoteMaskedId($quoteId) { /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMaskFactory')->create(); - $quoteIdMask->load($quoteId); + $quoteIdMask->load($quoteId, 'quote_id'); return $quoteIdMask->getMaskedId(); } diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCouponManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCouponManagementTest.php index 296d5d60767fb..5494621c3612e 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCouponManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestCouponManagementTest.php @@ -35,7 +35,8 @@ public function tearDown() $quote->delete(); /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMask'); - $quoteIdMask->delete($quote->getId()); + $quoteIdMask->load($quoteId, 'quote_id'); + $quoteIdMask->delete(); } } @@ -43,7 +44,7 @@ protected function getQuoteMaskedId($quoteId) { /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMaskFactory')->create(); - $quoteIdMask->load($quoteId); + $quoteIdMask->load($quoteId, 'quote_id'); return $quoteIdMask->getMaskedId(); } diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php index 40579922f1896..08fbceccca487 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestPaymentMethodManagementTest.php @@ -48,7 +48,8 @@ protected function deleteCart($reservedOrderId) $cart->delete(); /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMask'); - $quoteIdMask->delete($cart->getId()); + $quoteIdMask->load($cart->getId(), 'quote_id'); + $quoteIdMask->delete(); } catch (\InvalidArgumentException $e) { // Do nothing if cart fixture was not used } @@ -327,7 +328,7 @@ protected function getMaskedCartId($cartId) $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); return $quoteIdMask->getMaskedId(); } } diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShippingAddressManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShippingAddressManagementTest.php index a1c22bf0ee869..3a4dd1be8bcdf 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShippingAddressManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShippingAddressManagementTest.php @@ -35,7 +35,8 @@ public function tearDown() $quote->delete(); /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMask'); - $quoteIdMask->delete($quote->getId()); + $quoteIdMask->load($quote->getId(), 'quote_id'); + $quoteIdMask->delete(); } } @@ -43,7 +44,7 @@ protected function getQuoteMaskedId($quoteId) { /** @var \Magento\Quote\Model\QuoteIdMask $quoteIdMask */ $quoteIdMask = $this->objectManager->create('Magento\Quote\Model\QuoteIdMaskFactory')->create(); - $quoteIdMask->load($quoteId); + $quoteIdMask->load($quoteId, 'quote_id'); return $quoteIdMask->getMaskedId(); } diff --git a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShippingMethodManagementTest.php b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShippingMethodManagementTest.php index 54b8938765164..8e985047cef20 100644 --- a/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShippingMethodManagementTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Quote/Api/GuestShippingMethodManagementTest.php @@ -59,7 +59,7 @@ public function testSetMethod() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -88,7 +88,7 @@ public function testSetMethodWrongMethod() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -125,7 +125,7 @@ public function testSetMethodWithoutShippingAddress() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -158,7 +158,7 @@ public function testGetMethod() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -191,7 +191,7 @@ public function testGetMethodOfVirtualCart() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -211,7 +211,7 @@ public function testGetMethodOfCartWithNoShippingMethod() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -232,7 +232,7 @@ public function testGetListForVirtualCart() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); @@ -256,7 +256,7 @@ public function testGetList() $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); - $quoteIdMask->load($cartId); + $quoteIdMask->load($cartId, 'quote_id'); //Use masked cart Id $cartId = $quoteIdMask->getMaskedId(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_address_saved.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_address_saved.php index c06216ed07d89..267e38853906f 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_address_saved.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_address_saved.php @@ -17,6 +17,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_check_payment.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_check_payment.php index 1f0a0a45197c7..ff88678dd1821 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_check_payment.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_check_payment.php @@ -24,6 +24,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved.php index dcf8ab45afc98..1b8404842f90c 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_items_saved.php @@ -47,6 +47,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_payment_saved.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_payment_saved.php index e15c08b356f56..c3c8d441378a9 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_payment_saved.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_payment_saved.php @@ -30,6 +30,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product_saved.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product_saved.php index e917e5c33e8dd..d34bf53dde111 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product_saved.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_simple_product_saved.php @@ -31,6 +31,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_and_address.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_and_address.php index 56ae6b1a7643b..4039d180db5c4 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_and_address.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_and_address.php @@ -57,6 +57,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_saved.php b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_saved.php index 1d19150c3a3a5..f75dce4306e20 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_saved.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/_files/quote_with_virtual_product_saved.php @@ -24,6 +24,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php index 2fb7467a1c15b..a991634bdf856 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote.php @@ -70,6 +70,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer.php b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer.php index 40e14157ff895..f5f5360013552 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/quote_with_customer.php @@ -20,6 +20,6 @@ $quoteIdMask = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() ->create('Magento\Quote\Model\QuoteIdMaskFactory') ->create(); -$quoteIdMask->setId($quote->getId()); +$quoteIdMask->setQuoteId($quote->getId()); $quoteIdMask->setDataChanges(true); $quoteIdMask->save(); diff --git a/lib/internal/Magento/Framework/Config/ConfigGenerator.php b/lib/internal/Magento/Framework/Config/ConfigGenerator.php index c7f4ac934ae47..0b53e4f8aac30 100644 --- a/lib/internal/Magento/Framework/Config/ConfigGenerator.php +++ b/lib/internal/Magento/Framework/Config/ConfigGenerator.php @@ -25,9 +25,10 @@ class ConfigGenerator ConfigOptionsList::INPUT_KEY_DB_HOST => ConfigOptionsList::KEY_HOST, ConfigOptionsList::INPUT_KEY_DB_NAME => ConfigOptionsList::KEY_NAME, ConfigOptionsList::INPUT_KEY_DB_USER => ConfigOptionsList::KEY_USER, - ConfigOptionsList::INPUT_KEY_DB_PASSWORD => ConfigOptionsList::KEY_PASSWORD, + ConfigOptionsList::INPUT_KEY_DB_PASSWORD => ConfigOptionsList::KEY_PASS, ConfigOptionsList::INPUT_KEY_DB_PREFIX => ConfigOptionsList::KEY_PREFIX, ConfigOptionsList::INPUT_KEY_DB_MODEL => ConfigOptionsList::KEY_MODEL, + ConfigOptionsList::INPUT_KEY_DB_ENGINE => ConfigOptionsList::KEY_ENGINE, ConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS => ConfigOptionsList::KEY_INIT_STATEMENTS, ConfigOptionsList::INPUT_KEY_ENCRYPTION_KEY => ConfigOptionsList::KEY_ENCRYPTION_KEY, ConfigOptionsList::INPUT_KEY_SESSION_SAVE => ConfigOptionsList::KEY_SAVE, @@ -154,6 +155,7 @@ public function createDbConfig(array $data) ConfigOptionsList::INPUT_KEY_DB_USER, ConfigOptionsList::INPUT_KEY_DB_PASSWORD, ConfigOptionsList::INPUT_KEY_DB_MODEL, + ConfigOptionsList::INPUT_KEY_DB_ENGINE, ConfigOptionsList::INPUT_KEY_DB_INIT_STATEMENTS, ]; diff --git a/lib/internal/Magento/Framework/Config/ConfigOptionsList.php b/lib/internal/Magento/Framework/Config/ConfigOptionsList.php index ac1a90652f40c..5ed04b1bc6023 100644 --- a/lib/internal/Magento/Framework/Config/ConfigOptionsList.php +++ b/lib/internal/Magento/Framework/Config/ConfigOptionsList.php @@ -41,6 +41,7 @@ class ConfigOptionsList implements ConfigOptionsListInterface const INPUT_KEY_DB_PREFIX = 'db_prefix'; const INPUT_KEY_DB_MODEL = 'db_model'; const INPUT_KEY_DB_INIT_STATEMENTS = 'db_init_statements'; + const INPUT_KEY_DB_ENGINE = 'db_engine'; const INPUT_KEY_RESOURCE = 'resource'; /**#@-*/ @@ -62,7 +63,8 @@ class ConfigOptionsList implements ConfigOptionsListInterface const KEY_HOST = 'host'; const KEY_NAME = 'dbname'; const KEY_USER = 'username'; - const KEY_PASSWORD = 'password'; + const KEY_PASS = 'password'; + const KEY_ENGINE = 'engine'; const KEY_PREFIX = 'table_prefix'; const KEY_MODEL = 'model'; const KEY_INIT_STATEMENTS = 'initStatements'; @@ -154,10 +156,17 @@ public function getOptions() 'Database server username', 'root' ), + new TextConfigOption( + self::INPUT_KEY_DB_ENGINE, + TextConfigOption::FRONTEND_WIZARD_TEXT, + self::CONFIG_PATH_DB_CONNECTION_DEFAULT . self::KEY_ENGINE, + 'Database server engine', + 'innodb' + ), new TextConfigOption( self::INPUT_KEY_DB_PASSWORD, TextConfigOption::FRONTEND_WIZARD_PASSWORD, - self::CONFIG_PATH_DB_CONNECTION_DEFAULT . self::KEY_PASSWORD, + self::CONFIG_PATH_DB_CONNECTION_DEFAULT . self::KEY_PASS, 'Database server password', '' ), diff --git a/lib/internal/Magento/Framework/Config/Test/Unit/ConfigOptionsListTest.php b/lib/internal/Magento/Framework/Config/Test/Unit/ConfigOptionsListTest.php index cbc4a0cf75ab7..3992e2bbdea90 100644 --- a/lib/internal/Magento/Framework/Config/Test/Unit/ConfigOptionsListTest.php +++ b/lib/internal/Magento/Framework/Config/Test/Unit/ConfigOptionsListTest.php @@ -48,14 +48,16 @@ public function testGetOptions() $this->assertInstanceOf('Magento\Framework\Setup\Option\TextConfigOption', $options[5]); $this->assertSame('Database server username', $options[5]->getDescription()); $this->assertInstanceOf('Magento\Framework\Setup\Option\TextConfigOption', $options[6]); - $this->assertSame('Database server password', $options[6]->getDescription()); + $this->assertSame('Database server engine', $options[6]->getDescription()); $this->assertInstanceOf('Magento\Framework\Setup\Option\TextConfigOption', $options[7]); - $this->assertSame('Database table prefix', $options[7]->getDescription()); + $this->assertSame('Database server password', $options[7]->getDescription()); $this->assertInstanceOf('Magento\Framework\Setup\Option\TextConfigOption', $options[8]); - $this->assertSame('Database type', $options[8]->getDescription()); + $this->assertSame('Database table prefix', $options[8]->getDescription()); $this->assertInstanceOf('Magento\Framework\Setup\Option\TextConfigOption', $options[9]); - $this->assertSame('Database initial set of commands', $options[9]->getDescription()); - $this->assertEquals(10, count($options)); + $this->assertSame('Database type', $options[9]->getDescription()); + $this->assertInstanceOf('Magento\Framework\Setup\Option\TextConfigOption', $options[10]); + $this->assertSame('Database initial set of commands', $options[10]->getDescription()); + $this->assertEquals(11, count($options)); } public function testCreateOptions() diff --git a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php index b4b07cd12e814..932d824cdeec7 100644 --- a/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php +++ b/lib/internal/Magento/Framework/DB/Adapter/Pdo/Mysql.php @@ -1086,7 +1086,7 @@ public function getForeignKeys($tableName, $schemaName = null) $createSql = $this->getCreateTable($tableName, $schemaName); // collect CONSTRAINT - $regExp = '#,\s+CONSTRAINT `([^`]*)` FOREIGN KEY \(`([^`]*)`\) ' + $regExp = '#,\s+CONSTRAINT `([^`]*)` FOREIGN KEY ?\(`([^`]*)`\) ' . 'REFERENCES (`([^`]*)`\.)?`([^`]*)` \(`([^`]*)`\)' . '( ON DELETE (RESTRICT|CASCADE|SET NULL|NO ACTION))?' . '( ON UPDATE (RESTRICT|CASCADE|SET NULL|NO ACTION))?#'; @@ -1935,6 +1935,9 @@ public function newTable($tableName = null, $schemaName = null) if ($schemaName !== null) { $table->setSchema($schemaName); } + if (isset($this->_config['engine'])) { + $table->setOption('type', $this->_config['engine']); + } return $table; } @@ -1962,7 +1965,7 @@ public function createTable(Table $table) ); $tableOptions = $this->_getOptionsDefinition($table); $sql = sprintf( - "CREATE TABLE %s (\n%s\n) %s", + "CREATE TABLE IF NOT EXISTS %s (\n%s\n) %s", $this->quoteIdentifier($table->getName()), implode(",\n", $sqlFragment), implode(" ", $tableOptions) diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php index 414ef89f37a61..35f3a6fed1489 100644 --- a/setup/src/Magento/Setup/Model/Installer.php +++ b/setup/src/Magento/Setup/Model/Installer.php @@ -1102,7 +1102,7 @@ private function assertDbAccessible() $connectionConfig[ConfigOptionsList::KEY_NAME], $connectionConfig[ConfigOptionsList::KEY_HOST], $connectionConfig[ConfigOptionsList::KEY_USER], - $connectionConfig[ConfigOptionsList::KEY_PASSWORD] + $connectionConfig[ConfigOptionsList::KEY_PASS] ); if (isset($connectionConfig[ConfigOptionsList::KEY_PREFIX])) { $this->checkDatabaseTablePrefix($connectionConfig[ConfigOptionsList::KEY_PREFIX]); diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php index e3e44ebd20a3b..de43acfede727 100644 --- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php @@ -122,7 +122,7 @@ class InstallerTest extends \PHPUnit_Framework_TestCase SetupConfigOptionsList::KEY_HOST => '127.0.0.1', SetupConfigOptionsList::KEY_NAME => 'magento', SetupConfigOptionsList::KEY_USER => 'magento', - SetupConfigOptionsList::KEY_PASSWORD => '', + SetupConfigOptionsList::KEY_PASS => '', ], ], ];