It seems that I am missing something here and I am keep getting the following message:
似乎我在这里漏掉了什么,我不断得到以下信息:
## An exception has been thrown during the rendering of a template ("Some mandatory parameters are missing ("fooId") to generate a URL for route "foo_edit".") in AdminFooBundle:Default:base.html.twig at line 1. ##
在显示模板(“缺少一些强制参数(“fooId”)以生成路径“foo_edit”的URL)时,在AdminFooBundle中抛出了一个异常:Default:base.html。树枝在1号线。# #
This is the Controller's action:
这是控制器的动作:
/**
* @Route("/{fooId}/edit", name="foo_edit", requirements={"fooId" = "\d+"})
* @param $fooId
*
* @return View
*/
public function editFooFormAction($fooId)
{
$foo = $this->getFooRepository()->findOneBy(['fooId' => $fooId]);
return $this->render(
"AdminFooBundle:Competition:show_foo.html.twig",
['foo' => $foo]
);
}
And this is my twig file:
这是我的twig文件:
{% extends 'FooAdminToolBundle:Default:base.html.twig' %}
{% block inner_main %}
{{ parent() }}
<form data-spy="scroll" data-target="#affix-nav" action="{{ path('foo_create') }}" method="post">
<button type="submit" style="position: absolute; left:-10000px;"></button>
{% include 'FooAdminBundle:Foo:foo_data.html.twig'%}
<button type="submit" class="btn btn-default">Add new foo</button>
</form>
{% endblock %}
My guess is the issue lives in extending Default:base.html.twig, but I cannot see something right now:
我的猜测是这个问题存在于扩展Default:base.html中。twig,但是我现在看不到什么:
{% set currentPath = path(app.request.attributes.get('_route')) %}
<!DOCTYPE html>
<html lang="en">
<head>
<title> {% block title %}Admin Tool{% endblock %}</title>
{% block stylesheets %}
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
{% endblock %}
{% block headcss %}
{% endblock %}
{% block headjavascripts %}
{% endblock %}
<link rel="icon" type="image/x-icon" href="{{ asset('favicon.ico') }}" />
</head>
<body data-spy="scroll" data-target="#affix-nav">
{% include 'FooAdminBundle:Default:navbar.html.twig' %}
<div class="container">
{% block main %}{% endblock %}
<div class="row">
<div class="col-sm-9">
{% block inner_main %}{% endblock %}
</div>
<div class="col-sm-3">
<div id="options" data-spy="affix"></div>
</div>
</div>
</div> <!-- /main -->
1 个解决方案
#1
0
Check if you have a valid for parameter $fooId. In your route is mandatory, and maybe because is missing, that error is thrown.
检查参数$fooId是否有效。在你的路径是强制性的,也许因为丢失了,错误被抛出。
#1
0
Check if you have a valid for parameter $fooId. In your route is mandatory, and maybe because is missing, that error is thrown.
检查参数$fooId是否有效。在你的路径是强制性的,也许因为丢失了,错误被抛出。