gpt4 book ai didi

forms - LiipImagineBundle 错误

转载 作者:行者123 更新时间:2023-12-02 17:13:43 25 4
gpt4 key购买 nike

我正在为我的 symfony 项目安装 bundle LiipImagineBundle。我将它添加到内核中,对其进行配置:

liip_imagine:
resolvers:
default:
web_path: ~
filter_sets:
avatar:
quality: 75
cache: ~
filters:
thumbnail: { size: [120, 120], mode: outbound }

当我启动一个包含表单的页面时,出现了这个错误:

Unable to find template "LiipImagineBundle:Form:form_div_layout.html.twig" (looked into: /Users/user/www/html/project/app/Resources/views, /Users/user/www/html/project/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form).

为什么?你能帮我找出问题所在吗?当我删除 LiipImagineBundle 的配置和内核时,它又开始工作了。

提前致谢

编辑:我正在开发 symfony 的 v3.4.1。

"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "^2.5",
"incenteev/composer-parameter-handler": "^2.0",
"sensio/distribution-bundle": "^5.0.19",
"sensio/framework-extra-bundle": "^5.0.0",
"symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "3.4.*",
"twig/twig": "^1.0||^2.0",
"jms/serializer-bundle": "^2.3.0",
"friendsofsymfony/elastica-bundle": "^4.0.1",
"friendsofsymfony/rest-bundle": "^2.3.0",
"friendsofsymfony/user-bundle": "^2.0.2",
"stof/doctrine-extensions-bundle": "^1.2.2",
"doctrine/doctrine-migrations-bundle": "^1.3.1",
"lexik/maintenance-bundle": "^2.1.2",
"liip/imagine-bundle": "^1.9.1",
"nelmio/api-doc-bundle": "^2.13.3",
"nietonfir/google-recaptcha-bundle": "^0.2.1",
"beberlei/DoctrineExtensions": "^1.0.20"

最佳答案

我能够重现该问题并找到解决方法。

# LiipImagineExtension.php
$resources = $container->hasParameter('twig.form.resources') ?
$container->getParameter('twig.form.resources') : array();

// The existing line
//$resources[] = 'LiipImagineBundle:Form:form_div_layout.html.twig';

// Change to
$resources[] = '@LiipImagine/Form/form_div_layout.html.twig';

$container->setParameter('twig.form.resources', $resources);

所以 S3.4 的某个地方似乎已经改变了一些东西,只使用 twig 命名空间而不是冒号符号。 Symfony 的一种奇怪的 BC 中断。

我查看了 liip github。这实际上在他们未发布的 2.0 分支中得到修复。考虑更新到 "liip/imagine-bundle": "^2.0@dev",

这也可以通过将框架配置为使用 twig 来解决:

# app/config/config.yml
framework:
templating:
engines: ['twig']

关于forms - LiipImagineBundle 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47697790/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com