Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
29013a9f
Commit
29013a9f
authored
Jan 17, 2015
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed deprecated class
parent
4c01a361
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
59 deletions
+7
-59
doc/changelog.rst
doc/changelog.rst
+1
-0
src/Silex/Provider/TwigCoreExtension.php
src/Silex/Provider/TwigCoreExtension.php
+0
-56
src/Silex/Provider/TwigServiceProvider.php
src/Silex/Provider/TwigServiceProvider.php
+0
-3
tests/Silex/Tests/Provider/TwigServiceProviderTest.php
tests/Silex/Tests/Provider/TwigServiceProviderTest.php
+6
-0
No files found.
doc/changelog.rst
View file @
29013a9f
...
@@ -4,6 +4,7 @@ Changelog
...
@@ -4,6 +4,7 @@ Changelog
1.3.0 (2015-XX-XX)
1.3.0 (2015-XX-XX)
------------------
------------------
* removed deprecated TwigCoreExtension class (register the new HttpFragmentServiceProvider instead)
* bumped minimum version of PHP to 5.3.9
* bumped minimum version of PHP to 5.3.9
1.2.3 (2015-01-20)
1.2.3 (2015-01-20)
...
...
src/Silex/Provider/TwigCoreExtension.php
deleted
100644 → 0
View file @
4c01a361
<?php
/*
* This file is part of the Silex framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace
Silex\Provider
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpKernel\HttpKernelInterface
;
/**
* Twig extension.
*
* @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated deprecated since 1.2, will be removed in 1.3. Use HttpFragmentServiceProvider instead
*/
class
TwigCoreExtension
extends
\Twig_Extension
{
public
function
getFunctions
()
{
return
array
(
'render'
=>
new
\Twig_Function_Method
(
$this
,
'render'
,
array
(
'needs_environment'
=>
true
,
'is_safe'
=>
array
(
'html'
))),
);
}
public
function
render
(
\Twig_Environment
$twig
,
$uri
)
{
$globals
=
$twig
->
getGlobals
();
$request
=
$globals
[
'app'
][
'request'
];
$subRequest
=
Request
::
create
(
$uri
,
'get'
,
array
(),
$request
->
cookies
->
all
(),
array
(),
$request
->
server
->
all
());
if
(
$request
->
getSession
())
{
$subRequest
->
setSession
(
$request
->
getSession
());
}
$response
=
$globals
[
'app'
]
->
handle
(
$subRequest
,
HttpKernelInterface
::
SUB_REQUEST
,
false
);
if
(
!
$response
->
isSuccessful
())
{
throw
new
\RuntimeException
(
sprintf
(
'Error when rendering "%s" (Status code is %s).'
,
$request
->
getUri
(),
$response
->
getStatusCode
()));
}
return
$response
->
getContent
();
}
public
function
getName
()
{
return
'silex'
;
}
}
src/Silex/Provider/TwigServiceProvider.php
View file @
29013a9f
...
@@ -68,9 +68,6 @@ class TwigServiceProvider implements ServiceProviderInterface
...
@@ -68,9 +68,6 @@ class TwigServiceProvider implements ServiceProviderInterface
$app
[
'fragment.renderer.hinclude'
]
->
setTemplating
(
$twig
);
$app
[
'fragment.renderer.hinclude'
]
->
setTemplating
(
$twig
);
$twig
->
addExtension
(
new
HttpKernelExtension
(
$app
[
'fragment.handler'
]));
$twig
->
addExtension
(
new
HttpKernelExtension
(
$app
[
'fragment.handler'
]));
}
else
{
// fallback for BC, to be removed in 1.3
$twig
->
addExtension
(
new
TwigCoreExtension
());
}
}
if
(
isset
(
$app
[
'form.factory'
]))
{
if
(
isset
(
$app
[
'form.factory'
]))
{
...
...
tests/Silex/Tests/Provider/TwigServiceProviderTest.php
View file @
29013a9f
...
@@ -13,6 +13,7 @@ namespace Silex\Tests\Provider;
...
@@ -13,6 +13,7 @@ namespace Silex\Tests\Provider;
use
Silex\Application
;
use
Silex\Application
;
use
Silex\Provider\TwigServiceProvider
;
use
Silex\Provider\TwigServiceProvider
;
use
Silex\Provider\HttpFragmentServiceProvider
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Request
;
/**
/**
...
@@ -41,8 +42,13 @@ class TwigServiceProviderTest extends \PHPUnit_Framework_TestCase
...
@@ -41,8 +42,13 @@ class TwigServiceProviderTest extends \PHPUnit_Framework_TestCase
public
function
testRenderFunction
()
public
function
testRenderFunction
()
{
{
if
(
!
class_exists
(
'Symfony\Component\HttpFoundation\RequestStack'
))
{
$this
->
markTestSkipped
();
}
$app
=
new
Application
();
$app
=
new
Application
();
$app
->
register
(
new
HttpFragmentServiceProvider
());
$app
->
register
(
new
TwigServiceProvider
(),
array
(
$app
->
register
(
new
TwigServiceProvider
(),
array
(
'twig.templates'
=>
array
(
'twig.templates'
=>
array
(
'hello'
=>
'{{ render("/foo") }}'
,
'hello'
=>
'{{ render("/foo") }}'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment