【问题标题】:EasyAdmin 3 - CRUD with nested formEasyAdmin 3 - 具有嵌套形式的 CRUD
【发布时间】:2021-09-01 01:40:30
【问题描述】:

我正在尝试使用 EasyAdmin 3 将子表单嵌入到表单中。

我的实体 A 与实体 B 具有 OneToOne 关系。

class entityA {
  
  private $id;

  private $name;

  //OneToOne with cascade persist
  private $entityB; 

}
class entityB {
  
  private $id;

  private $name;

  private $price;

}

在我的实体 A CRUD 控制器中,如何显示实体 B 表单?

public function configureFields(string $pageName): iterable
    {
        return [
            TextField::new('name'),
            // entity B form ?? (name, price)
        ];
    }

我尝试了 CollectionType,但它仅适用于...收藏。这不适用于 OneToOne 关系 :(

【问题讨论】:

    标签: php forms symfony nested easyadmin


    【解决方案1】:
    TextField::new('entityB.name'),
    

    【讨论】:

      猜你喜欢
      • 2020-11-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多