Skip to content

Commit

Permalink
Merge pull request #159 from j0k3r/symfony-3.2.1
Browse files Browse the repository at this point in the history
Change the way to inject ActiveTheme since Symfony 3.2.1
  • Loading branch information
lsmith77 authored Dec 15, 2016
2 parents 2071de9 + 5cd214b commit 2644d14
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,27 @@ env:
- SYMFONY_VERSION=2.7.*

matrix:
fast_finish: true
include:
- php: 5.6
env: SYMFONY_VERSION=2.3.*
- php: 5.6
env: SYMFONY_VERSION=2.8.*
- php: 5.6
env: SYMFONY_VERSION=3.0.*
- php: 5.6
env: SYMFONY_VERSION=3.1.*
- php: 5.6
env: SYMFONY_VERSION=3.2.*
- php: 5.6
env: SYMFONY_VERSION=@dev
- php: 5.6
env: TWIG_VERSION=2.x
- php: 5.3
env: COMPOSER_FLAGS="--prefer-lowest"
allow_failures:
- php: 5.6
env: SYMFONY_VERSION=@dev

before_install:
- if [[ ${TRAVIS_PHP_VERSION} != "hhvm" ]]; then phpenv config-add travis.php.ini; fi;
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Compiler/ThemeCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function process(ContainerBuilder $container)

$twigFilesystemLoaderDefinition = $container->getDefinition('twig.loader.filesystem');
$twigFilesystemLoaderDefinition->setClass($container->getParameter('liip_theme.filesystem_loader.class'));
$twigFilesystemLoaderDefinition->addArgument(new Reference('liip_theme.active_theme'));
$twigFilesystemLoaderDefinition->addMethodCall('setActiveTheme', array(new Reference('liip_theme.active_theme')));
}
}
22 changes: 17 additions & 5 deletions Twig/Loader/FilesystemLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,27 @@ class FilesystemLoader extends \Twig_Loader_Filesystem
/**
* Constructor.
*
* @param FileLocatorInterface $locator A FileLocatorInterface instance
* @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance
* @param ActiveTheme $activeTheme
* @see TwigBundle own FilesystemLoader
*
* @param FileLocatorInterface $locator A FileLocatorInterface instance
* @param TemplateNameParserInterface $parser A TemplateNameParserInterface instance
* @param string|null $rootPath The root path common to all relative paths (null for getcwd())
*/
public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser, ActiveTheme $activeTheme = null)
public function __construct(FileLocatorInterface $locator, TemplateNameParserInterface $parser, $rootPath = null)
{
parent::__construct(array());
parent::__construct(array(), $rootPath);

$this->locator = $locator;
$this->parser = $parser;
}

/**
* Define the active theme
*
* @param ActiveTheme $activeTheme
*/
public function setActiveTheme(ActiveTheme $activeTheme = null)
{
$this->activeTheme = $activeTheme;
}

Expand Down

0 comments on commit 2644d14

Please sign in to comment.