Skip to content

Commit

Permalink
Merge branch '2.3-develop' of github.com:magento/graphql-ce into 2.3-…
Browse files Browse the repository at this point in the history
…develop#354
  • Loading branch information
XxXgeoXxX committed Feb 15, 2019
2 parents 8fafd29 + 3b2e305 commit 584b8f8
Show file tree
Hide file tree
Showing 175 changed files with 4,236 additions and 856 deletions.
18 changes: 16 additions & 2 deletions app/code/Magento/AsynchronousOperations/Model/MassConsumer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
namespace Magento\AsynchronousOperations\Model;

use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Registry;
use Psr\Log\LoggerInterface;
use Magento\Framework\MessageQueue\MessageLockException;
use Magento\Framework\MessageQueue\ConnectionLostException;
Expand Down Expand Up @@ -58,6 +59,11 @@ class MassConsumer implements ConsumerInterface
*/
private $operationProcessor;

/**
* @var Registry
*/
private $registry;

/**
* Initialize dependencies.
*
Expand All @@ -67,14 +73,16 @@ class MassConsumer implements ConsumerInterface
* @param ConsumerConfigurationInterface $configuration
* @param OperationProcessorFactory $operationProcessorFactory
* @param LoggerInterface $logger
* @param Registry $registry
*/
public function __construct(
CallbackInvoker $invoker,
ResourceConnection $resource,
MessageController $messageController,
ConsumerConfigurationInterface $configuration,
OperationProcessorFactory $operationProcessorFactory,
LoggerInterface $logger
LoggerInterface $logger,
Registry $registry = null
) {
$this->invoker = $invoker;
$this->resource = $resource;
Expand All @@ -84,20 +92,26 @@ public function __construct(
'configuration' => $configuration
]);
$this->logger = $logger;
$this->registry = $registry ?? \Magento\Framework\App\ObjectManager::getInstance()
->get(Registry::class);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function process($maxNumberOfMessages = null)
{
$this->registry->register('isSecureArea', true, true);

$queue = $this->configuration->getQueue();

if (!isset($maxNumberOfMessages)) {
$queue->subscribe($this->getTransactionCallback($queue));
} else {
$this->invoker->invoke($queue, $maxNumberOfMessages, $this->getTransactionCallback($queue));
}

$this->registry->unregister('isSecureArea');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ $isElementReadonly = $block->getElement()
->getReadonly();
?>

<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)) { ?>
<?php if (!($attributeCode === 'price' && $block->getCanReadPrice() === false)): ?>
<div class="<?= /* @escapeNotVerified */ $attributeCode ?> "><?= /* @escapeNotVerified */ $elementHtml ?></div>
<?php } ?>
<?php endif; ?>

<?= $block->getExtendedElement($switchAttributeCode)->toHtml() ?>

Expand All @@ -43,13 +43,13 @@ $isElementReadonly = $block->getElement()
} else {
if ($attribute) {
<?php if ($attributeCode === 'price' && !$block->getCanEditPrice() && $block->getCanReadPrice()
&& $block->getProduct()->isObjectNew()) { ?>
&& $block->getProduct()->isObjectNew()): ?>
<?php $defaultProductPrice = $block->getDefaultProductPrice() ?: "''"; ?>
$attribute.value = <?= /* @escapeNotVerified */ $defaultProductPrice ?>;
<?php } else { ?>
<?php else: ?>
$attribute.disabled = false;
$attribute.addClassName('required-entry');
<?php } ?>
<?php endif; ?>
}
if ($('dynamic-price-warning')) {
$('dynamic-price-warning').hide();
Expand All @@ -58,9 +58,9 @@ $isElementReadonly = $block->getElement()
}

<?php if (!($attributeCode === 'price' && !$block->getCanEditPrice()
&& !$block->getProduct()->isObjectNew())) { ?>
&& !$block->getProduct()->isObjectNew())): ?>
$('<?= /* @escapeNotVerified */ $switchAttributeCode ?>').observe('change', <?= /* @escapeNotVerified */ $switchAttributeCode ?>_change);
<?php } ?>
<?php endif; ?>
Event.observe(window, 'load', function(){
<?= /* @escapeNotVerified */ $switchAttributeCode ?>_change();
});
Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/Catalog/Block/Product/View/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
use Magento\Framework\Pricing\PriceCurrencyInterface;

/**
* Attributes attributes block
*
* @api
* @since 100.0.2
*/
Expand Down Expand Up @@ -56,6 +58,8 @@ public function __construct(
}

/**
* Returns a Product
*
* @return Product
*/
public function getProduct()
Expand Down Expand Up @@ -88,7 +92,7 @@ public function getAdditionalData(array $excludeAttr = [])
$value = $this->priceCurrency->convertAndFormat($value);
}

if (is_string($value) && strlen($value)) {
if (is_string($value) && strlen(trim($value))) {
$data[$attribute->getAttributeCode()] = [
'label' => __($attribute->getStoreLabel()),
'value' => $value,
Expand Down
6 changes: 4 additions & 2 deletions app/code/Magento/Catalog/Block/Ui/ProductViewCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
/**
* Reports Viewed Products Counter
*
* The main responsilibity of this class is provide necessary data to track viewed products
* by customer on frontend and data to synchornize this tracks with backend
* The main responsibility of this class is provide necessary data to track viewed products
* by customer on frontend and data to synchronize this tracks with backend
*
* @api
* @since 101.1.0
Expand Down Expand Up @@ -109,6 +109,8 @@ public function __construct(
*
* @return string {JSON encoded data}
* @since 101.1.0
* @throws \Magento\Framework\Exception\LocalizedException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getCurrentProductData()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function execute()
$attributeCode
);

if ($attribute->getId() && !$attributeId || $attributeCode === 'product_type') {
if ($attribute->getId() && !$attributeId || $attributeCode === 'product_type' || $attributeCode === 'type_id') {
$message = strlen($this->getRequest()->getParam('attribute_code'))
? __('An attribute with this code already exists.')
: __('An attribute with the same code (%1) already exists.', $attributeCode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

use Magento\Framework\App\ResourceConnection;

/**
* Abstract action class for category flat indexers.
*/
class AbstractAction
{
/**
Expand Down Expand Up @@ -130,7 +133,7 @@ protected function getFlatTableStructure($tableName)
$table = $this->connection->newTable(
$tableName
)->setComment(
sprintf("Catalog Category Flat", $tableName)
'Catalog Category Flat'
);

//Adding columns
Expand Down Expand Up @@ -378,7 +381,7 @@ protected function getAttributeValues($entityIds, $storeId)
$linkField = $this->getCategoryMetadata()->getLinkField();
foreach ($attributesType as $type) {
foreach ($this->getAttributeTypeValues($type, $entityIds, $storeId) as $row) {
if (isset($row[$linkField]) && isset($row['attribute_id'])) {
if (isset($row[$linkField], $row['attribute_id'])) {
$attributeId = $row['attribute_id'];
if (isset($attributes[$attributeId])) {
$attributeCode = $attributes[$attributeId]['attribute_code'];
Expand Down Expand Up @@ -496,6 +499,8 @@ protected function getTableName($name)
}

/**
* Get category metadata instance.
*
* @return \Magento\Framework\EntityManager\EntityMetadata
*/
private function getCategoryMetadata()
Expand All @@ -509,6 +514,8 @@ private function getCategoryMetadata()
}

/**
* Get skip static columns instance.
*
* @return array
*/
private function getSkipStaticColumns()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ protected function _isApplicableAttribute($object, $attribute)
*/
protected function _isCallableAttributeInstance($instance, $method, $args)
{
if ($instance instanceof \Magento\Eav\Model\Entity\Attribute\Backend\AbstractBackend
if ($instance instanceof AbstractBackend
&& ($method == 'beforeSave' || $method == 'afterSave')
) {
$attributeCode = $instance->getAttribute()->getAttributeCode();
Expand Down Expand Up @@ -491,7 +491,7 @@ protected function _canUpdateAttribute(AbstractAttribute $attribute, $value, arr
* Retrieve attribute's raw value from DB.
*
* @param int $entityId
* @param int|string|array $attribute atrribute's ids or codes
* @param int|string|array $attribute attribute's ids or codes
* @param int|\Magento\Store\Model\Store $store
* @return bool|string|array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public function modifyPrice(IndexTableStructure $priceTable, array $entityIds =
}

/**
* Check if custom options exist.
*
* @param IndexTableStructure $priceTable
* @return bool
* @throws \Exception
Expand Down Expand Up @@ -154,6 +156,8 @@ private function checkIfCustomOptionsExist(IndexTableStructure $priceTable): boo
}

/**
* Get connection.
*
* @return \Magento\Framework\DB\Adapter\AdapterInterface
*/
private function getConnection()
Expand Down Expand Up @@ -211,7 +215,7 @@ private function getSelectForOptionsWithMultipleValues(string $sourceTable): Sel
} else {
$select->joinLeft(
['otps' => $this->getTable('catalog_product_option_type_price')],
'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cwd.default_store_id',
'otps.option_type_id = otpd.option_type_id AND otps.store_id = cwd.default_store_id',
[]
);

Expand Down Expand Up @@ -373,6 +377,8 @@ private function getSelectAggregated(string $sourceTable): Select
}

/**
* Get select for update.
*
* @param string $sourceTable
* @return \Magento\Framework\DB\Select
*/
Expand Down Expand Up @@ -402,6 +408,8 @@ private function getSelectForUpdate(string $sourceTable): Select
}

/**
* Get table name.
*
* @param string $tableName
* @return string
*/
Expand All @@ -411,6 +419,8 @@ private function getTable(string $tableName): string
}

/**
* Is price scope global.
*
* @return bool
*/
private function isPriceGlobal(): bool
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

/**
* Default Product Type Price Indexer Resource model
*
* For correctly work need define product type id
*
* @api
Expand Down Expand Up @@ -208,6 +209,8 @@ public function reindexEntity($entityIds)
}

/**
* Reindex prices.
*
* @param null|int|array $entityIds
* @return \Magento\Catalog\Model\ResourceModel\Product\Indexer\Price\DefaultPrice
*/
Expand Down Expand Up @@ -604,7 +607,7 @@ protected function _applyCustomOption()
[]
)->joinLeft(
['otps' => $this->getTable('catalog_product_option_type_price')],
'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cs.store_id',
'otps.option_type_id = otpd.option_type_id AND otps.store_id = cs.store_id',
[]
)->group(
['i.entity_id', 'i.customer_group_id', 'i.website_id', 'o.option_id']
Expand Down Expand Up @@ -802,6 +805,8 @@ public function getIdxTable($table = null)
}

/**
* Check if product exists.
*
* @return bool
*/
protected function hasEntity()
Expand All @@ -823,6 +828,8 @@ protected function hasEntity()
}

/**
* Get total tier price expression.
*
* @param \Zend_Db_Expr $priceExpression
* @return \Zend_Db_Expr
*/
Expand Down Expand Up @@ -863,6 +870,8 @@ private function getTotalTierPriceExpression(\Zend_Db_Expr $priceExpression)
}

/**
* Get tier price expression for table.
*
* @param string $tableAlias
* @param \Zend_Db_Expr $priceExpression
* @return \Zend_Db_Expr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use Magento\Framework\DB\Select;
use Magento\Store\Model\Store;

/**
* Provide Select object for retrieve product id with minimal price.
*/
class LinkedProductSelectBuilderByBasePrice implements LinkedProductSelectBuilderInterface
{
/**
Expand Down Expand Up @@ -69,7 +72,7 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function build($productId)
{
Expand All @@ -85,7 +88,7 @@ public function build($productId)
[]
)->joinInner(
[BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable],
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS, $linkField),
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
['entity_id']
)->joinInner(
['t' => $priceAttribute->getBackendTable()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@

<fillField stepKey="fillCategoryName" selector="{{AdminProductCategoryCreationSection.nameInput}}" userInput="{{categoryName}}"/>

<!-- Search and select a parent catagory for the product -->
<!-- Search and select a parent category for the product -->
<click stepKey="clickParentCategory" selector="{{AdminProductCategoryCreationSection.parentCategory}}"/>
<waitForPageLoad stepKey="waitForDropDownVisible"/>
<fillField stepKey="searchForParent" userInput="{{parentCategoryName}}" selector="{{AdminProductCategoryCreationSection.parentSearch}}"/>
Expand Down
Loading

0 comments on commit 584b8f8

Please sign in to comment.