Skip to content

Commit 70466fa

Browse files
authored
Merge pull request magento#4569 from magento-tango/PR-08-233
[tango] PR 08 2.3.3
2 parents 19e8507 + 5408fb5 commit 70466fa

File tree

26 files changed

+359
-614
lines changed

26 files changed

+359
-614
lines changed

app/code/Magento/Bundle/Setup/Patch/Schema/ChangeTmpTablesEngine.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ public function apply()
4141
'catalog_product_index_price_bundle_opt_tmp',
4242
];
4343
foreach ($tables as $table) {
44-
$this->schemaSetup->getConnection()->changeTableEngine($table, 'InnoDB');
44+
$tableName = $this->schemaSetup->getTable($table);
45+
if ($this->schemaSetup->getConnection()->isTableExists($tableName)) {
46+
$this->schemaSetup->getConnection()->changeTableEngine($tableName, 'InnoDB');
47+
}
4548
}
4649

4750
$this->schemaSetup->endSetup();

app/code/Magento/CardinalCommerce/etc/config.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
99
<default>
10+
<dev>
11+
<js>
12+
<minify_exclude>
13+
<cardinal_commerce>/v1/songbird</cardinal_commerce>
14+
</minify_exclude>
15+
</js>
16+
</dev>
1017
<three_d_secure>
1118
<cardinal>
1219
<environment>production</environment>

app/code/Magento/Catalog/Model/Product/Type/Price.php

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,6 @@ class Price
9393
*/
9494
private $tierPriceExtensionFactory;
9595

96-
/**
97-
* @var \Magento\CatalogRule\Model\RuleDateFormatterInterface
98-
*/
99-
private $ruleDateFormatter;
100-
10196
/**
10297
* Constructor
10398
*
@@ -111,7 +106,6 @@ class Price
111106
* @param \Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory
112107
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
113108
* @param ProductTierPriceExtensionFactory|null $tierPriceExtensionFactory
114-
* @param \Magento\CatalogRule\Model\RuleDateFormatterInterface|null $ruleDateFormatter
115109
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
116110
*/
117111
public function __construct(
@@ -124,8 +118,7 @@ public function __construct(
124118
GroupManagementInterface $groupManagement,
125119
\Magento\Catalog\Api\Data\ProductTierPriceInterfaceFactory $tierPriceFactory,
126120
\Magento\Framework\App\Config\ScopeConfigInterface $config,
127-
ProductTierPriceExtensionFactory $tierPriceExtensionFactory = null,
128-
\Magento\CatalogRule\Model\RuleDateFormatterInterface $ruleDateFormatter = null
121+
ProductTierPriceExtensionFactory $tierPriceExtensionFactory = null
129122
) {
130123
$this->_ruleFactory = $ruleFactory;
131124
$this->_storeManager = $storeManager;
@@ -138,8 +131,6 @@ public function __construct(
138131
$this->config = $config;
139132
$this->tierPriceExtensionFactory = $tierPriceExtensionFactory ?: ObjectManager::getInstance()
140133
->get(ProductTierPriceExtensionFactory::class);
141-
$this->ruleDateFormatter = $ruleDateFormatter ?: ObjectManager::getInstance()
142-
->get(\Magento\CatalogRule\Model\RuleDateFormatterInterface::class);
143134
}
144135

145136
/**
@@ -605,10 +596,7 @@ public function calculatePrice(
605596
) {
606597
\Magento\Framework\Profiler::start('__PRODUCT_CALCULATE_PRICE__');
607598
if ($wId instanceof Store) {
608-
$sId = $wId->getId();
609599
$wId = $wId->getWebsiteId();
610-
} else {
611-
$sId = $this->_storeManager->getWebsite($wId)->getDefaultGroup()->getDefaultStoreId();
612600
}
613601

614602
$finalPrice = $basePrice;
@@ -622,7 +610,7 @@ public function calculatePrice(
622610
);
623611

624612
if ($rulePrice === false) {
625-
$date = $this->ruleDateFormatter->getDate($sId);
613+
$date = $this->_localeDate->date(null, null, false);
626614
$rulePrice = $this->_ruleFactory->create()->getRulePrice($date, $wId, $gId, $productId);
627615
}
628616

app/code/Magento/Catalog/Setup/Patch/Schema/ChangeTmpTablesEngine.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ public function apply()
4747
'catalog_category_product_index_tmp',
4848
];
4949
foreach ($tables as $table) {
50-
$this->schemaSetup->getConnection()->changeTableEngine($table, 'InnoDB');
50+
$tableName = $this->schemaSetup->getTable($table);
51+
if ($this->schemaSetup->getConnection()->isTableExists($tableName)) {
52+
$this->schemaSetup->getConnection()->changeTableEngine($tableName, 'InnoDB');
53+
}
5154
}
5255

5356
$this->schemaSetup->endSetup();

app/code/Magento/CatalogInventory/Setup/Patch/Schema/ChangeTmpTablesEngine.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public function apply()
3535
{
3636
$this->schemaSetup->startSetup();
3737

38-
$this->schemaSetup->getConnection()->changeTableEngine('cataloginventory_stock_status_tmp', 'InnoDB');
38+
$tableName = $this->schemaSetup->getTable('cataloginventory_stock_status_tmp');
39+
if ($this->schemaSetup->getConnection()->isTableExists($tableName)) {
40+
$this->schemaSetup->getConnection()->changeTableEngine($tableName, 'InnoDB');
41+
}
3942

4043
$this->schemaSetup->endSetup();
4144
}

app/code/Magento/CatalogRule/Model/ResourceModel/Product/CollectionProcessor.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection;
1212
use Magento\CatalogRule\Pricing\Price\CatalogRulePrice;
13-
use Magento\Framework\App\ObjectManager;
1413

1514
/**
1615
* Add catalog rule prices to collection
@@ -44,34 +43,25 @@ class CollectionProcessor
4443
*/
4544
private $localeDate;
4645

47-
/**
48-
* @var \Magento\CatalogRule\Model\RuleDateFormatterInterface
49-
*/
50-
private $ruleDateFormatter;
51-
5246
/**
5347
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
5448
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
5549
* @param \Magento\Customer\Model\Session $customerSession
5650
* @param \Magento\Framework\Stdlib\DateTime $dateTime
5751
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
58-
* @param \Magento\CatalogRule\Model\RuleDateFormatterInterface|null $ruleDateFormatter
5952
*/
6053
public function __construct(
6154
\Magento\Store\Model\StoreManagerInterface $storeManager,
6255
\Magento\Framework\App\ResourceConnection $resourceConnection,
6356
\Magento\Customer\Model\Session $customerSession,
6457
\Magento\Framework\Stdlib\DateTime $dateTime,
65-
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
66-
\Magento\CatalogRule\Model\RuleDateFormatterInterface $ruleDateFormatter = null
58+
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
6759
) {
6860
$this->storeManager = $storeManager;
6961
$this->resource = $resourceConnection;
7062
$this->customerSession = $customerSession;
7163
$this->dateTime = $dateTime;
7264
$this->localeDate = $localeDate;
73-
$this->ruleDateFormatter = $ruleDateFormatter ?: ObjectManager::getInstance()
74-
->get(\Magento\CatalogRule\Model\RuleDateFormatterInterface::class);
7565
}
7666

7767
/**
@@ -100,7 +90,7 @@ public function addPriceData(ProductCollection $productCollection, $joinColumn =
10090
),
10191
$connection->quoteInto(
10292
'catalog_rule.rule_date = ?',
103-
$this->dateTime->formatDate($this->ruleDateFormatter->getDate($store->getId()), false)
93+
$this->dateTime->formatDate($this->localeDate->date(null, null, false), false)
10494
),
10595
]
10696
),

app/code/Magento/CatalogRule/Model/ResourceModel/Product/LinkedProductSelectBuilderByCatalogRulePrice.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ class LinkedProductSelectBuilderByCatalogRulePrice implements LinkedProductSelec
5555
*/
5656
private $baseSelectProcessor;
5757

58-
/**
59-
* @var \Magento\CatalogRule\Model\RuleDateFormatterInterface
60-
*/
61-
private $ruleDateFormatter;
62-
6358
/**
6459
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
6560
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
@@ -68,7 +63,6 @@ class LinkedProductSelectBuilderByCatalogRulePrice implements LinkedProductSelec
6863
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
6964
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
7065
* @param BaseSelectProcessorInterface $baseSelectProcessor
71-
* @param \Magento\CatalogRule\Model\RuleDateFormatterInterface|null $ruleDateFormatter
7266
*/
7367
public function __construct(
7468
\Magento\Store\Model\StoreManagerInterface $storeManager,
@@ -77,8 +71,7 @@ public function __construct(
7771
\Magento\Framework\Stdlib\DateTime $dateTime,
7872
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
7973
\Magento\Framework\EntityManager\MetadataPool $metadataPool,
80-
BaseSelectProcessorInterface $baseSelectProcessor = null,
81-
\Magento\CatalogRule\Model\RuleDateFormatterInterface $ruleDateFormatter = null
74+
BaseSelectProcessorInterface $baseSelectProcessor = null
8275
) {
8376
$this->storeManager = $storeManager;
8477
$this->resource = $resourceConnection;
@@ -88,17 +81,14 @@ public function __construct(
8881
$this->metadataPool = $metadataPool;
8982
$this->baseSelectProcessor = (null !== $baseSelectProcessor)
9083
? $baseSelectProcessor : ObjectManager::getInstance()->get(BaseSelectProcessorInterface::class);
91-
$this->ruleDateFormatter = $ruleDateFormatter ?: ObjectManager::getInstance()
92-
->get(\Magento\CatalogRule\Model\RuleDateFormatterInterface::class);
9384
}
9485

9586
/**
9687
* @inheritdoc
9788
*/
9889
public function build($productId)
9990
{
100-
$timestamp = $this->ruleDateFormatter->getTimeStamp($this->storeManager->getStore());
101-
$currentDate = $this->dateTime->formatDate($timestamp, false);
91+
$currentDate = $this->dateTime->formatDate($this->localeDate->date(null, null, false), false);
10292
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
10393
$productTable = $this->resource->getTableName('catalog_product_entity');
10494

app/code/Magento/CatalogRule/Model/RuleDateFormatter.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

app/code/Magento/CatalogRule/Model/RuleDateFormatterInterface.php

Lines changed: 0 additions & 30 deletions
This file was deleted.

app/code/Magento/CatalogRule/Observer/PrepareCatalogProductCollectionPricesObserver.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,12 @@
1212
namespace Magento\CatalogRule\Observer;
1313

1414
use Magento\Catalog\Model\Product;
15-
use Magento\CatalogRule\Model\Rule;
15+
use Magento\Catalog\Model\ResourceModel\Product\Collection as ProductCollection;
1616
use Magento\Store\Model\StoreManagerInterface;
1717
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1818
use Magento\Customer\Model\Session as CustomerModelSession;
19-
use Magento\Framework\Event\Observer as EventObserver;
2019
use Magento\Customer\Api\GroupManagementInterface;
2120
use Magento\Framework\Event\ObserverInterface;
22-
use Magento\Framework\App\ObjectManager;
2321

2422
/**
2523
* Observer for applying catalog rules on product collection
@@ -59,37 +57,28 @@ class PrepareCatalogProductCollectionPricesObserver implements ObserverInterface
5957
*/
6058
protected $groupManagement;
6159

62-
/**
63-
* @var \Magento\CatalogRule\Model\RuleDateFormatterInterface
64-
*/
65-
private $ruleDateFormatter;
66-
6760
/**
6861
* @param RulePricesStorage $rulePricesStorage
6962
* @param \Magento\CatalogRule\Model\ResourceModel\RuleFactory $resourceRuleFactory
7063
* @param StoreManagerInterface $storeManager
7164
* @param TimezoneInterface $localeDate
7265
* @param CustomerModelSession $customerSession
7366
* @param GroupManagementInterface $groupManagement
74-
* @param \Magento\CatalogRule\Model\RuleDateFormatterInterface|null $ruleDateFormatter
7567
*/
7668
public function __construct(
7769
RulePricesStorage $rulePricesStorage,
7870
\Magento\CatalogRule\Model\ResourceModel\RuleFactory $resourceRuleFactory,
7971
StoreManagerInterface $storeManager,
8072
TimezoneInterface $localeDate,
8173
CustomerModelSession $customerSession,
82-
GroupManagementInterface $groupManagement,
83-
\Magento\CatalogRule\Model\RuleDateFormatterInterface $ruleDateFormatter = null
74+
GroupManagementInterface $groupManagement
8475
) {
8576
$this->rulePricesStorage = $rulePricesStorage;
8677
$this->resourceRuleFactory = $resourceRuleFactory;
8778
$this->storeManager = $storeManager;
8879
$this->localeDate = $localeDate;
8980
$this->customerSession = $customerSession;
9081
$this->groupManagement = $groupManagement;
91-
$this->ruleDateFormatter = $ruleDateFormatter ?: ObjectManager::getInstance()
92-
->get(\Magento\CatalogRule\Model\RuleDateFormatterInterface::class);
9382
}
9483

9584
/**
@@ -100,7 +89,7 @@ public function __construct(
10089
*/
10190
public function execute(\Magento\Framework\Event\Observer $observer)
10291
{
103-
/* @var $collection ProductCollection */
92+
/** @var ProductCollection $collection */
10493
$collection = $observer->getEvent()->getCollection();
10594
$store = $this->storeManager->getStore($observer->getEvent()->getStoreId());
10695
$websiteId = $store->getWebsiteId();
@@ -116,7 +105,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
116105
if ($observer->getEvent()->hasDate()) {
117106
$date = new \DateTime($observer->getEvent()->getDate());
118107
} else {
119-
$date = (new \DateTime())->setTimestamp($this->ruleDateFormatter->getTimeStamp($store));
108+
$date = $this->localeDate->date(null, null, false);
120109
}
121110

122111
$productIds = [];

0 commit comments

Comments
 (0)