Skip to content

Commit 339d0ad

Browse files
author
Eugene Tulika
committed
Merge remote-tracking branch 'mainline/develop' into Accept-Public-PRs
2 parents a75fba4 + ad5e6b2 commit 339d0ad

File tree

21 files changed

+381
-301
lines changed

21 files changed

+381
-301
lines changed

app/code/Magento/Bundle/Model/Resource/Indexer/Price.php

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -529,27 +529,6 @@ protected function _prepareBundlePrice($entityIds = null)
529529
$this->_prepareBundlePriceByType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_FIXED, $entityIds);
530530
$this->_prepareBundlePriceByType(\Magento\Bundle\Model\Product\Price::PRICE_TYPE_DYNAMIC, $entityIds);
531531

532-
/**
533-
* Add possibility modify prices from external events
534-
*/
535-
$select = $this->_getWriteAdapter()->select()->join(
536-
['wd' => $this->_getWebsiteDateTable()],
537-
'i.website_id = wd.website_id',
538-
[]
539-
);
540-
$this->_eventManager->dispatch(
541-
'prepare_catalog_product_price_index_table',
542-
[
543-
'index_table' => ['i' => $this->_getBundlePriceTable()],
544-
'select' => $select,
545-
'entity_id' => 'i.entity_id',
546-
'customer_group_id' => 'i.customer_group_id',
547-
'website_id' => 'i.website_id',
548-
'website_date' => 'wd.website_date',
549-
'update_fields' => ['price', 'min_price', 'max_price']
550-
]
551-
);
552-
553532
$this->_calculateBundleOptionPrice();
554533
$this->_applyCustomOption();
555534

app/code/Magento/Catalog/Model/Resource/Product/Indexer/Price/DefaultPrice.php

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -318,28 +318,6 @@ protected function _prepareFinalPriceData($entityIds = null)
318318

319319
$query = $select->insertFromSelect($this->_getDefaultFinalPriceTable(), [], false);
320320
$write->query($query);
321-
322-
/**
323-
* Add possibility modify prices from external events
324-
*/
325-
$select = $write->select()->join(
326-
['wd' => $this->_getWebsiteDateTable()],
327-
'i.website_id = wd.website_id',
328-
[]
329-
);
330-
$this->_eventManager->dispatch(
331-
'prepare_catalog_product_price_index_table',
332-
[
333-
'index_table' => ['i' => $this->_getDefaultFinalPriceTable()],
334-
'select' => $select,
335-
'entity_id' => 'i.entity_id',
336-
'customer_group_id' => 'i.customer_group_id',
337-
'website_id' => 'i.website_id',
338-
'website_date' => 'wd.website_date',
339-
'update_fields' => ['price', 'min_price', 'max_price']
340-
]
341-
);
342-
343321
return $this;
344322
}
345323

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

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ class Observer
4747
*/
4848
protected $_customerSession;
4949

50-
/**
51-
* @var Price
52-
*/
53-
protected $_productPrice;
54-
5550
/**
5651
* @var \Magento\CatalogRule\Model\Resource\Rule\CollectionFactory
5752
*/
@@ -86,7 +81,6 @@ class Observer
8681
* @param Resource\RuleFactory $resourceRuleFactory
8782
* @param Resource\Rule $resourceRule
8883
* @param Resource\Rule\CollectionFactory $ruleCollectionFactory
89-
* @param Price $productPrice
9084
* @param StoreManagerInterface $storeManager
9185
* @param TimezoneInterface $localeDate
9286
* @param CustomerModelSession $customerSession
@@ -100,7 +94,6 @@ public function __construct(
10094
Resource\RuleFactory $resourceRuleFactory,
10195
Resource\Rule $resourceRule,
10296
Resource\Rule\CollectionFactory $ruleCollectionFactory,
103-
Rule\Product\Price $productPrice,
10497
StoreManagerInterface $storeManager,
10598
TimezoneInterface $localeDate,
10699
CustomerModelSession $customerSession,
@@ -111,7 +104,6 @@ public function __construct(
111104
$this->_resourceRuleFactory = $resourceRuleFactory;
112105
$this->_resourceRule = $resourceRule;
113106
$this->_ruleCollectionFactory = $ruleCollectionFactory;
114-
$this->_productPrice = $productPrice;
115107
$this->_storeManager = $storeManager;
116108
$this->_localeDate = $localeDate;
117109
$this->_customerSession = $customerSession;
@@ -215,36 +207,6 @@ public function flushPriceCache()
215207
$this->_rulePrices = [];
216208
}
217209

218-
/**
219-
* Calculate minimal final price with catalog rule price
220-
*
221-
* @param EventObserver $observer
222-
* @return $this
223-
*/
224-
public function prepareCatalogProductPriceIndexTable(EventObserver $observer)
225-
{
226-
$select = $observer->getEvent()->getSelect();
227-
228-
$indexTable = $observer->getEvent()->getIndexTable();
229-
$entityId = $observer->getEvent()->getEntityId();
230-
$customerGroupId = $observer->getEvent()->getCustomerGroupId();
231-
$websiteId = $observer->getEvent()->getWebsiteId();
232-
$websiteDate = $observer->getEvent()->getWebsiteDate();
233-
$updateFields = $observer->getEvent()->getUpdateFields();
234-
235-
$this->_productPrice->applyPriceRuleToIndexTable(
236-
$select,
237-
$indexTable,
238-
$entityId,
239-
$customerGroupId,
240-
$websiteId,
241-
$updateFields,
242-
$websiteDate
243-
);
244-
245-
return $this;
246-
}
247-
248210
/**
249211
* @param EventObserver $observer
250212
* @return $this

app/code/Magento/CatalogRule/etc/events.xml

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

app/code/Magento/Customer/etc/data_source/customer_address.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
</field>
5050
<field name="region" source="eav" formElement="input" visible="false"/>
5151

52-
<field name="postcode" source="eav" formElement="post_code_fix" >
52+
<field name="postcode" source="eav" formElement="post_code" >
5353
<constraints>
5454
<validate name="required-entry"/>
5555
</constraints>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Developer\Model\Less\FileGenerator;
7+
8+
use Magento\Framework\Less\FileGenerator\RelatedGenerator;
9+
use Magento\Framework\View\Asset\LocalInterface;
10+
11+
/**
12+
* Class PublicationDecorator
13+
* Decorates generator of related assets and publishes them
14+
*
15+
* @package Magento\Developer\Model\Less\FileGenerator
16+
*/
17+
class PublicationDecorator extends RelatedGenerator
18+
{
19+
/**
20+
* @var \Magento\Framework\App\View\Asset\Publisher
21+
*/
22+
private $publisher;
23+
24+
/**
25+
* @param \Magento\Framework\Filesystem $filesystem
26+
* @param \Magento\Framework\View\Asset\Repository $assetRepo
27+
* @param \Magento\Framework\Less\File\Temporary $temporaryFile
28+
* @param \Magento\Framework\App\View\Asset\Publisher $publisher
29+
*/
30+
public function __construct(
31+
\Magento\Framework\Filesystem $filesystem,
32+
\Magento\Framework\View\Asset\Repository $assetRepo,
33+
\Magento\Framework\Less\File\Temporary $temporaryFile,
34+
\Magento\Framework\App\View\Asset\Publisher $publisher
35+
) {
36+
parent::__construct($filesystem, $assetRepo, $temporaryFile);
37+
$this->publisher = $publisher;
38+
}
39+
40+
/**
41+
* {inheritdoc}
42+
*/
43+
protected function generateRelatedFile($relatedFileId, LocalInterface $asset)
44+
{
45+
$relatedAsset = parent::generateRelatedFile($relatedFileId, $asset);
46+
$this->publisher->publish($relatedAsset);
47+
return $relatedAsset;
48+
}
49+
}

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,9 +2042,7 @@ public function addMessage($message, $index = 'error')
20422042
return $this;
20432043
}
20442044

2045-
if (is_string($message)) {
2046-
$message = $this->messageFactory->create(\Magento\Framework\Message\MessageInterface::TYPE_ERROR, $message);
2047-
}
2045+
$message = $this->messageFactory->create(\Magento\Framework\Message\MessageInterface::TYPE_ERROR, $message);
20482046

20492047
$messages[$index] = $message;
20502048
$this->setData('messages', $messages);

app/etc/di.xml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -557,13 +557,6 @@
557557
<argument name="publisher" xsi:type="object">developerPublisher</argument>
558558
</arguments>
559559
</type>
560-
<type name="Magento\Framework\View\Asset\SourceFileGeneratorPool">
561-
<arguments>
562-
<argument name="fileGeneratorTypes" xsi:type="array">
563-
<item name="less" xsi:type="object">Magento\Framework\Less\FileGenerator</item>
564-
</argument>
565-
</arguments>
566-
</type>
567560
<virtualType name="developerPublisher" type="Magento\Framework\App\View\Asset\Publisher">
568561
<arguments>
569562
<argument name="materializationStrategyFactory" xsi:type="object">developerMaterialization</argument>
@@ -577,24 +570,23 @@
577570
</argument>
578571
</arguments>
579572
</virtualType>
580-
<virtualType name="lessFileGeneratorMaterialization" type="Magento\Framework\App\View\Asset\MaterializationStrategy\Factory">
573+
<type name="Magento\Framework\View\Asset\SourceFileGeneratorPool">
581574
<arguments>
582-
<argument name="strategiesList" xsi:type="array">
583-
<item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
584-
<item name="default" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
575+
<argument name="fileGeneratorTypes" xsi:type="array">
576+
<item name="less" xsi:type="object">fileassemblerFileGenerator</item>
585577
</argument>
586578
</arguments>
587-
</virtualType>
588-
<virtualType name="lessFileGeneratorPublisher" type="Magento\Framework\App\View\Asset\Publisher">
579+
</type>
580+
<virtualType name="fileassemblerFileGenerator" type="Magento\Framework\Less\FileGenerator">
589581
<arguments>
590-
<argument name="materializationStrategyFactory" xsi:type="object">lessFileGeneratorMaterialization</argument>
582+
<argument name="relatedGenerator" xsi:type="object">fileassemblerRelatedFilesGenerator</argument>
591583
</arguments>
592584
</virtualType>
593-
<type name="Magento\Framework\Less\FileGenerator">
585+
<virtualType name="fileassemblerRelatedFilesGenerator" type="Magento\Developer\Model\Less\FileGenerator\PublicationDecorator">
594586
<arguments>
595-
<argument name="publisher" xsi:type="object">lessFileGeneratorPublisher</argument>
587+
<argument name="publisher" xsi:type="object">developerPublisher</argument>
596588
</arguments>
597-
</type>
589+
</virtualType>
598590
<virtualType name="fallbackResolverSimpleWithGroupedCache" type="Magento\Framework\View\Design\FileResolution\Fallback\Resolver\Simple">
599591
<arguments>
600592
<argument name="cache" xsi:type="object">Magento\Framework\View\Design\FileResolution\Fallback\CacheData\Grouped</argument>

dev/tests/static/testsuite/Magento/Test/Legacy/_files/obsolete_methods.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,4 +2149,5 @@
21492149
['loadCollectionAttributes', 'Magento\Eav\Model\Config'],
21502150
['_isCacheEnabled', 'Magento\Eav\Model\Config'],
21512151
['_createCustomerAttribute', '\Magento\Customer\Model\Customer'],
2152+
['prepareCatalogProductPriceIndexTable', 'Magento\CatalogRule\Model\Observer'],
21522153
];

dev/tools/Magento/Tools/Webdev/App/FileAssembler.php

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Framework\App;
1010
use Magento\Framework\App\State;
1111
use Magento\Framework\AppInterface;
12+
use Magento\Framework\Filesystem;
1213
use Magento\Tools\Webdev\CliParams;
1314
use Magento\Tools\View\Deployer\Log;
1415
use Magento\Framework\View\Asset\Source;
@@ -18,6 +19,7 @@
1819
use Magento\Framework\App\ObjectManager\ConfigLoader;
1920
use Magento\Framework\View\Asset\SourceFileGeneratorPool;
2021
use Magento\Framework\View\Asset\PreProcessor\ChainFactoryInterface;
22+
use Magento\Framework\App\Filesystem\DirectoryList;
2123

2224
/**
2325
* Class FileAssembler
@@ -60,7 +62,7 @@ class FileAssembler implements AppInterface
6062
/**
6163
* @var \Magento\Framework\Less\FileGenerator
6264
*/
63-
private $sourceFileGeneratorPoll;
65+
private $sourceFileGeneratorPool;
6466

6567
/**
6668
* @var \Magento\Framework\View\Asset\Source
@@ -77,6 +79,11 @@ class FileAssembler implements AppInterface
7779
*/
7880
private $chainFactory;
7981

82+
/**
83+
* @var Filesystem
84+
*/
85+
private $filesystem;
86+
8087
/**
8188
* @param ObjectManagerInterface $objectManager
8289
* @param Response $response
@@ -88,6 +95,7 @@ class FileAssembler implements AppInterface
8895
* @param \Magento\Framework\View\Asset\SourceFileGeneratorPool $sourceFileGeneratorPoll
8996
* @param \Magento\Tools\View\Deployer\Log $logger
9097
* @param ChainFactoryInterface $chainFactory
98+
* @param Filesystem $filesystem
9199
*
92100
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
93101
*/
@@ -101,18 +109,20 @@ public function __construct(
101109
Source $assetSource,
102110
SourceFileGeneratorPool $sourceFileGeneratorPoll,
103111
Log $logger,
104-
ChainFactoryInterface $chainFactory
112+
ChainFactoryInterface $chainFactory,
113+
Filesystem $filesystem
105114
) {
106115
$this->response = $response;
107116
$this->params = $params;
108117
$this->state = $state;
109118
$this->objectManager = $objectManager;
110119
$this->configLoader = $configLoader;
111120
$this->assetRepo = $assetRepo;
112-
$this->sourceFileGeneratorPoll = $sourceFileGeneratorPoll;
121+
$this->sourceFileGeneratorPool = $sourceFileGeneratorPoll;
113122
$this->assetSource = $assetSource;
114123
$this->logger = $logger;
115124
$this->chainFactory = $chainFactory;
125+
$this->filesystem = $filesystem;
116126
}
117127

118128
/**
@@ -125,7 +135,7 @@ public function launch()
125135
$this->state->setAreaCode($this->params->getArea());
126136
$this->objectManager->configure($this->configLoader->load($this->params->getArea()));
127137

128-
$sourceFileGenerator = $this->sourceFileGeneratorPoll->create($this->params->getExt());
138+
$sourceFileGenerator = $this->sourceFileGeneratorPool->create($this->params->getExt());
129139

130140
foreach ($this->params->getFiles() as $file) {
131141
$file .= '.' . $this->params->getExt();
@@ -152,7 +162,13 @@ public function launch()
152162
]
153163
);
154164

155-
$sourceFileGenerator->generateFileTree($chain);
165+
$processedCoreFile = $sourceFileGenerator->generateFileTree($chain);
166+
167+
$targetDir = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
168+
$rootDir = $this->filesystem->getDirectoryWrite(DirectoryList::ROOT);
169+
$source = $rootDir->getRelativePath($processedCoreFile);
170+
$destination = $asset->getPath();
171+
$rootDir->copyFile($source, $destination, $targetDir);
156172

157173
$this->logger->logMessage("Done");
158174
}

dev/tools/Magento/Tools/Webdev/file_assembler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@
3535
$logger = new Log($params->getVerbose());
3636

3737
} catch (\Zend_Console_Getopt_Exception $e) {
38-
echo $e->getUsageMessage();
39-
echo 'Please, use quotes(") for wrapping strings.' . "\n";
38+
echo $e->getMessage() . PHP_EOL;
39+
echo 'Please, use quotes(") for wrapping strings.' . PHP_EOL;
4040
exit(1);
4141
}
4242

4343
$bootstrap = \Magento\Framework\App\Bootstrap::create(BP, $_SERVER);
4444
/** @var \Magento\Framework\App\Http $app */
4545
$app = $bootstrap->createApplication(
46-
'Magento\Tools\WebDev\App\FileAssembler',
46+
'Magento\Tools\Webdev\App\FileAssembler',
4747
['params' => $params, 'logger' => $logger]
4848
);
4949
$bootstrap->run($app);

0 commit comments

Comments
 (0)