Skip to content

Commit cfba0e1

Browse files
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #18874: [Backport] Fixed issue #4468 "Unable to insert multiple catalog product list wid� (by @gelanivishal) - #18287: Ensure integer values are not quoted as strings (by @udovicic) - #17978: #17488 Fix Authenticating a customer via REST API does not update the last logged in data (by @prakashpatel07) Fixed GitHub Issues: - #4468: Unable to insert multiple catalog product list widgets in CMS page (reported by @kandrejevs) has been fixed in #18874 by @gelanivishal in 2.2-develop branch Related commits: 1. 3f17772 - #17488: Authenticating a customer via REST API does not update the last logged in data (reported by @paul-blundell) has been fixed in #17978 by @prakashpatel07 in 2.2-develop branch Related commits: 1. d73e84f 2. 9a4f260 3. 55047c7 4. da2c920 5. e8636ef 6. 141b0e4
2 parents 7482199 + 66fc9a3 commit cfba0e1

File tree

9 files changed

+72
-12
lines changed

9 files changed

+72
-12
lines changed

app/code/Magento/Catalog/Model/Api/SearchCriteria/CollectionProcessor/ConditionProcessor/ProductCategoryCondition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ private function getCategoryIds(Filter $filter): array
102102
}
103103
}
104104

105-
return array_unique(array_merge($categoryIds, ...$childCategoryIds));
105+
return array_map('intval', array_unique(array_merge($categoryIds, ...$childCategoryIds)));
106106
}
107107

108108
/**

app/code/Magento/Catalog/Model/ProductCategoryList.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ public function getCategoryIds($productId)
8181
Select::SQL_UNION_ALL
8282
);
8383

84-
$this->categoryIdList[$productId] = $this->productResource->getConnection()->fetchCol($unionSelect);
84+
$this->categoryIdList[$productId] = array_map(
85+
'intval',
86+
$this->productResource->getConnection()->fetchCol($unionSelect)
87+
);
8588
}
8689

8790
return $this->categoryIdList[$productId];

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,7 +1803,8 @@ protected function _productLimitationJoinWebsite()
18031803
}
18041804
$conditions[] = $this->getConnection()->quoteInto(
18051805
'product_website.website_id IN(?)',
1806-
$filters['website_ids']
1806+
$filters['website_ids'],
1807+
'int'
18071808
);
18081809
} elseif (isset(
18091810
$filters['store_id']
@@ -1815,7 +1816,7 @@ protected function _productLimitationJoinWebsite()
18151816
) {
18161817
$joinWebsite = true;
18171818
$websiteId = $this->_storeManager->getStore($filters['store_id'])->getWebsiteId();
1818-
$conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId);
1819+
$conditions[] = $this->getConnection()->quoteInto('product_website.website_id = ?', $websiteId, 'int');
18191820
}
18201821

18211822
$fromPart = $this->getSelect()->getPart(\Magento\Framework\DB\Select::FROM);
@@ -2011,12 +2012,12 @@ protected function _applyProductLimitations()
20112012

20122013
$conditions = [
20132014
'cat_index.product_id=e.entity_id',
2014-
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id']),
2015+
$this->getConnection()->quoteInto('cat_index.store_id=?', $filters['store_id'], 'int'),
20152016
];
20162017
if (isset($filters['visibility']) && !isset($filters['store_table'])) {
2017-
$conditions[] = $this->getConnection()->quoteInto('cat_index.visibility IN(?)', $filters['visibility']);
2018+
$conditions[] = $this->getConnection()->quoteInto('cat_index.visibility IN(?)', $filters['visibility'], 'int');
20182019
}
2019-
$conditions[] = $this->getConnection()->quoteInto('cat_index.category_id=?', $filters['category_id']);
2020+
$conditions[] = $this->getConnection()->quoteInto('cat_index.category_id=?', $filters['category_id'], 'int');
20202021
if (isset($filters['category_is_anchor'])) {
20212022
$conditions[] = $this->getConnection()->quoteInto('cat_index.is_parent=?', $filters['category_is_anchor']);
20222023
}

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public function getProductPriceHtml(
196196
? $arguments['display_minimal_price']
197197
: true;
198198

199-
/** @var \Magento\Framework\Pricing\Render $priceRender */
199+
/** @var \Magento\Framework\Pricing\Render $priceRender */
200200
$priceRender = $this->getLayout()->getBlock('product.price.render.default');
201201

202202
$price = '';
@@ -338,7 +338,7 @@ public function getPagerHtml()
338338
if (!$this->pager) {
339339
$this->pager = $this->getLayout()->createBlock(
340340
\Magento\Catalog\Block\Product\Widget\Html\Pager::class,
341-
'widget.products.list.pager'
341+
$this->getWidgetPagerBlockName()
342342
);
343343

344344
$this->pager->setUseContainer(true)
@@ -398,4 +398,19 @@ private function getPriceCurrency()
398398
}
399399
return $this->priceCurrency;
400400
}
401+
402+
/**
403+
* @return string
404+
*/
405+
private function getWidgetPagerBlockName()
406+
{
407+
$pageName = $this->getData('page_var_name');
408+
$pagerBlockName = 'widget.products.list.pager';
409+
410+
if (!$pageName) {
411+
return $pagerBlockName;
412+
}
413+
414+
return $pagerBlockName . '.' . $pageName;
415+
}
401416
}

app/code/Magento/Integration/Model/CustomerTokenService.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Magento\Integration\Model\ResourceModel\Oauth\Token\CollectionFactory as TokenCollectionFactory;
1515
use Magento\Integration\Model\Oauth\Token\RequestThrottler;
1616
use Magento\Framework\Exception\AuthenticationException;
17+
use Magento\Framework\Event\ManagerInterface;
1718

1819
class CustomerTokenService implements \Magento\Integration\Api\CustomerTokenServiceInterface
1920
{
@@ -48,24 +49,33 @@ class CustomerTokenService implements \Magento\Integration\Api\CustomerTokenServ
4849
*/
4950
private $requestThrottler;
5051

52+
/**
53+
* @var Magento\Framework\Event\ManagerInterface
54+
*/
55+
private $eventManager;
56+
5157
/**
5258
* Initialize service
5359
*
5460
* @param TokenModelFactory $tokenModelFactory
5561
* @param AccountManagementInterface $accountManagement
5662
* @param TokenCollectionFactory $tokenModelCollectionFactory
5763
* @param \Magento\Integration\Model\CredentialsValidator $validatorHelper
64+
* @param \Magento\Framework\Event\ManagerInterface $eventManager
5865
*/
5966
public function __construct(
6067
TokenModelFactory $tokenModelFactory,
6168
AccountManagementInterface $accountManagement,
6269
TokenCollectionFactory $tokenModelCollectionFactory,
63-
CredentialsValidator $validatorHelper
70+
CredentialsValidator $validatorHelper,
71+
ManagerInterface $eventManager = null
6472
) {
6573
$this->tokenModelFactory = $tokenModelFactory;
6674
$this->accountManagement = $accountManagement;
6775
$this->tokenModelCollectionFactory = $tokenModelCollectionFactory;
6876
$this->validatorHelper = $validatorHelper;
77+
$this->eventManager = $eventManager ?: \Magento\Framework\App\ObjectManager::getInstance()
78+
->get(ManagerInterface::class);
6979
}
7080

7181
/**
@@ -83,6 +93,7 @@ public function createCustomerAccessToken($username, $password)
8393
__('You did not sign in correctly or your account is temporarily disabled.')
8494
);
8595
}
96+
$this->eventManager->dispatch('customer_login', ['customer' => $customerDataObject]);
8697
$this->getRequestThrottler()->resetAuthenticationFailuresCount($username, RequestThrottler::USER_TYPE_CUSTOMER);
8798
return $this->tokenModelFactory->create()->createCustomerToken($customerDataObject->getId())->getToken();
8899
}

app/code/Magento/Integration/Test/Unit/Model/CustomerTokenServiceTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class CustomerTokenServiceTest extends \PHPUnit\Framework\TestCase
3232
/** @var \Magento\Integration\Model\Oauth\Token|\PHPUnit_Framework_MockObject_MockObject */
3333
private $_tokenMock;
3434

35+
/** @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
36+
protected $manager;
37+
3538
protected function setUp()
3639
{
3740
$this->_tokenFactoryMock = $this->getMockBuilder(\Magento\Integration\Model\Oauth\TokenFactory::class)
@@ -67,11 +70,14 @@ protected function setUp()
6770
\Magento\Integration\Model\CredentialsValidator::class
6871
)->disableOriginalConstructor()->getMock();
6972

73+
$this->manager = $this->createMock(\Magento\Framework\Event\ManagerInterface::class);
74+
7075
$this->_tokenService = new \Magento\Integration\Model\CustomerTokenService(
7176
$this->_tokenFactoryMock,
7277
$this->_accountManagementMock,
7378
$this->_tokenModelCollectionFactoryMock,
74-
$this->validatorHelperMock
79+
$this->validatorHelperMock,
80+
$this->manager
7581
);
7682
}
7783

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
9+
<event name="customer_login">
10+
<observer name="customer_log_login" instance="Magento\Customer\Observer\LogLastLoginAtObserver" />
11+
</event>
12+
</config>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
9+
<event name="customer_login">
10+
<observer name="customer_log_login" instance="Magento\Customer\Observer\LogLastLoginAtObserver" />
11+
</event>
12+
</config>

lib/internal/Magento/Framework/Mview/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public function update()
285285
for ($versionFrom = $lastVersionId; $versionFrom < $currentVersionId; $versionFrom += $versionBatchSize) {
286286
// Don't go past the current version for atomicy.
287287
$versionTo = min($currentVersionId, $versionFrom + $versionBatchSize);
288-
$ids = $this->getChangelog()->getList($versionFrom, $versionTo);
288+
$ids = array_map('intval', $this->getChangelog()->getList($versionFrom, $versionTo));
289289

290290
// We run the actual indexer in batches. Chunked AFTER loading to avoid duplicates in separate chunks.
291291
$chunks = array_chunk($ids, $batchSize);

0 commit comments

Comments
 (0)