Skip to content

Instantly share code, notes, and snippets.

@PhilinTv
Last active November 13, 2024 10:07
Show Gist options
  • Save PhilinTv/599cb09583961b2f3d3e6bf4ebecf855 to your computer and use it in GitHub Desktop.
Save PhilinTv/599cb09583961b2f3d3e6bf4ebecf855 to your computer and use it in GitHub Desktop.
class CheckoutDependencyProvider extends AbstractBundleDependencyProvider
{
public function provideBusinessLayerDependencies(Container $container)
{
$container->set(static::CHECKOUT_PRE_SAVE_HOOKS, function (Container $container) {
return [
new class implements CheckoutPreSaveHookInterface {
public function execute(CheckoutResponseTransfer $checkoutResponseTransfer, QuoteTransfer $quoteTransfer): CheckoutResponseTransfer
{
return $checkoutResponseTransfer;
}
},
];
}, 'only on Monday tag');
}
}
//In the Biz Factory
$this->getProvidedDependency(CheckoutDependencyProvider::CHECKOUT_PRE_SAVE_HOOKS); //no tag plugins
$this->getProvidedDependency(CheckoutDependencyProvider::CHECKOUT_PRE_SAVE_HOOKS, 'only on Monday tag'); //only tagged
//or in the logic
$container->get(CheckoutDependencyProvider::CHECKOUT_PRE_SAVE_HOOKS); //no tag plugins
$container->get(CheckoutDependencyProvider::CHECKOUT_PRE_SAVE_HOOKS, 'only on Monday tag'); //only tagged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment