Skip to content

Commit

Permalink
SCA & pint
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentBean committed Nov 13, 2024
1 parent 10d4c3c commit 5434d53
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/Jobs/Product/RetrieveProductJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
4 changes: 3 additions & 1 deletion src/Jobs/Product/SaveProductJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
4 changes: 3 additions & 1 deletion src/Jobs/ProductModel/RetrieveProductModelJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down
7 changes: 5 additions & 2 deletions src/Jobs/ProductModel/SaveProductModelJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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());
}
}

0 comments on commit 5434d53

Please sign in to comment.