Skip to content

Commit

Permalink
Merge pull request #283 from magento-firedrakes/MAGETWO-34646
Browse files Browse the repository at this point in the history
[Firedrakes] MAGETWO-34646
  • Loading branch information
Logvin, Michael(mlogvin) committed May 12, 2015
2 parents 740c907 + cae77e1 commit 61b5c11
Show file tree
Hide file tree
Showing 41 changed files with 199 additions and 160 deletions.
42 changes: 26 additions & 16 deletions app/code/Magento/Catalog/Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Customer/Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
}

Expand All @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand All @@ -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);
}

/**
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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());
}

/**
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand All @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand All @@ -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());
}

/**
Expand All @@ -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);
}
}
3 changes: 1 addition & 2 deletions app/code/Magento/Quote/Model/Resource/Quote/QuoteIdMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
37 changes: 23 additions & 14 deletions app/code/Magento/Quote/Setup/InstallSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down Expand Up @@ -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',
Expand Down
Loading

0 comments on commit 61b5c11

Please sign in to comment.