Skip to content

Commit

Permalink
Merge pull request #4331 from magento-engcom/2.3-develop-prs
Browse files Browse the repository at this point in the history
[Magento Community Engineering] Community Contributions - 2.3-develop
  • Loading branch information
VladimirZaets authored Jun 11, 2019
2 parents 2dd90d0 + 97b5cc9 commit bb3cede
Show file tree
Hide file tree
Showing 104 changed files with 669 additions and 348 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/
namespace Magento\Analytics\Model\ReportXml;

use Magento\Framework\Module\Manager as ModuleManager;
use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager;

/**
* Iterator for ReportXml modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
namespace Magento\Analytics\Test\Unit\Model\ReportXml;

use Magento\Analytics\Model\ReportXml\ModuleIterator;
use Magento\Framework\Module\Manager as ModuleManager;
use \Magento\Framework\Module\ModuleManagerInterface as ModuleManager;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;

/**
* Module iterator test.
*/
class ModuleIteratorTest extends \PHPUnit\Framework\TestCase
{
/**
Expand Down
18 changes: 13 additions & 5 deletions app/code/Magento/Backend/Block/Dashboard/Orders/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ class Grid extends \Magento\Backend\Block\Dashboard\Grid
protected $_collectionFactory;

/**
* @var \Magento\Framework\Module\Manager
* @var \Magento\Framework\Module\ModuleManagerInterface
*/
protected $_moduleManager;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Backend\Helper\Data $backendHelper
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager
* @param \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Backend\Helper\Data $backendHelper,
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Framework\Module\ModuleManagerInterface $moduleManager,
\Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory,
array $data = []
) {
Expand All @@ -43,6 +43,8 @@ public function __construct(
}

/**
* Construct.
*
* @return void
*/
protected function _construct()
Expand All @@ -52,6 +54,8 @@ protected function _construct()
}

/**
* Prepare collection.
*
* @return $this
*/
protected function _prepareCollection()
Expand Down Expand Up @@ -110,6 +114,8 @@ protected function _preparePage()
}

/**
* Prepare columns.
*
* @return $this
*/
protected function _prepareColumns()
Expand All @@ -129,7 +135,9 @@ protected function _prepareColumns()
]
);

$baseCurrencyCode = $this->_storeManager->getStore((int)$this->getParam('store'))->getBaseCurrencyCode();
$baseCurrencyCode = $this->_storeManager->getStore(
(int)$this->getParam('store')
)->getBaseCurrencyCode();

$this->addColumn(
'total',
Expand All @@ -149,7 +157,7 @@ protected function _prepareColumns()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getRowUrl($row)
{
Expand Down
8 changes: 5 additions & 3 deletions app/code/Magento/Backend/Block/Dashboard/Sales.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,29 @@ class Sales extends \Magento\Backend\Block\Dashboard\Bar
protected $_template = 'Magento_Backend::dashboard/salebar.phtml';

/**
* @var \Magento\Framework\Module\Manager
* @var \Magento\Framework\Module\ModuleManagerInterface
*/
protected $_moduleManager;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory,
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Framework\Module\ModuleManagerInterface $moduleManager,
array $data = []
) {
$this->_moduleManager = $moduleManager;
parent::__construct($context, $collectionFactory, $data);
}

/**
* Prepare layout.
*
* @return $this|void
*/
protected function _prepareLayout()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ class Ordered extends \Magento\Backend\Block\Dashboard\Grid
protected $_collectionFactory;

/**
* @var \Magento\Framework\Module\Manager
* @var \Magento\Framework\Module\ModuleManagerInterface
*/
protected $_moduleManager;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Backend\Helper\Data $backendHelper
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager
* @param \Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $collectionFactory
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Backend\Helper\Data $backendHelper,
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Framework\Module\ModuleManagerInterface $moduleManager,
\Magento\Sales\Model\ResourceModel\Report\Bestsellers\CollectionFactory $collectionFactory,
array $data = []
) {
Expand All @@ -43,6 +43,8 @@ public function __construct(
}

/**
* Construct.
*
* @return void
*/
protected function _construct()
Expand All @@ -52,7 +54,7 @@ protected function _construct()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function _prepareCollection()
{
Expand Down Expand Up @@ -81,7 +83,7 @@ protected function _prepareCollection()
}

/**
* {@inheritdoc}
* @inheritdoc
*/
protected function _prepareColumns()
{
Expand Down
10 changes: 7 additions & 3 deletions app/code/Magento/Backend/Block/Dashboard/Totals.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
*/
namespace Magento\Backend\Block\Dashboard;

/**
* Totals block.
*/
class Totals extends \Magento\Backend\Block\Dashboard\Bar
{
/**
Expand All @@ -19,27 +22,28 @@ class Totals extends \Magento\Backend\Block\Dashboard\Bar
protected $_template = 'Magento_Backend::dashboard/totalbar.phtml';

/**
* @var \Magento\Framework\Module\Manager
* @var \Magento\Framework\Module\ModuleManagerInterface
*/
protected $_moduleManager;

/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Reports\Model\ResourceModel\Order\CollectionFactory $collectionFactory,
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Framework\Module\ModuleManagerInterface $moduleManager,
array $data = []
) {
$this->_moduleManager = $moduleManager;
parent::__construct($context, $collectionFactory, $data);
}

/**
* @inheritDoc
* @return $this|void
*/
protected function _prepareLayout()
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/Backend/Model/Menu/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class Item
protected $_moduleList;

/**
* @var \Magento\Framework\Module\Manager
* @var \Magento\Framework\Module\ModuleManagerInterface
*/
private $_moduleManager;

Expand All @@ -163,7 +163,7 @@ class Item
* @param \Magento\Backend\Model\MenuFactory $menuFactory
* @param \Magento\Backend\Model\UrlInterface $urlModel
* @param \Magento\Framework\Module\ModuleListInterface $moduleList
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager
* @param array $data
*/
public function __construct(
Expand All @@ -173,7 +173,7 @@ public function __construct(
\Magento\Backend\Model\MenuFactory $menuFactory,
\Magento\Backend\Model\UrlInterface $urlModel,
\Magento\Framework\Module\ModuleListInterface $moduleList,
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Framework\Module\ModuleManagerInterface $moduleManager,
array $data = []
) {
$this->_validator = $validator;
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Bundle/Block/Checkout/Cart/Item/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Renderer extends \Magento\Checkout\Block\Cart\Item\Renderer
* @param \Magento\Framework\Url\Helper\Data $urlHelper
* @param \Magento\Framework\Message\ManagerInterface $messageManager
* @param PriceCurrencyInterface $priceCurrency
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager
* @param InterpretationStrategyInterface $messageInterpretationStrategy
* @param Configuration $bundleProductConfiguration
* @param array $data
Expand All @@ -46,7 +46,7 @@ public function __construct(
\Magento\Framework\Url\Helper\Data $urlHelper,
\Magento\Framework\Message\ManagerInterface $messageManager,
PriceCurrencyInterface $priceCurrency,
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Framework\Module\ModuleManagerInterface $moduleManager,
InterpretationStrategyInterface $messageInterpretationStrategy,
Configuration $bundleProductConfiguration,
array $data = []
Expand Down
36 changes: 22 additions & 14 deletions app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class Price implements DimensionalIndexerInterface
private $eventManager;

/**
* @var \Magento\Framework\Module\Manager
* @var \Magento\Framework\Module\ModuleManagerInterface
*/
private $moduleManager;

Expand All @@ -97,7 +97,7 @@ class Price implements DimensionalIndexerInterface
* @param BasePriceModifier $basePriceModifier
* @param JoinAttributeProcessor $joinAttributeProcessor
* @param \Magento\Framework\Event\ManagerInterface $eventManager
* @param \Magento\Framework\Module\Manager $moduleManager
* @param \Magento\Framework\Module\ModuleManagerInterface $moduleManager
* @param bool $fullReindexAction
* @param string $connectionName
*
Expand All @@ -111,7 +111,7 @@ public function __construct(
BasePriceModifier $basePriceModifier,
JoinAttributeProcessor $joinAttributeProcessor,
\Magento\Framework\Event\ManagerInterface $eventManager,
\Magento\Framework\Module\Manager $moduleManager,
\Magento\Framework\Module\ModuleManagerInterface $moduleManager,
$fullReindexAction = false,
$connectionName = 'indexer'
) {
Expand All @@ -128,7 +128,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
* @param array $dimensions
* @param \Traversable $entityIds
* @throws \Exception
Expand All @@ -137,7 +137,8 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds)
{
$this->tableMaintainer->createMainTmpTable($dimensions);

$temporaryPriceTable = $this->indexTableStructureFactory->create([
$temporaryPriceTable = $this->indexTableStructureFactory->create(
[
'tableName' => $this->tableMaintainer->getMainTmpTable($dimensions),
'entityField' => 'entity_id',
'customerGroupField' => 'customer_group_id',
Expand All @@ -148,7 +149,8 @@ public function executeByDimensions(array $dimensions, \Traversable $entityIds)
'minPriceField' => 'min_price',
'maxPriceField' => 'max_price',
'tierPriceField' => 'tier_price',
]);
]
);

$entityIds = iterator_to_array($entityIds);

Expand Down Expand Up @@ -331,11 +333,13 @@ private function prepareBundlePriceByType($priceType, array $dimensions, $entity
'ROUND((1 - ' . $tierExpr . ' / 100) * ' . $price . ', 4)',
'NULL'
);
$finalPrice = $connection->getLeastSql([
$finalPrice = $connection->getLeastSql(
[
$price,
$connection->getIfNullSql($specialPriceExpr, $price),
$connection->getIfNullSql($tierPrice, $price),
]);
]
);
} else {
$finalPrice = new \Zend_Db_Expr('0');
$tierPrice = $connection->getCheckSql($tierExpr . ' IS NOT NULL', '0', 'NULL');
Expand Down Expand Up @@ -471,10 +475,12 @@ private function calculateBundleSelectionPrice($dimensions, $priceType)
'NULL'
);

$priceExpr = $connection->getLeastSql([
$priceExpr = $connection->getLeastSql(
[
$priceExpr,
$connection->getIfNullSql($tierExpr, $priceExpr),
]);
]
);
} else {
$price = 'idx.min_price * bs.selection_qty';
$specialExpr = $connection->getCheckSql(
Expand All @@ -487,10 +493,12 @@ private function calculateBundleSelectionPrice($dimensions, $priceType)
'ROUND((1 - i.tier_percent / 100) * ' . $price . ', 4)',
'NULL'
);
$priceExpr = $connection->getLeastSql([
$priceExpr = $connection->getLeastSql(
[
$specialExpr,
$connection->getIfNullSql($tierExpr, $price),
]);
]
);
}

$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
Expand Down Expand Up @@ -613,7 +621,7 @@ private function prepareTierPriceIndex($dimensions, $entityIds)
* Create bundle price.
*
* @param IndexTableStructure $priceTable
* @return void
* @return void
*/
private function applyBundlePrice($priceTable): void
{
Expand Down Expand Up @@ -699,7 +707,7 @@ private function getMainTable($dimensions)
/**
* Get connection
*
* return \Magento\Framework\DB\Adapter\AdapterInterface
* @return \Magento\Framework\DB\Adapter\AdapterInterface
* @throws \DomainException
*/
private function getConnection(): \Magento\Framework\DB\Adapter\AdapterInterface
Expand Down
Loading

0 comments on commit bb3cede

Please sign in to comment.