Skip to content

spryker-community/spryker-autowiring

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autowiring for Spryker

#Hackweekender2023

Installation

Install it with composer

composer require hackweekender-aw/spryker-autowiring

Add a namespace to your config

$config[KernelConstants::CORE_NAMESPACES] = [
    [...]
    'AW'
];

Usage

Yves

  • Include \AW\Yves\Kernel\ClassResolverAwareTrait in the controller
  • Call $this->resolveClass(AmazingYvesClass::class)->yourAmazingMethod()

Client

  • Include \AW\Client\Kernel\ClassResolverAwareTrait in the client
  • Call $this->resolveClass(AmazingClientClass::class)->yourAmazingMethod()

Zed

  • Include \AW\Zed\Kernel\ClassResolverAwareTrait in the facade
  • Call $this->resolveClass(AmazingZedClass::class)->yourAmazingMethod()

Manually configure DI

public function getDependencyInjectionConfig(): array
{
    return [
        AmazingCartOperationInterface::class => DI\autowire(AmazingCartOperation::class)
            ->constructorParameter('postOperationPlugins', $this->getPostOperationPlugins())
    ];
}

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%