Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecommerce Framework | Pass tenant config to isActive method in product #4923

Open
andreas-gruenwald opened this issue Sep 3, 2019 · 0 comments

Comments

@andreas-gruenwald
Copy link
Contributor

commented Sep 3, 2019

Feature Request

Sometimes it is necessary to access the current tenant name or the tenant configuration in the isActive() method of a product on index building.

Currently this is not possible, as the tenant context is not passed to the product.

Compare

public function isActive($inProductList = false);

I used a hack to access the tenant configuration:

$tenantName = Factory::getInstance()->getEnvironment()->getCurrentAssortmentTenant(); //is null in CLIs, such as the indexservice bootstrap command.
if (empty($tenantName)) {
   $traceLog = debug_backtrace();
   foreach ($traceLog as $trace) {
   $object = $trace['object'];
   if ($object instanceof IWorker) {
      $tenantName = $object->getTenantConfig()->getTenantName();
      break;
   }
}

However, it would be better to have the possibility to access the tenant, e.g. via

Factory::getInstance()->getEnvironment()->getCurrentAssortmentTenant();
```, or an additional method argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.