V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
zzzkkk
V2EX  ›  PHP

symfomy form add field 注解模式 property_path 无效

  •  
  •   zzzkkk · 2021-12-25 20:30:33 +08:00 · 1013 次点击
    这是一个创建于 845 天前的主题,其中的信息可能已经有所发展或是发生改变。

    用 maker bundler

    make:entity 创建了新的 entity repository

    db 的 migration 都执行成功了

    想把新表的字段添加到 form 里

    $builder ->add('name', TextType::class, [ 'label' => 'app.form.inventory.name', 'property_path' => 'name' ]) ->add('code', TextType::class, [ 'label' => 'app.form.inventory.code', 'required' => false, 'property_path' => 'code' ]);

    可现在这样在 twig 页面里 dump 这两个变量的值为空

    把 name code 改成 name2 code2 根本没错误提示

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3225 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 10:47 · PVG 18:47 · LAX 03:47 · JFK 06:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.