Skip to content

Commit

Permalink
TE-10179 Replace direct usage of Store.php with corresponding Facades…
Browse files Browse the repository at this point in the history
… and Get rid of APPLICATION_STORE global constant usage. (#8929)

TE-10179 Dynamic Store | Backend Modules
  • Loading branch information
Dmytro Dymarchuk authored Jan 4, 2022
1 parent 6735c4b commit ce744e3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,10 @@ public function onKernelController(ControllerEvent $event): void
$this->monitoringService->setTransactionName($transactionName);
$this->monitoringService->addCustomParameter('request_uri', $requestUri);
$this->monitoringService->addCustomParameter('host', $host);
$this->monitoringService->addCustomParameter('store', $this->storeFacade->getStore()->getName());
$this->monitoringService->addCustomParameter('locale', $this->localeFacade->getCurrentLocale()->getLocaleName());

$this->addStore();

if ($this->isTransactionIgnorable($transactionName)) {
$this->monitoringService->markIgnoreTransaction();
}
Expand Down Expand Up @@ -139,4 +140,16 @@ public static function getSubscribedEvents(): array
KernelEvents::CONTROLLER => ['onKernelController', static::PRIORITY],
];
}

/**
* @deprecated Will be removed without replacement.
*
* @return void
*/
protected function addStore(): void
{
if (defined('APPLICATION_STORE')) {
$this->monitoringService->addCustomParameter('store', $this->storeFacade->getCurrentStore()->getName());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct($storeFacade)
/**
* @return \Generated\Shared\Transfer\StoreTransfer
*/
public function getStore(): StoreTransfer
public function getCurrentStore(): StoreTransfer
{
return $this->storeFacade->getCurrentStore();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@

namespace Spryker\Zed\Monitoring\Dependency\Facade;

use Generated\Shared\Transfer\StoreTransfer;

interface MonitoringToStoreFacadeInterface
{
/**
* @return \Generated\Shared\Transfer\StoreTransfer
*/
public function getStore(): StoreTransfer;
public function getCurrentStore();
}

0 comments on commit ce744e3

Please sign in to comment.