- 25 Feb, 2018 2 commits
-
-
Fabien Potencier authored
-
Fabien Potencier authored
-
- 24 Feb, 2018 2 commits
-
-
Fabien Potencier authored
This PR was squashed before being merged into the 2.2.x-dev branch (closes #1595). Discussion ---------- Tweak warning message to point to #1593, asking for help Commits ------- 75585384 Tweak warning message to point to #1593, asking for help
-
Gunnar Beushausen authored
-
- 23 Feb, 2018 1 commit
-
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- Updated for RouterListener from symfony/http-kernel v3.4+ #1591 Commits ------- 45c44271 #1591
-
- 17 Feb, 2018 1 commit
-
-
Eridan Domoratskiy authored
Updated for RouterListener from symfony/http-kernel v3.4+
-
- 12 Jan, 2018 5 commits
-
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
-
- 10 Jan, 2018 1 commit
-
-
Fabien Potencier authored
-
- 14 Dec, 2017 10 commits
-
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- Namespaces for Twig paths Hello, Recently, I had to use Symfony project's pieces of code in a Silex project, extending parent templates through submodules. These submodules, on which I had no control, used namespaced templates in their Twig files, such as: ```twig {% import "@FooModule/macros.html.twig" as macros %} ``` ____ ### Problem Silex cannot resolve namespaces by default, since you have to register paths as following: ```php $app->register(new TwigServiceProvider(), array( 'twig.path' => [ '../app/Resources/views', '../common/foo-module/Resources/views' ] )); ``` ### Temporary solution What I had to do in order to get it working in the project was to "hack" the `\Twig_Loader_Filesystem` class (*PHP 7+*): ```php $paths = [ '../app/Resources/views', 'FooModule' => '../common/foo-module/Resources/views', ]; $app->register(new TwigServiceProvider()); $app['twig.loader.filesystem'] = (function() use (&$paths): \Twig_Loader_Filesystem { $fileSystem = new \Twig_Loader_Filesystem(); foreach ($paths as $namespace => $path) { if (is_string($namespace)) { $fileSystem->addPath($path, $namespace); } else { $fileSystem->addPath($path); } } return $fileSystem; })(); ``` This works fine. Other solutions crossed my minds, but this was one of the best alternatives I figured in order to use Twig namespaces in Silex. ### Code modification Though this solution works, it may seem a bit dirty to have to do this in the project's code and not having the `TwigServiceProvider` providing this possibility. So I added this little piece of algorithm directly at the `\Twig_Loader_Filesystem` instanciation, which now looks like this as you will see in changes: ```php $app['twig.loader.filesystem'] = function ($app) { if (!is_array($app['twig.path'])) { $app['twig.path'] = array($app['twig.path']); } $fileSystem = new \Twig_Loader_Filesystem(); foreach ($app['twig.path'] as $namespace => $path) { if (is_string($namespace)) { $fileSystem->addPath($path, $namespace); } else { $fileSystem->addPath($path); } } return $fileSystem; }; ``` So you can simply register your `TwigServiceProvider` as following: ```php $app->register(new TwigServiceProvider(), [ 'twig.path' => [ '../app/Resources/views', 'FooModule' => '../common/foo-module/Resources/views', ] ]); ``` ___ English not being my native language, I hope I was clear enough. I stay around to answer any question about this potential contribution. (: A Commits ------- d1f29680 [change] Namespaces for Twig paths
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- Refactoring tests I've refactored some tests, using: - `assertCount` instead of `count` function; - `assertFalse` instead of strict comparison with `false` keyword; - `assertArrayHasKey` instead of `isset` function. Commits ------- b163e443 Refactoring tests
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- Test against PHP 7.2 Commits ------- 9853996c Test against PHP 7.2
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- Swiftmailer SSL stream_context_options cannot be set #1582 : Adding stream_context_options to the $app['swiftmailer.options'] Commits ------- d622daa3 Swiftmailer SSL stream_context_options cannot be set #1582 : Adding stream_context_options to the $app['swiftmailer.options']
-
Daniel Madureira authored
-
leClaude authored
Adding stream_context_options to the $app['swiftmailer.options']
-
- 10 Dec, 2017 1 commit
-
-
Gabriel Caruso authored
-
- 27 Nov, 2017 1 commit
-
-
Adrien authored
-
- 23 Nov, 2017 1 commit
-
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- A minor typo Hi, I found a minor typo in this particular file. Kindly please check it and merge the pull request if you find it valid. Thanks! Commits ------- 8fd2b2bf Update organizing_controllers.rst
-
- 22 Nov, 2017 1 commit
-
-
Amit Merchant authored
-
- 07 Nov, 2017 1 commit
-
-
Fabien Potencier authored
-
- 29 Aug, 2017 3 commits
-
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- Add undocumented available parameter: base_path Commits ------- 52248599 Add not documented available parameter: base_path
-
Fabien Potencier authored
This PR was squashed before being merged into the 2.2.x-dev branch (closes #1549). Discussion ---------- Fix wrong namespace forward/backward slash Commits ------- e7771477 Fix wrong namespace forward/backward slash
-
Dominic authored
-
- 25 Aug, 2017 1 commit
-
-
Redominus authored
-
- 22 Aug, 2017 3 commits
-
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- Handle the ControllerResolverInterface::getArguments deprecation in tests Fixes deprecation notices/failures due to the deprecation of `ControllerResolverInterface::getArguments()`: 1. `Silex\ControllerResolver` [is not used by Silex](https://github.com/silexphp/Silex/blob/master/src/Silex/Provider/HttpKernelServiceProvider.php#L37) when using HttpKernel >= 3.1.0, so I skipped the only test present in `ControllerResolverTest` with recent versions, as it failed when testing against HttpKernel v4 (master). 2. `ServiceControllerResolverTest::testShouldDelegateGetArguments()` only asserts that the deprecated method is called, so added a `@group legacy` to handle the notice, and skipped the test with v4 to prevent a warning (PHPUnit complains when you mock a non-existent method). Commits ------- c020cec4 Correctly handle the ControllerResolverInterface::getArguments deprecation in tests
-
Fabien Potencier authored
minor #1543 The general case is that 'app' may be located anywhere, accessible through an Alias. (PABourdin) This PR was merged into the 2.2.x-dev branch. Discussion ---------- The general case is that 'app' may be located anywhere, accessible through an Alias. Commits ------- c5826fdf The general case is that 'app' may be located anywhere, accessible through an Alias.
-
Fabien Potencier authored
This PR was merged into the 2.2.x-dev branch. Discussion ---------- FormTrait: Fixed unused imports Commits ------- b51414f8 Fix unused components
-
- 18 Aug, 2017 1 commit
-
-
chihiro-adachi authored
-
- 17 Aug, 2017 1 commit
-
-
Philippe Bourdin authored
-
- 23 Jul, 2017 4 commits
-
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
-
Fabien Potencier authored
This PR was merged into the 2.1.x-dev branch. Discussion ---------- Fixed translator.resources definition `translator.resource` is wrongly registered as a protected closure in `TranslationServiceProvider` (it was originally added correctly in dd270386, but changed in 48a3fdc4). That makes a test fail with Pimple 3.2.1 due to the silexphp/Pimple#190 fix as `translator.resource` can't be extended. Commits ------- c5dc42a7 Fixed translator.resources definition
-