Skip to content

Commit

Permalink
rename bundle class, make bundle installable under contao 5
Browse files Browse the repository at this point in the history
  • Loading branch information
koertho committed Oct 31, 2023
1 parent d058008 commit 94c705b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 35 deletions.
8 changes: 2 additions & 6 deletions src/Asset/PageEntrypoints.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@

namespace HeimrichHannot\EncoreBundle\Asset;

use Contao\Database;
use Contao\LayoutModel;
use Contao\PageModel;
use Contao\StringUtil;
use Exception;
use HeimrichHannot\EncoreBundle\Collection\EntryCollection;
use HeimrichHannot\EncoreBundle\Helper\ArrayHelper;
use HeimrichHannot\UtilsBundle\Util\Utils;
use Symfony\Component\DependencyInjection\ContainerInterface;

class PageEntrypoints
{
Expand All @@ -27,17 +25,15 @@ class PageEntrypoints

protected $initialized = false;

private ContainerInterface $container;
private FrontendAsset $frontendAsset;
private EntryCollection $entryCollection;
private Utils $utils;

/**
* PageEntrypoints constructor.
*/
public function __construct(ContainerInterface $container, FrontendAsset $frontendAsset, EntryCollection $entryCollection, Utils $utils)
public function __construct(FrontendAsset $frontendAsset, EntryCollection $entryCollection, Utils $utils)
{
$this->container = $container;
$this->frontendAsset = $frontendAsset;
$this->entryCollection = $entryCollection;
$this->utils = $utils;
Expand Down Expand Up @@ -168,7 +164,7 @@ public function getActiveEntries(): array
*/
public function createInstance()
{
return new self($this->container, $this->frontendAsset, $this->entryCollection, $this->utils);
return new self($this->frontendAsset, $this->entryCollection, $this->utils);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/ContaoManager/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Contao\ManagerPlugin\Config\ConfigPluginInterface;
use HeimrichHannot\EncoreBundle\HeimrichHannotContaoEncoreBundle;
use HeimrichHannot\EncoreBundle\HeimrichHannotEncoreBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\WebpackEncoreBundle\WebpackEncoreBundle;

Expand All @@ -26,7 +26,7 @@ public function getBundles(ParserInterface $parser): array
{
return [
BundleConfig::create(WebpackEncoreBundle::class),
BundleConfig::create(HeimrichHannotContaoEncoreBundle::class)->setLoadAfter([ContaoCoreBundle::class]),
BundleConfig::create(HeimrichHannotEncoreBundle::class)->setLoadAfter([ContaoCoreBundle::class]),
];
}

Expand All @@ -35,7 +35,7 @@ public function getBundles(ParserInterface $parser): array
*/
public function registerContainerConfiguration(LoaderInterface $loader, array $managerConfig)
{
$loader->load('@HeimrichHannotContaoEncoreBundle/config/config.yml');
$loader->load('@HeimrichHannotContaoEncoreBundle/config/services.yml');
$loader->load('@HeimrichHannotEncoreBundle/config/config.yml');
$loader->load('@HeimrichHannotEncoreBundle/config/services.yml');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,27 @@
use HeimrichHannot\EncoreBundle\DependencyInjection\EncoreConfigCompilerPass;
use HeimrichHannot\EncoreBundle\DependencyInjection\EncoreExtension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;

class HeimrichHannotContaoEncoreBundle extends Bundle
class HeimrichHannotEncoreBundle extends Bundle
{
/**
* {@inheritdoc}
*/
public function getContainerExtension()
public function getContainerExtension(): ?ExtensionInterface
{
return new EncoreExtension();
}

public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
parent::build($container);

$container->addCompilerPass(new EncoreConfigCompilerPass());
}

public function getPath()
public function getPath(): string
{
return \dirname(__DIR__);
}
Expand Down
21 changes: 0 additions & 21 deletions tests/HeimrichHannotContaoEncoreBundleTest.php

This file was deleted.

21 changes: 21 additions & 0 deletions tests/HeimrichHannotEncoreBundleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

/*
* Copyright (c) 2021 Heimrich & Hannot GmbH
*
* @license LGPL-3.0-or-later
*/

namespace HeimrichHannot\EncoreBundle\Test;

use Contao\TestCase\ContaoTestCase;
use HeimrichHannot\EncoreBundle\HeimrichHannotEncoreBundle;

class HeimrichHannotEncoreBundleTest extends ContaoTestCase
{
public function testCanBeInstantiated()
{
$bundle = new HeimrichHannotEncoreBundle();
$this->assertInstanceOf(HeimrichHannotEncoreBundle::class, $bundle);
}
}

0 comments on commit 94c705b

Please sign in to comment.