[Templating] added more deprecation
This commit is contained in:
parent
224c891e10
commit
7169f4d3e2
@ -32,6 +32,7 @@ use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface;
|
|||||||
use Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder;
|
use Symfony\Component\Security\Core\Encoder\Argon2iPasswordEncoder;
|
||||||
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
use Symfony\Component\Security\Core\User\UserProviderInterface;
|
||||||
use Symfony\Component\Security\Http\Controller\UserValueResolver;
|
use Symfony\Component\Security\Http\Controller\UserValueResolver;
|
||||||
|
use Symfony\Component\Templating\PhpEngine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SecurityExtension.
|
* SecurityExtension.
|
||||||
@ -97,7 +98,9 @@ class SecurityExtension extends Extension implements PrependExtensionInterface
|
|||||||
$loader->load('security.xml');
|
$loader->load('security.xml');
|
||||||
$loader->load('security_listeners.xml');
|
$loader->load('security_listeners.xml');
|
||||||
$loader->load('security_rememberme.xml');
|
$loader->load('security_rememberme.xml');
|
||||||
$loader->load('templating_php.xml');
|
if (class_exists(PhpEngine::class)) {
|
||||||
|
$loader->load('templating_php.xml');
|
||||||
|
}
|
||||||
$loader->load('templating_twig.xml');
|
$loader->load('templating_twig.xml');
|
||||||
$loader->load('collectors.xml');
|
$loader->load('collectors.xml');
|
||||||
$loader->load('guard.xml');
|
$loader->load('guard.xml');
|
||||||
|
@ -10,11 +10,15 @@
|
|||||||
<service id="templating.helper.logout_url" class="Symfony\Bundle\SecurityBundle\Templating\Helper\LogoutUrlHelper">
|
<service id="templating.helper.logout_url" class="Symfony\Bundle\SecurityBundle\Templating\Helper\LogoutUrlHelper">
|
||||||
<tag name="templating.helper" alias="logout_url" />
|
<tag name="templating.helper" alias="logout_url" />
|
||||||
<argument type="service" id="security.logout_url_generator" />
|
<argument type="service" id="security.logout_url_generator" />
|
||||||
|
|
||||||
|
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="templating.helper.security" class="Symfony\Bundle\SecurityBundle\Templating\Helper\SecurityHelper">
|
<service id="templating.helper.security" class="Symfony\Bundle\SecurityBundle\Templating\Helper\SecurityHelper">
|
||||||
<tag name="templating.helper" alias="security" />
|
<tag name="templating.helper" alias="security" />
|
||||||
<argument type="service" id="security.authorization_checker" on-invalid="ignore" />
|
<argument type="service" id="security.authorization_checker" on-invalid="ignore" />
|
||||||
|
|
||||||
|
<deprecated>The "%service_id%" service is deprecated since Symfony 4.3 and will be removed in 5.0.</deprecated>
|
||||||
</service>
|
</service>
|
||||||
</services>
|
</services>
|
||||||
</container>
|
</container>
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\SecurityBundle\Templating\Helper;
|
namespace Symfony\Bundle\SecurityBundle\Templating\Helper;
|
||||||
|
|
||||||
|
@trigger_error('The '.LogoutUrlHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
|
use Symfony\Component\Security\Http\Logout\LogoutUrlGenerator;
|
||||||
use Symfony\Component\Templating\Helper\Helper;
|
use Symfony\Component\Templating\Helper\Helper;
|
||||||
|
|
||||||
@ -18,6 +20,8 @@ use Symfony\Component\Templating\Helper\Helper;
|
|||||||
* LogoutUrlHelper provides generator functions for the logout URL.
|
* LogoutUrlHelper provides generator functions for the logout URL.
|
||||||
*
|
*
|
||||||
* @author Jeremy Mikola <jmikola@gmail.com>
|
* @author Jeremy Mikola <jmikola@gmail.com>
|
||||||
|
*
|
||||||
|
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
|
||||||
*/
|
*/
|
||||||
class LogoutUrlHelper extends Helper
|
class LogoutUrlHelper extends Helper
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\SecurityBundle\Templating\Helper;
|
namespace Symfony\Bundle\SecurityBundle\Templating\Helper;
|
||||||
|
|
||||||
|
@trigger_error('The '.SecurityHelper::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
use Symfony\Component\Security\Acl\Voter\FieldVote;
|
use Symfony\Component\Security\Acl\Voter\FieldVote;
|
||||||
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
|
||||||
use Symfony\Component\Templating\Helper\Helper;
|
use Symfony\Component\Templating\Helper\Helper;
|
||||||
@ -19,6 +21,8 @@ use Symfony\Component\Templating\Helper\Helper;
|
|||||||
* SecurityHelper provides read-only access to the security checker.
|
* SecurityHelper provides read-only access to the security checker.
|
||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
|
||||||
*/
|
*/
|
||||||
class SecurityHelper extends Helper
|
class SecurityHelper extends Helper
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\TwigBundle\Loader;
|
namespace Symfony\Bundle\TwigBundle\Loader;
|
||||||
|
|
||||||
|
@trigger_error('The '.FilesystemLoader::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig notation for templates instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
use Symfony\Component\Config\FileLocatorInterface;
|
use Symfony\Component\Config\FileLocatorInterface;
|
||||||
use Symfony\Component\Templating\TemplateNameParserInterface;
|
use Symfony\Component\Templating\TemplateNameParserInterface;
|
||||||
use Symfony\Component\Templating\TemplateReferenceInterface;
|
use Symfony\Component\Templating\TemplateReferenceInterface;
|
||||||
@ -22,6 +24,8 @@ use Twig\Loader\FilesystemLoader as BaseFilesystemLoader;
|
|||||||
* to work with the Symfony paths and template references.
|
* to work with the Symfony paths and template references.
|
||||||
*
|
*
|
||||||
* @author Fabien Potencier <fabien@symfony.com>
|
* @author Fabien Potencier <fabien@symfony.com>
|
||||||
|
*
|
||||||
|
* @deprecated since version 4.3, to be removed in 5.0; use Twig notation for templates instead.
|
||||||
*/
|
*/
|
||||||
class FilesystemLoader extends BaseFilesystemLoader
|
class FilesystemLoader extends BaseFilesystemLoader
|
||||||
{
|
{
|
||||||
|
@ -280,6 +280,9 @@ class TwigExtensionTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
public function testRuntimeLoader()
|
public function testRuntimeLoader()
|
||||||
{
|
{
|
||||||
$container = $this->createContainer();
|
$container = $this->createContainer();
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Form\Extension\Templating;
|
namespace Symfony\Component\Form\Extension\Templating;
|
||||||
|
|
||||||
|
@trigger_error('The '.TemplatingExtension::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper;
|
use Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper;
|
||||||
use Symfony\Component\Form\AbstractExtension;
|
use Symfony\Component\Form\AbstractExtension;
|
||||||
use Symfony\Component\Form\FormRenderer;
|
use Symfony\Component\Form\FormRenderer;
|
||||||
@ -21,6 +23,8 @@ use Symfony\Component\Templating\PhpEngine;
|
|||||||
* Integrates the Templating component with the Form library.
|
* Integrates the Templating component with the Form library.
|
||||||
*
|
*
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
|
*
|
||||||
|
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
|
||||||
*/
|
*/
|
||||||
class TemplatingExtension extends AbstractExtension
|
class TemplatingExtension extends AbstractExtension
|
||||||
{
|
{
|
||||||
|
@ -11,12 +11,16 @@
|
|||||||
|
|
||||||
namespace Symfony\Component\Form\Extension\Templating;
|
namespace Symfony\Component\Form\Extension\Templating;
|
||||||
|
|
||||||
|
@trigger_error('The '.TemplatingRendererEngine::class.' class is deprecated since version 4.3 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED);
|
||||||
|
|
||||||
use Symfony\Component\Form\AbstractRendererEngine;
|
use Symfony\Component\Form\AbstractRendererEngine;
|
||||||
use Symfony\Component\Form\FormView;
|
use Symfony\Component\Form\FormView;
|
||||||
use Symfony\Component\Templating\EngineInterface;
|
use Symfony\Component\Templating\EngineInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
|
*
|
||||||
|
* @deprecated since version 4.3, to be removed in 5.0; use Twig instead.
|
||||||
*/
|
*/
|
||||||
class TemplatingRendererEngine extends AbstractRendererEngine
|
class TemplatingRendererEngine extends AbstractRendererEngine
|
||||||
{
|
{
|
||||||
|
@ -60,30 +60,6 @@ use Symfony\Component\Form\Extension\Core\CoreExtension;
|
|||||||
* ->addExtension(new ValidatorExtension($validator))
|
* ->addExtension(new ValidatorExtension($validator))
|
||||||
* ->getFormFactory();
|
* ->getFormFactory();
|
||||||
*
|
*
|
||||||
* Support for the Templating component is provided by TemplatingExtension.
|
|
||||||
* This extension needs a PhpEngine object for rendering forms. As second
|
|
||||||
* argument you should pass the names of the default themes. Here is an
|
|
||||||
* example for using the default layout with "<div>" tags:
|
|
||||||
*
|
|
||||||
* use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
|
|
||||||
*
|
|
||||||
* $formFactory = Forms::createFormFactoryBuilder()
|
|
||||||
* ->addExtension(new TemplatingExtension($engine, null, [
|
|
||||||
* 'FrameworkBundle:Form',
|
|
||||||
* ]))
|
|
||||||
* ->getFormFactory();
|
|
||||||
*
|
|
||||||
* The next example shows how to include the "<table>" layout:
|
|
||||||
*
|
|
||||||
* use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
|
|
||||||
*
|
|
||||||
* $formFactory = Forms::createFormFactoryBuilder()
|
|
||||||
* ->addExtension(new TemplatingExtension($engine, null, [
|
|
||||||
* 'FrameworkBundle:Form',
|
|
||||||
* 'FrameworkBundle:FormTable',
|
|
||||||
* ]))
|
|
||||||
* ->getFormFactory();
|
|
||||||
*
|
|
||||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||||
*/
|
*/
|
||||||
final class Forms
|
final class Forms
|
||||||
|
@ -48,8 +48,7 @@
|
|||||||
"suggest": {
|
"suggest": {
|
||||||
"symfony/validator": "For form validation.",
|
"symfony/validator": "For form validation.",
|
||||||
"symfony/security-csrf": "For protecting forms against CSRF attacks.",
|
"symfony/security-csrf": "For protecting forms against CSRF attacks.",
|
||||||
"symfony/twig-bridge": "For templating with Twig.",
|
"symfony/twig-bridge": "For templating with Twig."
|
||||||
"symfony/framework-bundle": "For templating with PHP."
|
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": { "Symfony\\Component\\Form\\": "" },
|
"psr-4": { "Symfony\\Component\\Form\\": "" },
|
||||||
|
@ -59,6 +59,10 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer
|
|||||||
throw new \InvalidArgumentException('The hinclude rendering strategy needs an instance of Twig\Environment or Symfony\Component\Templating\EngineInterface');
|
throw new \InvalidArgumentException('The hinclude rendering strategy needs an instance of Twig\Environment or Symfony\Component\Templating\EngineInterface');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($templating instanceof EngineInterface) {
|
||||||
|
@trigger_error(sprintf('Using a "%s" instance for "%s" is deprecated since version 4.3; use a \Twig\Environment instance instead.', EngineInterface::class, __CLASS__), E_USER_DEPRECATED);
|
||||||
|
}
|
||||||
|
|
||||||
$this->templating = $templating;
|
$this->templating = $templating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
use Symfony\Component\HttpKernel\Controller\ControllerReference;
|
||||||
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
|
use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer;
|
||||||
use Symfony\Component\HttpKernel\UriSigner;
|
use Symfony\Component\HttpKernel\UriSigner;
|
||||||
|
use Twig\Environment;
|
||||||
|
use Twig\Loader\ArrayLoader;
|
||||||
|
|
||||||
class HIncludeFragmentRendererTest extends TestCase
|
class HIncludeFragmentRendererTest extends TestCase
|
||||||
{
|
{
|
||||||
@ -74,7 +76,17 @@ class HIncludeFragmentRendererTest extends TestCase
|
|||||||
$this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'id' => 'bar', 'attributes' => ['p1' => 'v1', 'p2' => 'v2']])->getContent());
|
$this->assertEquals('<hx:include src="/foo" p1="v1" p2="v2" id="bar">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default', 'id' => 'bar', 'attributes' => ['p1' => 'v1', 'p2' => 'v2']])->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRenderWithDefaultText()
|
public function testRenderWithTwigAndDefaultText()
|
||||||
|
{
|
||||||
|
$twig = new Environment($loader = new ArrayLoader());
|
||||||
|
$strategy = new HIncludeFragmentRenderer($twig);
|
||||||
|
$this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'loading...'])->getContent());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
|
public function testRenderWithDefaultTextLegacy()
|
||||||
{
|
{
|
||||||
$engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock();
|
$engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock();
|
||||||
$engine->expects($this->once())
|
$engine->expects($this->once())
|
||||||
@ -86,17 +98,4 @@ class HIncludeFragmentRendererTest extends TestCase
|
|||||||
$strategy = new HIncludeFragmentRenderer($engine);
|
$strategy = new HIncludeFragmentRenderer($engine);
|
||||||
$this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent());
|
$this->assertEquals('<hx:include src="/foo">default</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'default'])->getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testRenderWithEngineAndDefaultText()
|
|
||||||
{
|
|
||||||
$engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock();
|
|
||||||
$engine->expects($this->once())
|
|
||||||
->method('exists')
|
|
||||||
->with('loading...')
|
|
||||||
->willThrowException(new \RuntimeException());
|
|
||||||
|
|
||||||
// only default
|
|
||||||
$strategy = new HIncludeFragmentRenderer($engine);
|
|
||||||
$this->assertEquals('<hx:include src="/foo">loading...</hx:include>', $strategy->render('/foo', Request::create('/'), ['default' => 'loading...'])->getContent());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,8 @@
|
|||||||
"symfony/templating": "~3.4|~4.0",
|
"symfony/templating": "~3.4|~4.0",
|
||||||
"symfony/translation": "~4.2",
|
"symfony/translation": "~4.2",
|
||||||
"symfony/var-dumper": "^4.1.1",
|
"symfony/var-dumper": "^4.1.1",
|
||||||
"psr/cache": "~1.0"
|
"psr/cache": "~1.0",
|
||||||
|
"twig/twig": "^1.34|^2.4"
|
||||||
},
|
},
|
||||||
"provide": {
|
"provide": {
|
||||||
"psr/log-implementation": "1.0"
|
"psr/log-implementation": "1.0"
|
||||||
|
Reference in New Issue
Block a user