sf 2.8.4,sylius 0.17
我已生成一个控制器并使用generate:doctrine:crud
进行路由我可以列出所有数据,但在显示和编辑时,总是出现此错误:
Controller "St\AppBundle\Controller\TranslationDomainController::showAction()" requires that you provide a value for the "$translationdomain" argument (because there is no default value or because there is a non optional argument after this one).
这里是节目动作
public function showAction(TranslationDomain $translationdomain)
{
$deleteForm = $this->createDeleteForm($translationdomain->getId(), 'administration_translations_domain_delete');
return $this->render('StAppBundle:TranslationDomain:show.html.twig', array(
'translationdomain' => $translationdomain,
'delete_form' => $deleteForm->createView(), ));
}
和路线
administration_translations_domain_show:
pattern: /{id}/show
defaults: { _controller: "StAppBundle:TranslationDomain:show", id : 1 }
requirements:
id : \d+
_method : get
答案 0 :(得分:1)
http://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html
您必须通过将auto_convert标志设置为false来禁用类型提示方法参数功能的自动转换。
# app/config/config.yml
sensio_framework_extra:
request:
converters: true
auto_convert: false
sensio_framework_extra:
request:
converters: true
auto_convert: true
最后,您应始终请求对象标识符。它的安全性和语义正确。您想要显示/编辑/更新/删除'具体实体。
如果您真的想要为您的实体集创建默认节目,请创建类似于' / show / default'并使用此路线显示/选择默认'链接。