Skip to content

Commit d184fce

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #21550: [Backport] Fixed curl adapter to properly set http version based on $http_ver argument (by @davidalger) - #22447: [Backport] Corrected the translation for comment tag (by @yogeshsuhagiya) - #22559: Fix MySQL syntax error on indexation with certain attribute codes (by @Beagon) - #22549: [Backport] Fix #12802 - allow to override preference over CartInterface and return correct object from QuoteRepository (by @Bartlomiejsz) Fixed GitHub Issues: - #12802: QuoteRepository get methods won't return CartInterface but Quote model (reported by @msieprawski) has been fixed in #22549 by @Bartlomiejsz in 2.2-develop branch Related commits: 1. 2a148f6 2. ac0e933
2 parents f8c9b03 + 4aa0461 commit d184fce

File tree

20 files changed

+344
-2655
lines changed

20 files changed

+344
-2655
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
/**
1313
* Class FlatTableBuilder
14+
*
1415
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1516
*/
1617
class FlatTableBuilder
@@ -354,6 +355,7 @@ protected function _updateTemporaryTableByStoreValues(
354355
//Update not simple attributes (eg. dropdown)
355356
$columnName = $attributeCode . $valueFieldSuffix;
356357
if (isset($flatColumns[$columnName])) {
358+
$columnValue = $this->_connection->getIfNullSql('ts.value', 't0.value');
357359
$select = $this->_connection->select();
358360
$select->joinLeft(
359361
['t0' => $this->_productIndexerHelper->getTable('eav_attribute_option_value')],
@@ -364,8 +366,8 @@ protected function _updateTemporaryTableByStoreValues(
364366
'ts.option_id = et.' . $attributeCode . ' AND ts.store_id = ' . $storeId,
365367
[]
366368
)->columns(
367-
[$columnName => $this->_connection->getIfNullSql('ts.value', 't0.value')]
368-
)->where($attributeCode . ' IS NOT NULL');
369+
[$columnName => $columnValue]
370+
)->where($columnValue . ' IS NOT NULL');
369371
if (!empty($changedIds)) {
370372
$select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds));
371373
}
@@ -389,7 +391,7 @@ protected function _getTemporaryTableName($tableName)
389391
}
390392

391393
/**
392-
* Get MetadataPool
394+
* Get metadata pool
393395
*
394396
* @return \Magento\Framework\EntityManager\MetadataPool
395397
*/

app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro_with_express_checkout.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
9-
<group id="paypal_payflowpro_with_express_checkout" translate="label comment" extends="payment_all_paypal/paypal_payflowpro">
9+
<group id="paypal_payflowpro_with_express_checkout" translate="label" extends="payment_all_paypal/paypal_payflowpro">
1010
<label>Payflow Pro</label>
1111
<attribute type="paypal_ec_separate">0</attribute>
1212
<group id="paypal_payflow_required" translate="label" showInDefault="1" showInWebsite="1" sortOrder="10">
@@ -30,11 +30,11 @@
3030
<field id="enable_paypal_payflow"/>
3131
</requires>
3232
</field>
33-
<field id="enable_express_checkout_bml_payflow" translate="label" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
33+
<field id="enable_express_checkout_bml_payflow" translate="label comment" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
3434
<label>Enable PayPal Credit</label>
3535
<comment><![CDATA[PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
3636
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;.
37-
<a href="https:/www.paypal.com/webapps/mpp/promotional-financing" target="_blank">Learn More</a>]]>
37+
<a href="https://www.paypal.com/webapps/mpp/promotional-financing" target="_blank">Learn More</a>]]>
3838
</comment>
3939
<config_path>payment/payflow_express_bml/active</config_path>
4040
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>

app/code/Magento/Paypal/i18n/en_US.csv

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,3 +697,8 @@ User,User
697697
The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
698698
or more. <a href=""https:/financing.paypal.com/ppfinportal/content/forrester"" target=""_blank"">See Details</a>.
699699
"
700+
"PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
701+
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;.
702+
<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.
703+
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;.
704+
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>"

app/code/Magento/Quote/Model/QuoteRepository.php

Lines changed: 54 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,33 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Quote\Model;
78

9+
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
10+
use Magento\Framework\Api\Search\FilterGroup;
11+
use Magento\Framework\Api\SearchCriteria\CollectionProcessor;
812
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
13+
use Magento\Framework\Api\SearchCriteriaInterface;
914
use Magento\Framework\App\ObjectManager;
10-
use Magento\Framework\Api\SortOrder;
15+
use Magento\Framework\Exception\InputException;
1116
use Magento\Framework\Exception\NoSuchEntityException;
17+
use Magento\Quote\Api\CartRepositoryInterface;
1218
use Magento\Quote\Api\Data\CartInterface;
13-
use Magento\Quote\Model\Quote;
14-
use Magento\Store\Model\StoreManagerInterface;
15-
use Magento\Framework\Api\Search\FilterGroup;
16-
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
17-
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
18-
use Magento\Framework\Exception\InputException;
19-
use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
19+
use Magento\Quote\Api\Data\CartInterfaceFactory;
20+
use Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory;
2021
use Magento\Quote\Model\QuoteRepository\SaveHandler;
2122
use Magento\Quote\Model\QuoteRepository\LoadHandler;
23+
use Magento\Quote\Model\ResourceModel\Quote\Collection as QuoteCollection;
24+
use Magento\Quote\Model\ResourceModel\Quote\CollectionFactory as QuoteCollectionFactory;
25+
use Magento\Store\Model\StoreManagerInterface;
2226

2327
/**
28+
* Quote repository.
29+
*
2430
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2531
*/
26-
class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
32+
class QuoteRepository implements CartRepositoryInterface
2733
{
2834
/**
2935
* @var Quote[]
@@ -37,6 +43,7 @@ class QuoteRepository implements \Magento\Quote\Api\CartRepositoryInterface
3743

3844
/**
3945
* @var QuoteFactory
46+
* @deprecated
4047
*/
4148
protected $quoteFactory;
4249

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

4855
/**
49-
* @var \Magento\Quote\Model\ResourceModel\Quote\Collection
56+
* @var QuoteCollection
5057
* @deprecated 100.2.0
5158
*/
5259
protected $quoteCollection;
5360

5461
/**
55-
* @var \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory
62+
* @var CartSearchResultsInterfaceFactory
5663
*/
5764
protected $searchResultsDataFactory;
5865

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

7986
/**
80-
* @var \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory
87+
* @var QuoteCollectionFactory
8188
*/
8289
private $quoteCollectionFactory;
8390

91+
/**
92+
* @var CartInterfaceFactory
93+
*/
94+
private $cartFactory;
95+
8496
/**
8597
* Constructor
8698
*
8799
* @param QuoteFactory $quoteFactory
88100
* @param StoreManagerInterface $storeManager
89-
* @param \Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection
90-
* @param \Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory
101+
* @param QuoteCollection $quoteCollection
102+
* @param CartSearchResultsInterfaceFactory $searchResultsDataFactory
91103
* @param JoinProcessorInterface $extensionAttributesJoinProcessor
92104
* @param CollectionProcessorInterface|null $collectionProcessor
93-
* @param \Magento\Quote\Model\ResourceModel\Quote\CollectionFactory|null $quoteCollectionFactory
105+
* @param QuoteCollectionFactory|null $quoteCollectionFactory
106+
* @param CartInterfaceFactory|null $cartFactory
94107
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
95108
*/
96109
public function __construct(
97110
QuoteFactory $quoteFactory,
98111
StoreManagerInterface $storeManager,
99-
\Magento\Quote\Model\ResourceModel\Quote\Collection $quoteCollection,
100-
\Magento\Quote\Api\Data\CartSearchResultsInterfaceFactory $searchResultsDataFactory,
112+
QuoteCollection $quoteCollection,
113+
CartSearchResultsInterfaceFactory $searchResultsDataFactory,
101114
JoinProcessorInterface $extensionAttributesJoinProcessor,
102115
CollectionProcessorInterface $collectionProcessor = null,
103-
\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory $quoteCollectionFactory = null
116+
QuoteCollectionFactory $quoteCollectionFactory = null,
117+
CartInterfaceFactory $cartFactory = null
104118
) {
105119
$this->quoteFactory = $quoteFactory;
106120
$this->storeManager = $storeManager;
107121
$this->searchResultsDataFactory = $searchResultsDataFactory;
108122
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
109-
$this->collectionProcessor = $collectionProcessor ?: \Magento\Framework\App\ObjectManager::getInstance()
110-
->get(\Magento\Framework\Api\SearchCriteria\CollectionProcessor::class);
111-
$this->quoteCollectionFactory = $quoteCollectionFactory ?: \Magento\Framework\App\ObjectManager::getInstance()
112-
->get(\Magento\Quote\Model\ResourceModel\Quote\CollectionFactory::class);
123+
$this->collectionProcessor = $collectionProcessor ?: ObjectManager::getInstance()
124+
->get(CollectionProcessor::class);
125+
$this->quoteCollectionFactory = $quoteCollectionFactory ?: ObjectManager::getInstance()
126+
->get(QuoteCollectionFactory::class);
127+
$this->cartFactory = $cartFactory ?: ObjectManager::getInstance()->get(CartInterfaceFactory::class);
113128
}
114129

115130
/**
116-
* {@inheritdoc}
131+
* @inheritdoc
117132
*/
118133
public function get($cartId, array $sharedStoreIds = [])
119134
{
@@ -126,7 +141,7 @@ public function get($cartId, array $sharedStoreIds = [])
126141
}
127142

128143
/**
129-
* {@inheritdoc}
144+
* @inheritdoc
130145
*/
131146
public function getForCustomer($customerId, array $sharedStoreIds = [])
132147
{
@@ -140,7 +155,7 @@ public function getForCustomer($customerId, array $sharedStoreIds = [])
140155
}
141156

142157
/**
143-
* {@inheritdoc}
158+
* @inheritdoc
144159
*/
145160
public function getActive($cartId, array $sharedStoreIds = [])
146161
{
@@ -152,7 +167,7 @@ public function getActive($cartId, array $sharedStoreIds = [])
152167
}
153168

154169
/**
155-
* {@inheritdoc}
170+
* @inheritdoc
156171
*/
157172
public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
158173
{
@@ -164,9 +179,9 @@ public function getActiveForCustomer($customerId, array $sharedStoreIds = [])
164179
}
165180

166181
/**
167-
* {@inheritdoc}
182+
* @inheritdoc
168183
*/
169-
public function save(\Magento\Quote\Api\Data\CartInterface $quote)
184+
public function save(CartInterface $quote)
170185
{
171186
if ($quote->getId()) {
172187
$currentQuote = $this->get($quote->getId(), [$quote->getStoreId()]);
@@ -184,9 +199,9 @@ public function save(\Magento\Quote\Api\Data\CartInterface $quote)
184199
}
185200

186201
/**
187-
* {@inheritdoc}
202+
* @inheritdoc
188203
*/
189-
public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
204+
public function delete(CartInterface $quote)
190205
{
191206
$quoteId = $quote->getId();
192207
$customerId = $quote->getCustomerId();
@@ -203,13 +218,13 @@ public function delete(\Magento\Quote\Api\Data\CartInterface $quote)
203218
* @param int $identifier
204219
* @param int[] $sharedStoreIds
205220
* @throws NoSuchEntityException
206-
* @return Quote
221+
* @return CartInterface
207222
*/
208223
protected function loadQuote($loadMethod, $loadField, $identifier, array $sharedStoreIds = [])
209224
{
210-
/** @var Quote $quote */
211-
$quote = $this->quoteFactory->create();
212-
if ($sharedStoreIds) {
225+
/** @var CartInterface $quote */
226+
$quote = $this->cartFactory->create();
227+
if ($sharedStoreIds && method_exists($quote, 'setSharedStoreIds')) {
213228
$quote->setSharedStoreIds($sharedStoreIds);
214229
}
215230
$quote->setStoreId($this->storeManager->getStore()->getId())->$loadMethod($identifier);
@@ -220,9 +235,9 @@ protected function loadQuote($loadMethod, $loadField, $identifier, array $shared
220235
}
221236

222237
/**
223-
* {@inheritdoc}
238+
* @inheritdoc
224239
*/
225-
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria)
240+
public function getList(SearchCriteriaInterface $searchCriteria)
226241
{
227242
$this->quoteCollection = $this->quoteCollectionFactory->create();
228243
/** @var \Magento\Quote\Api\Data\CartSearchResultsInterface $searchData */
@@ -265,6 +280,7 @@ protected function addFilterGroupToCollection(FilterGroup $filterGroup, QuoteCol
265280

266281
/**
267282
* Get new SaveHandler dependency for application code.
283+
*
268284
* @return SaveHandler
269285
* @deprecated 100.1.0
270286
*/
@@ -277,6 +293,8 @@ private function getSaveHandler()
277293
}
278294

279295
/**
296+
* Get load handler instance.
297+
*
280298
* @return LoadHandler
281299
* @deprecated 100.1.0
282300
*/

0 commit comments

Comments
 (0)