Skip to content

Commit

Permalink
Fix DI compilation due to 3.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
jissereitsma committed Feb 1, 2024
1 parent b2b9c40 commit 79e06df
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 91 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [3.7.7] - 1 February 2024
### Fixed
- Fix DI compilation due to 3.7.6

## [3.7.6] - 1 February 2024
### Fixed
- Refactor loading performance of product data and category data in cart

Expand Down
13 changes: 6 additions & 7 deletions DataLayer/Tag/Product/ProductCategory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
namespace Yireo\GoogleTagManager2\DataLayer\Tag\Product;

use Magento\Catalog\Api\Data\CategoryInterface;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\Category;
use Magento\Catalog\Model\Product;
use Magento\Framework\Exception\NoSuchEntityException;
use Yireo\GoogleTagManager2\Util\GetCategoryFromProduct;
use Yireo\GoogleTagManager2\Util\CategoryProvider;

class ProductCategory implements ProductTagInterface
{
private Product $product;
private GetCategoryFromProduct $getCategoryFromProduct;
private CategoryProvider $categoryProvider;

/**
* @param GetCategoryFromProduct $getCategoryFromProduct
* @param CategoryProvider $categoryProvider
*/
public function __construct(
GetCategoryFromProduct $getCategoryFromProduct
CategoryProvider $categoryProvider
) {
$this->getCategoryFromProduct = $getCategoryFromProduct;
$this->categoryProvider = $categoryProvider;
}

/**
Expand All @@ -45,7 +44,7 @@ public function get(): string
}

try {
return $this->getCategoryFromProduct->get($this->product)->getName();
return $this->categoryProvider->getFirstByProduct($this->product)->getName();
} catch (NoSuchEntityException $e) {
return '';
}
Expand Down
83 changes: 0 additions & 83 deletions Test/Integration/Util/GetCategoryFromProductTest.php

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yireo/magento2-googletagmanager2",
"version": "3.7.6",
"version": "3.7.7",
"license": "OSL-3.0",
"type": "magento2-module",
"homepage": "https://www.yireo.com/software/magento-extensions/googletagmanager2",
Expand Down

0 comments on commit 79e06df

Please sign in to comment.