diff --git a/src/Jobs/Product/RetrieveProductJob.php b/src/Jobs/Product/RetrieveProductJob.php index 64979c0..9bf2e58 100644 --- a/src/Jobs/Product/RetrieveProductJob.php +++ b/src/Jobs/Product/RetrieveProductJob.php @@ -49,7 +49,9 @@ public function failed(Throwable $throwable): void $model?->failed(); activity() - ->when($model !== null, fn (ActivityLogger $logger): ActivityLogger => $logger->on($model)) + ->when($model, function (ActivityLogger $logger, Product $product): ActivityLogger { + return $logger->on($product); + }) ->useLog('error') ->log('Failed to retrieve the product: '.$throwable->getMessage()); } diff --git a/src/Jobs/Product/SaveProductJob.php b/src/Jobs/Product/SaveProductJob.php index 14b4960..477c8f7 100644 --- a/src/Jobs/Product/SaveProductJob.php +++ b/src/Jobs/Product/SaveProductJob.php @@ -50,7 +50,9 @@ public function failed(Throwable $throwable): void $model?->failed(); activity() - ->when($model !== null, fn (ActivityLogger $logger): ActivityLogger => $logger->on($model)) + ->when($model, function (ActivityLogger $logger, Product $product): ActivityLogger { + return $logger->on($product); + }) ->useLog('error') ->withProperties([ 'message' => $throwable->getMessage(), diff --git a/src/Jobs/ProductModel/RetrieveProductModelJob.php b/src/Jobs/ProductModel/RetrieveProductModelJob.php index 3a552f3..9edb829 100644 --- a/src/Jobs/ProductModel/RetrieveProductModelJob.php +++ b/src/Jobs/ProductModel/RetrieveProductModelJob.php @@ -49,7 +49,9 @@ public function failed(Throwable $throwable): void $model?->failed(); activity() - ->when($model !== null, fn (ActivityLogger $logger): ActivityLogger => $logger->on($model)) + ->when($model, function (ActivityLogger $logger, ProductModel $productModel): ActivityLogger { + return $logger->on($productModel); + }) ->useLog('error') ->log('Failed to retrieve the productmodel: '.$throwable->getMessage()); } diff --git a/src/Jobs/ProductModel/SaveProductModelJob.php b/src/Jobs/ProductModel/SaveProductModelJob.php index e6412a8..941ad45 100644 --- a/src/Jobs/ProductModel/SaveProductModelJob.php +++ b/src/Jobs/ProductModel/SaveProductModelJob.php @@ -10,6 +10,7 @@ use JustBetter\AkeneoProducts\Contracts\ProductModel\SavesProductModel; use JustBetter\AkeneoProducts\Data\ProductModelData; use JustBetter\AkeneoProducts\Models\ProductModel; +use JustBetter\MagentoPrices\Models\Price; use Spatie\Activitylog\ActivityLogger; use Throwable; @@ -50,8 +51,10 @@ public function failed(Throwable $throwable): void $model?->failed(); activity() - ->when($model !== null, fn (ActivityLogger $logger): ActivityLogger => $logger->on($model)) + ->when($model, function (ActivityLogger $logger, ProductModel $productModel): ActivityLogger { + return $logger->on($productModel); + }) ->useLog('error') - ->log('Failed to save the productmodel: ' . $throwable->getMessage()); + ->log('Failed to save the productmodel: '.$throwable->getMessage()); } }