Skip to content

Commit

Permalink
Merge branch 2.3-develop into ENGCOM-3810-magento-magento2-20001
Browse files Browse the repository at this point in the history
  • Loading branch information
magento-engcom-team committed Mar 6, 2019
2 parents fb80748 + 75cf826 commit 1f9bf2b
Show file tree
Hide file tree
Showing 161 changed files with 4,813 additions and 1,005 deletions.
3 changes: 2 additions & 1 deletion app/code/Magento/Backend/App/Request/BackendValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,9 @@ private function createException(
$exception = new InvalidRequestException($response);
} else {
//For regular requests.
$startPageUrl = $this->backendUrl->getStartupPageUrl();
$response = $this->redirectFactory->create()
->setUrl($this->backendUrl->getStartupPageUrl());
->setUrl($this->backendUrl->getUrl($startPageUrl));
$exception = new InvalidRequestException(
$response,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

namespace Magento\Backend\Block\System\Design\Edit\Tab;

/**
* General system tab block.
*/
class General extends \Magento\Backend\Block\Widget\Form\Generic
{
/**
Expand Down Expand Up @@ -90,7 +93,7 @@ protected function _prepareForm()
]
);

$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
$dateFormat = $this->_localeDate->getDateFormatWithLongYear();
$fieldset->addField(
'date_from',
'date',
Expand Down
23 changes: 17 additions & 6 deletions app/code/Magento/Catalog/Block/Product/ListProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,9 @@ private function getDefaultListingMode()
}

/**
* Need use as _prepareLayout - but problem in declaring collection from
* another block (was problem with search result)
* Need use as _prepareLayout - but problem in declaring collection from another block.
* (was problem with search result)
*
* @return $this
*/
protected function _beforeToHtml()
Expand All @@ -188,7 +189,9 @@ protected function _beforeToHtml()

$this->addToolbarBlock($collection);

$collection->load();
if (!$collection->isLoaded()) {
$collection->load();
}

return parent::_beforeToHtml();
}
Expand Down Expand Up @@ -262,6 +265,8 @@ public function getToolbarHtml()
}

/**
* Set collection.
*
* @param AbstractCollection $collection
* @return $this
*/
Expand All @@ -272,7 +277,9 @@ public function setCollection($collection)
}

/**
* @param array|string|integer| Element $code
* Add attribute.
*
* @param array|string|integer|Element $code
* @return $this
*/
public function addAttribute($code)
Expand All @@ -282,6 +289,8 @@ public function addAttribute($code)
}

/**
* Get price block template.
*
* @return mixed
*/
public function getPriceBlockTemplate()
Expand Down Expand Up @@ -371,6 +380,8 @@ public function getAddToCartPostParams(Product $product)
}

/**
* Get product price.
*
* @param Product $product
* @return string
*/
Expand All @@ -396,8 +407,8 @@ public function getProductPrice(Product $product)
}

/**
* Specifies that price rendering should be done for the list of products
* i.e. rendering happens in the scope of product list, but not single product
* Specifies that price rendering should be done for the list of products.
* (rendering happens in the scope of product list, but not single product)
*
* @return Render
*/
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Product/View/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getAdditionalData(array $excludeAttr = [])

if (is_string($value) && strlen(trim($value))) {
$data[$attribute->getAttributeCode()] = [
'label' => __($attribute->getStoreLabel()),
'label' => $attribute->getStoreLabel(),
'value' => $value,
'code' => $attribute->getAttributeCode(),
];
Expand Down
18 changes: 16 additions & 2 deletions app/code/Magento/Catalog/Controller/Adminhtml/Product/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Controller\Adminhtml\Product;

use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\ProductFactory;
use Magento\Cms\Model\Wysiwyg as WysiwygModel;
use Magento\Framework\App\RequestInterface;
Expand All @@ -15,6 +18,11 @@
use Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product\Type as ProductTypes;

/**
* Build a product based on a request
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Builder
{
/**
Expand Down Expand Up @@ -79,10 +87,11 @@ public function __construct(
* Build product based on user request
*
* @param RequestInterface $request
* @return \Magento\Catalog\Model\Product
* @return ProductInterface
* @throws \RuntimeException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function build(RequestInterface $request)
public function build(RequestInterface $request): ProductInterface
{
$productId = (int) $request->getParam('id');
$storeId = $request->getParam('store', 0);
Expand All @@ -92,6 +101,9 @@ public function build(RequestInterface $request)
if ($productId) {
try {
$product = $this->productRepository->getById($productId, true, $storeId);
if ($attributeSetId) {
$product->setAttributeSetId($attributeSetId);
}
} catch (\Exception $e) {
$product = $this->createEmptyProduct(ProductTypes::DEFAULT_TYPE, $attributeSetId, $storeId);
$this->logger->critical($e);
Expand All @@ -113,6 +125,8 @@ public function build(RequestInterface $request)
}

/**
* Create a product with the given properties
*
* @param int $typeId
* @param int $attributeSetId
* @param int $storeId
Expand Down
Loading

0 comments on commit 1f9bf2b

Please sign in to comment.