Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - magento#21550: [Backport] Fixed curl adapter to properly set http version based on $http_ver argument (by @davidalger)
 - magento#22447: [Backport] Corrected the translation for comment tag (by @yogeshsuhagiya)
 - magento#22559: Fix MySQL syntax error on indexation with certain attribute codes (by @Beagon)
 - magento#22549: [Backport] Fix magento#12802 - allow to override preference over CartInterface and return correct object from QuoteRepository (by @Bartlomiejsz)


Fixed GitHub Issues:
 - magento#12802: QuoteRepository get methods won't return CartInterface but Quote model (reported by @msieprawski) has been fixed in magento#22549 by @Bartlomiejsz in 2.2-develop branch
   Related commits:
     1. 2a148f6
     2. ac0e933
  • Loading branch information
sidolov authored May 7, 2019
2 parents f8c9b03 + 4aa0461 commit d184fce
Show file tree
Hide file tree
Showing 20 changed files with 344 additions and 2,655 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

/**
* Class FlatTableBuilder
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class FlatTableBuilder
Expand Down Expand Up @@ -354,6 +355,7 @@ protected function _updateTemporaryTableByStoreValues(
//Update not simple attributes (eg. dropdown)
$columnName = $attributeCode . $valueFieldSuffix;
if (isset($flatColumns[$columnName])) {
$columnValue = $this->_connection->getIfNullSql('ts.value', 't0.value');
$select = $this->_connection->select();
$select->joinLeft(
['t0' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')],
Expand All @@ -364,8 +366,8 @@ protected function _updateTemporaryTableByStoreValues(
'ts.option_id = et.' . $attributeCode . ' AND ts.store_id = ' . $storeId,
[]
)->columns(
[$columnName => $this->_connection->getIfNullSql('ts.value', 't0.value')]
)->where($attributeCode . ' IS NOT NULL');
[$columnName => $columnValue]
)->where($columnValue . ' IS NOT NULL');
if (!empty($changedIds)) {
$select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds));
}
Expand All @@ -389,7 +391,7 @@ protected function _getTemporaryTableName($tableName)
}

/**
* Get MetadataPool
* Get metadata pool
*
* @return \Magento\Framework\EntityManager\MetadataPool
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
<group id="paypal_payflowpro_with_express_checkout" translate="label comment" extends="payment_all_paypal/paypal_payflowpro">
<group id="paypal_payflowpro_with_express_checkout" translate="label" extends="payment_all_paypal/paypal_payflowpro">
<label>Payflow Pro</label>
<attribute type="paypal_ec_separate">0</attribute>
<group id="paypal_payflow_required" translate="label" showInDefault="1" showInWebsite="1" sortOrder="10">
Expand All @@ -30,11 +30,11 @@
<field id="enable_paypal_payflow"/>
</requires>
</field>
<field id="enable_express_checkout_bml_payflow" translate="label" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
<field id="enable_express_checkout_bml_payflow" translate="label comment" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
<label>Enable PayPal Credit</label>
<comment><![CDATA[PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
<a href="https:/www.paypal.com/webapps/mpp/promotional-financing" target="_blank">Learn More</a>]]>
<a href="https://www.paypal.com/webapps/mpp/promotional-financing" target="_blank">Learn More</a>]]>
</comment>
<config_path>payment/payflow_express_bml/active</config_path>
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
Expand Down
5 changes: 5 additions & 0 deletions app/code/Magento/Paypal/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -697,3 +697,8 @@ User,User
The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
or more. <a href=""https:/financing.paypal.com/ppfinportal/content/forrester"" target=""_blank"">See Details</a>.
"
"PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>","PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>"
90 changes: 54 additions & 36 deletions app/code/Magento/Quote/Model/QuoteRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Quote\Model;

use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Framework\Api\SearchCriteria\CollectionProcessor;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Api\SortOrder;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Api\Data\CartInterface;
use Magento\Quote\Model\Quote;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Framework\Api\Search\FilterGroup;
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
use Magento\Quote\Api\Data\CartInterfaceFactory;
use Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory;
use Magento\Quote\Model\QuoteRepository\SaveHandler;
use Magento\Quote\Model\QuoteRepository\LoadHandler;
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
use Magento\Store\Model\StoreManagerInterface;

/**
* Quote repository.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
class QuoteRepository implements CartRepositoryInterface
{
/**
* @var Quote[]
Expand All @@ -37,6 +43,7 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface

/**
* @var QuoteFactory
* @deprecated
*/
protected $quoteFactory;

Expand All @@ -46,13 +53,13 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
protected $storeManager;

/**
* @var \Magento\Quote\Model\ResourceModel\Quote\Collection
* @var QuoteCollection
* @deprecated 100.2.0
*/
protected $quoteCollection;

/**
* @var \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory
* @var CartSearchResultsInterfaceFactory
*/
protected $searchResultsDataFactory;

Expand All @@ -77,43 +84,51 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
private $collectionProcessor;

/**
* @var \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory
* @var QuoteCollectionFactory
*/
private $quoteCollectionFactory;

/**
* @var CartInterfaceFactory
*/
private $cartFactory;

/**
* Constructor
*
* @param QuoteFactory $quoteFactory
* @param StoreManagerInterface $storeManager
* @param \Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection
* @param \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory
* @param QuoteCollection $quoteCollection
* @param CartSearchResultsInterfaceFactory $searchResultsDataFactory
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
* @param CollectionProcessorInterface|null $collectionProcessor
* @param \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory|null $quoteCollectionFactory
* @param QuoteCollectionFactory|null $quoteCollectionFactory
* @param CartInterfaceFactory|null $cartFactory
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function __construct(
QuoteFactory $quoteFactory,
StoreManagerInterface $storeManager,
\Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection,
\Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory,
QuoteCollection $quoteCollection,
CartSearchResultsInterfaceFactory $searchResultsDataFactory,
JoinProcessorInterface $extensionAttributesJoinProcessor,
CollectionProcessorInterface $collectionProcessor = null,
\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory $quoteCollectionFactory = null
QuoteCollectionFactory $quoteCollectionFactory = null,
CartInterfaceFactory $cartFactory = null
) {
$this->quoteFactory = $quoteFactory;
$this->storeManager = $storeManager;
$this->searchResultsDataFactory = $searchResultsDataFactory;
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
$this->collectionProcessor = $collectionProcessor ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Framework\Api\SearchCriteria\CollectionProcessor::class);
$this->quoteCollectionFactory = $quoteCollectionFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
->get(\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory::class);
$this->collectionProcessor = $collectionProcessor ?: ObjectManager::getInstance()
->get(CollectionProcessor::class);
$this->quoteCollectionFactory = $quoteCollectionFactory ?: ObjectManager::getInstance()
->get(QuoteCollectionFactory::class);
$this->cartFactory = $cartFactory ?: ObjectManager::getInstance()->get(CartInterfaceFactory::class);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function get($cartId, array $sharedStoreIds = [])
{
Expand All @@ -126,7 +141,7 @@ public function get($cartId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getForCustomer($customerId, array $sharedStoreIds = [])
{
Expand All @@ -140,7 +155,7 @@ public function getForCustomer($customerId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getActive($cartId, array $sharedStoreIds = [])
{
Expand All @@ -152,7 +167,7 @@ public function getActive($cartId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
{
Expand All @@ -164,9 +179,9 @@ public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function save(\Magento\Quote\Api\Data\CartInterface $quote)
public function save(CartInterface $quote)
{
if ($quote->getId()) {
$currentQuote = $this->get($quote->getId(), [$quote->getStoreId()]);
Expand All @@ -184,9 +199,9 @@ public function save(\Magento\Quote\Api\Data\CartInterface $quote)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
public function delete(CartInterface $quote)
{
$quoteId = $quote->getId();
$customerId = $quote->getCustomerId();
Expand All @@ -203,13 +218,13 @@ public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
* @param int $identifier
* @param int[] $sharedStoreIds
* @throws NoSuchEntityException
* @return Quote
* @return CartInterface
*/
protected function loadQuote($loadMethod, $loadField, $identifier, array $sharedStoreIds = [])
{
/** @var Quote $quote */
$quote = $this->quoteFactory->create();
if ($sharedStoreIds) {
/** @var CartInterface $quote */
$quote = $this->cartFactory->create();
if ($sharedStoreIds && method_exists($quote, 'setSharedStoreIds')) {
$quote->setSharedStoreIds($sharedStoreIds);
}
$quote->setStoreId($this->storeManager->getStore()->getId())->$loadMethod($identifier);
Expand All @@ -220,9 +235,9 @@ protected function loadQuote($loadMethod, $loadField, $identifier, array $shared
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
public function getList(SearchCriteriaInterface $searchCriteria)
{
$this->quoteCollection = $this->quoteCollectionFactory->create();
/** @var \Magento\Quote\Api\Data\CartSearchResultsInterface $searchData */
Expand Down Expand Up @@ -265,6 +280,7 @@ protected function addFilterGroupToCollection(FilterGroup $filterGroup, QuoteCol

/**
* Get new SaveHandler dependency for application code.
*
* @return SaveHandler
* @deprecated 100.1.0
*/
Expand All @@ -277,6 +293,8 @@ private function getSaveHandler()
}

/**
* Get load handler instance.
*
* @return LoadHandler
* @deprecated 100.1.0
*/
Expand Down
Loading

0 comments on commit d184fce

Please sign in to comment.