PHP code example of k10r / klarna-ordermanagement

1. Go to this page and download the library: Download k10r/klarna-ordermanagement library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

k10r / klarna-ordermanagement example snippets


public function build(ContainerBuilder $containerBuilder)
{
    parent::build($containerBuilder);

    $containerBuilder->setParameter('bestit_klarna.plugin_name', 'ExamplePluginName');
}

public function build(ContainerBuilder $containerBuilder)
{
    parent::build($containerBuilder);

    //

    $dependencyInjectionExtensions = [
        \BestitKlarnaOrderManagement\Components\DependencyInjection\DependencyInjectionExtension::class
    ];

    foreach ($dependencyInjectionExtensions as $dependencyInjectionExtension) {
        if (!class_exists($dependencyInjectionExtension)) {
            continue;
        }

        $dependencyInjectionExtension = new $dependencyInjectionExtension();

        if (!$dependencyInjectionExtension instanceof \BestitKlarnaOrderManagement\Components\DependencyInjection\DependencyInjectionExtensionInterface) {
            continue;
        }

        $dependencyInjectionExtension->injectDependencies($containerBuilder);
    }
}

public function install(InstallContext $context)
{
    // ...

    $this->getOmInstaller()->install($this, $context);

    // ...
}

public function uninstall(UninstallContext $context)
{
    // ...

    $this->getOmInstaller()->uninstall($this, $context);

    // ...
}

public function update(UpdateContext $context)
{
    // ...

    $this->getOmInstaller()->update($this, $context);

    // ...
}

protected function getOmInstaller()
{
    if ($this->omInstaller !== null) {
        return $this->omInstaller;
    }

    $this->omInstaller = new OmInstaller($this->container->get('shopware.snippet_database_handler'));

    return $this->omInstaller;
}