Skip to content

Commit 0af4cfc

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-50620-GlobalSearchEntityTestVariation4-failure
2 parents c7f72c1 + 6352f8f commit 0af4cfc

File tree

553 files changed

+7659
-6288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

553 files changed

+7659
-6288
lines changed

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -985,14 +985,14 @@ private function invokeMethod($object, $method, $args = [])
985985
private function getAdvancedPricingMock($methods = [])
986986
{
987987
$metadataPoolMock = $this->getMock(
988-
\Magento\Framework\Model\Entity\MetadataPool::class,
988+
\Magento\Framework\EntityManager\MetadataPool::class,
989989
[],
990990
[],
991991
'',
992992
false
993993
);
994994
$metadataMock = $this->getMock(
995-
\Magento\Framework\Model\Entity\EntityMetadata::class,
995+
\Magento\Framework\EntityManager\EntityMetadata::class,
996996
[],
997997
[],
998998
'',

app/code/Magento/Authorizenet/Model/Directpost.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ class Directpost extends \Magento\Authorizenet\Model\Authorizenet implements Tra
119119
*/
120120
protected $transactionRepository;
121121

122+
/**
123+
* @var \Psr\Log\LoggerInterface
124+
*/
125+
private $psrLogger;
126+
122127
/**
123128
* @param \Magento\Framework\Model\Context $context
124129
* @param \Magento\Framework\Registry $registry
@@ -761,7 +766,7 @@ protected function addStatusComment(\Magento\Sales\Model\Order\Payment $payment)
761766
{
762767
try {
763768
$transactionId = $this->getResponse()->getXTransId();
764-
$data = $payment->getMethodInstance()->getTransactionDetails($transactionId);
769+
$data = $this->transactionService->getTransactionDetails($this, $transactionId);
765770
$transactionStatus = (string)$data->transaction->transactionStatus;
766771
$fdsFilterAction = (string)$data->transaction->FDSFilterAction;
767772

@@ -779,6 +784,7 @@ protected function addStatusComment(\Magento\Sales\Model\Order\Payment $payment)
779784
$payment->getOrder()->addStatusHistoryComment($message);
780785
}
781786
} catch (\Exception $e) {
787+
$this->getPsrLogger()->critical($e);
782788
//this request is optional
783789
}
784790
return $this;
@@ -805,7 +811,7 @@ protected function declineOrder(\Magento\Sales\Model\Order $order, $message = ''
805811
$order->registerCancellation($message)->save();
806812
} catch (\Exception $e) {
807813
//quiet decline
808-
$this->logger->critical($e);
814+
$this->getPsrLogger()->critical($e);
809815
}
810816
}
811817

@@ -973,4 +979,18 @@ protected function getTransactionResponse($transactionId)
973979

974980
return $response;
975981
}
982+
983+
/**
984+
* @return \Psr\Log\LoggerInterface
985+
*
986+
* @deprecated
987+
*/
988+
private function getPsrLogger()
989+
{
990+
if (null === $this->psrLogger) {
991+
$this->psrLogger = \Magento\Framework\App\ObjectManager::getInstance()
992+
->get(\Psr\Log\LoggerInterface::class);
993+
}
994+
return $this->psrLogger;
995+
}
976996
}

app/code/Magento/Backend/App/BackendAppList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function getCurrentApp()
4444
if ($appName && isset($this->backendApps[$appName])) {
4545
return $this->backendApps[$appName];
4646
}
47+
return null;
4748
}
4849

4950
/**

app/code/Magento/Bundle/Model/LinkManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\App\ObjectManager;
1212
use Magento\Framework\Exception\CouldNotSaveException;
1313
use Magento\Framework\Exception\InputException;
14-
use Magento\Framework\Model\Entity\MetadataPool;
14+
use Magento\Framework\EntityManager\MetadataPool;
1515

1616
/**
1717
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)

app/code/Magento/Bundle/Model/OptionRepository.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\Exception\CouldNotSaveException;
1212
use Magento\Framework\Exception\InputException;
1313
use Magento\Framework\Exception\NoSuchEntityException;
14-
use Magento\Framework\Model\Entity\MetadataPool;
14+
use Magento\Framework\EntityManager\MetadataPool;
1515

1616
/**
1717
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -64,7 +64,7 @@ class OptionRepository implements \Magento\Bundle\Api\ProductOptionRepositoryInt
6464
protected $dataObjectHelper;
6565

6666
/**
67-
* @var \Magento\Framework\Model\Entity\MetadataPool
67+
* @var \Magento\Framework\EntityManager\MetadataPool
6868
*/
6969
private $metadataPool;
7070

app/code/Magento/Bundle/Model/Product/ReadHandler.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
namespace Magento\Bundle\Model\Product;
77

88
use Magento\Bundle\Api\ProductOptionRepositoryInterface as OptionRepository;
9+
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
910

1011
/**
1112
* Class ReadHandler
1213
*/
13-
class ReadHandler
14+
class ReadHandler implements ExtensionInterface
1415
{
1516
/**
1617
* @var OptionRepository
@@ -30,10 +31,11 @@ public function __construct(OptionRepository $optionRepository)
3031
/**
3132
* @param string $entityType
3233
* @param object $entity
34+
* @param array $arguments
3335
* @return \Magento\Catalog\Api\Data\ProductInterface
3436
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
3537
*/
36-
public function execute($entityType, $entity)
38+
public function execute($entityType, $entity, $arguments = [])
3739
{
3840
/** @var $entity \Magento\Catalog\Api\Data\ProductInterface */
3941
if ($entity->getTypeId() != \Magento\Bundle\Model\Product\Type::TYPE_CODE) {

app/code/Magento/Bundle/Model/Product/SaveHandler.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
namespace Magento\Bundle\Model\Product;
88

99
use Magento\Bundle\Api\ProductOptionRepositoryInterface as OptionRepository;
10-
use Magento\Framework\Model\Entity\MetadataPool;
11-
use Magento\Framework\Model\ResourceModel\Db\ProcessEntityRelationInterface;
10+
use Magento\Framework\EntityManager\MetadataPool;
1211
use Magento\Bundle\Api\ProductLinkManagementInterface;
12+
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
1313

1414
/**
1515
* Class SaveHandler
1616
*/
17-
class SaveHandler
17+
class SaveHandler implements ExtensionInterface
1818
{
1919
/**
2020
* @var MetadataPool
@@ -49,10 +49,11 @@ public function __construct(
4949
/**
5050
* @param string $entityType
5151
* @param object $entity
52-
* @return object
52+
* @param array $arguments
53+
* @return \Magento\Catalog\Api\Data\ProductInterface|object
5354
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
5455
*/
55-
public function execute($entityType, $entity)
56+
public function execute($entityType, $entity, $arguments = [])
5657
{
5758
$bundleProductOptions = $entity->getExtensionAttributes()->getBundleProductOptions();
5859
if ($entity->getTypeId() !== 'bundle' || empty($bundleProductOptions)) {

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Stock.php

Lines changed: 10 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -59,33 +59,27 @@ protected function _prepareBundleOptionStockData($entityIds = null, $usePrimaryT
5959
"bo.parent_id = product.$linkField",
6060
[]
6161
);
62-
$this->_addWebsiteJoinToSelect($select, false);
6362
$status = new \Zend_Db_Expr(
6463
'MAX(' . $connection->getCheckSql('e.required_options = 0', 'i.stock_status', '0') . ')'
6564
);
66-
$select->columns(
67-
'website_id',
68-
'cw'
69-
)->join(
65+
$select->join(
7066
['cis' => $this->getTable('cataloginventory_stock')],
7167
'',
72-
['stock_id']
68+
['website_id', 'stock_id']
7369
)->joinLeft(
7470
['bs' => $this->getTable('catalog_product_bundle_selection')],
7571
'bs.option_id = bo.option_id',
7672
[]
7773
)->joinLeft(
7874
['i' => $idxTable],
79-
'i.product_id = bs.product_id AND i.website_id = cw.website_id AND i.stock_id = cis.stock_id',
75+
'i.product_id = bs.product_id AND i.website_id = cis.website_id AND i.stock_id = cis.stock_id',
8076
[]
8177
)->joinLeft(
8278
['e' => $this->getTable('catalog_product_entity')],
8379
'e.entity_id = bs.product_id',
8480
[]
85-
)->where(
86-
'cw.website_id != 0'
8781
)->group(
88-
['product.entity_id', 'cw.website_id', 'cis.stock_id', 'bo.option_id']
82+
['product.entity_id', 'cis.website_id', 'cis.stock_id', 'bo.option_id']
8983
)->columns(
9084
['option_id' => 'bo.option_id', 'status' => $status]
9185
);
@@ -118,45 +112,19 @@ protected function _prepareBundleOptionStockData($entityIds = null, $usePrimaryT
118112
protected function _getStockStatusSelect($entityIds = null, $usePrimaryTable = false)
119113
{
120114
$this->_prepareBundleOptionStockData($entityIds, $usePrimaryTable);
121-
$linkField = $this->getMetadataPool()->getMetadata(ProductInterface::class)->getLinkField();
122115
$connection = $this->getConnection();
123-
$select = $connection->select()->from(
124-
['e' => $this->getTable('catalog_product_entity')],
125-
['entity_id']
126-
);
127-
$this->_addWebsiteJoinToSelect($select, true);
128-
$this->_addProductWebsiteJoinToSelect($select, 'cw.website_id', 'e.entity_id');
129-
$select->columns(
130-
'cw.website_id'
131-
)->join(
132-
['cis' => $this->getTable('cataloginventory_stock')],
133-
'',
134-
['stock_id']
135-
)->joinLeft(
136-
['cisi' => $this->getTable('cataloginventory_stock_item')],
137-
'cisi.stock_id = cis.stock_id AND cisi.product_id = e.entity_id',
138-
[]
116+
$select = parent::_getStockStatusSelect($entityIds, $usePrimaryTable);
117+
$select->reset(
118+
\Magento\Framework\DB\Select::COLUMNS
119+
)->columns(
120+
['e.entity_id', 'cis.website_id', 'cis.stock_id']
139121
)->joinLeft(
140122
['o' => $this->_getBundleOptionTable()],
141-
'o.entity_id = e.entity_id AND o.website_id = cw.website_id AND o.stock_id = cis.stock_id',
123+
'o.entity_id = e.entity_id AND o.website_id = cis.website_id AND o.stock_id = cis.stock_id',
142124
[]
143125
)->columns(
144126
['qty' => new \Zend_Db_Expr('0')]
145-
)->where(
146-
'cw.website_id != 0'
147-
)->where(
148-
'e.type_id = ?',
149-
$this->getTypeId()
150-
)->group(
151-
['e.entity_id', 'cw.website_id', 'cis.stock_id']
152-
);
153-
154-
// add limitation of status
155-
$condition = $connection->quoteInto(
156-
'=?',
157-
\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED
158127
);
159-
$this->_addAttributeToSelect($select, 'status', "e.$linkField", 'cs.store_id', $condition);
160128

161129
$statusExpr = $this->getStatusExpression($connection);
162130
$select->columns(

app/code/Magento/Bundle/Model/ResourceModel/Option.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Bundle\Model\ResourceModel;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9-
use Magento\Framework\Model\Entity\MetadataPool;
9+
use Magento\Framework\EntityManager\MetadataPool;
1010
use Magento\Framework\App\ObjectManager;
1111

1212
/**

app/code/Magento/Bundle/Model/ResourceModel/Selection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\Bundle\Model\ResourceModel;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9-
use Magento\Framework\Model\Entity\MetadataPool;
9+
use Magento\Framework\EntityManager\MetadataPool;
1010
use Magento\Framework\Model\ResourceModel\Db\Context;
1111

1212
/**

0 commit comments

Comments
 (0)