Skip to content

Commit

Permalink
AITCORE-4: Update price format in component
Browse files Browse the repository at this point in the history
* Fix issue: Deprecated Functionality: NumberFormatter::setAttribute(): Passing null to parameter #2 ($value) of type int|float is deprecated in /var/www/html/vendor/magento/module-directory/Model/Currency.php on line 497
* Rearrange imports
* Add `@throws` to method annotation
* Fix is safe because the method's default `$precision` [appeared in Magento 2.0.0](https://github.com/magento/magento2/blame/0f9a056c8d83c4f319626b3e56ec52a533999f25/lib/internal/Magento/Framework/Pricing/PriceCurrencyInterface.php#L53)
  • Loading branch information
Arkadij Kuzhel authored and DanGarner committed Apr 27, 2022
1 parent cfdce78 commit e4becaf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Components/Ui/Component/Listing/Column/Price.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Aitoc\Core\Components\Ui\Component\Listing\Column;

use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Framework\View\Element\UiComponent\ContextInterface;
use Magento\Framework\View\Element\UiComponentFactory;
use Magento\Ui\Component\Listing\Columns\Column;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Store\Model\StoreManagerInterface;
use Magento\Ui\Component\Listing\Columns\Column;

class Price extends Column
{
Expand Down Expand Up @@ -37,7 +37,9 @@ public function __construct(
* Prepare Data Source
*
* @param array $dataSource
*
* @return array
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function prepareDataSource(array $dataSource)
{
Expand All @@ -48,7 +50,7 @@ public function prepareDataSource(array $dataSource)
$item[$this->getData('name')] = $this->priceFormatter->format(
$item[$this->getData('name')],
false,
null,
\Magento\Framework\Pricing\PriceCurrencyInterface::DEFAULT_PRECISION,
null,
$currencyCode
);
Expand Down

0 comments on commit e4becaf

Please sign in to comment.