gpt4 book ai didi

php - FOSUserBundle 中未定义的参数

转载 作者:行者123 更新时间:2023-12-04 18:52:38 29 4
gpt4 key购买 nike

我正在 Symfony2 Web 应用程序中添加新功能,经过几次开发后,编辑用户功能停止工作。

出于某种原因,错误显示在 edit user screen 中。 ,不在 show user 中.

错误:

The parameter "fos_user.template.theme" must be defined.
500 Internal Server Error - InvalidArgumentException
editAction方法:
/**
* Edit the user
*/
public function editAction()
{
$user = $this->container->get('security.context')->getToken()->getUser();
if (!is_object($user) || !$user instanceof UserInterface) {
throw new AccessDeniedException('This user does not have access to this section.');
}

$form = $this->container->get('fos_user.profile.form');
$formHandler = $this->container->get('fos_user.profile.form.handler');

$process = $formHandler->process($user);
if ($process) {
$this->setFlash('notice', 'As alterações foram feitas com sucesso.');

return new RedirectResponse($this->container->get('router')->generate('fos_user_profile_show'));
}

return $this->container->get('templating')->renderResponse(
'FOSUserBundle:Profile:edit.html.'.$this->container->getParameter('fos_user.template.engine'),
array('form' => $form->createView(), 'theme' => $this->container->getParameter('fos_user.template.theme'))
);
}

我相信 config.yml 中缺少某些内容,但我无法在 fos_user.template.theme 上添加正确的参数:
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: App\UserBundle\Entity\User
registration:
form:
type: duo_vozi_user_registration
profile:
form:
type: duo_vozi_user_profile
from_email:
address: vozi@vozi.com.br
sender_name: VOZI

这些是使用的组件的版本:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.1.*",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.0.*",
"twig/extensions": "1.0.*",
"symfony/assetic-bundle": "2.1.*",
"symfony/swiftmailer-bundle": "2.1.*",
"symfony/monolog-bundle": "2.1.*",
"sensio/distribution-bundle": "2.1.*",
"sensio/framework-extra-bundle": "2.1.*",
"sensio/generator-bundle": "2.1.*",
"jms/security-extra-bundle": "1.2.*",
"jms/di-extra-bundle": "1.1.*",
"doctrine/doctrine-fixtures-bundle": "dev-master",
"gedmo/doctrine-extensions": "dev-master",
"friendsofsymfony/user-bundle": "1.3.1",
"brazilianfriendsofsymfony/sync-content-bundle": "dev-master",
"brazilianfriendsofsymfony/brasil-bundle":"dev-master",
"brazilianfriendsofsymfony/settings-management-bundle":"dev-master",
"brazilianfriendsofsymfony/pagseguro-bundle":"dev-master",
"brazilianfriendsofsymfony/twig-extensions-bundle":"dev-master",
"knplabs/knp-menu-bundle":"dev-master",
"duo/cms-bundle": "v1.1.9"
},

最佳答案

经过一些研究以找到 Controller 代码的来源,它似乎来自旧版本的 FOSUserBundle (1) (2) (3) 。所以我建议你升级你的 Symfony2 或者使用最新版本的 FOSUserBundle 并使用最新版本的文档。

关于php - FOSUserBundle 中未定义的参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23366305/

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