symfony - MissingMandatoryParametersException: Some mandatory parameters are missingto generate a URL for route -
it seems missing here , keep getting following message:
## exception has been thrown during rendering of template ("some mandatory parameters missing ("fooid") generate url route "foo_edit".") in adminfoobundle:default:base.html.twig @ line 1. ##
this 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 twig file:
{% 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 issue lives in extending default:base.html.twig, cannot see right now:
{% 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 -->
check if have valid parameter $fooid. in route mandatory, , maybe because missing, error thrown.
Comments
Post a Comment