我在Sonata管理员捆绑包中的configureFormFields()中有一个管理员 我有这样的代码:
$formMapper->with('Read only data', ['class' => 'col-md-6'])
->add('readonly', ReadOnlyType::class, [
'mapped' => false,
'template' => 'example.html.twig'
])
->end();
ReadOnlyType是奏鸣曲中ModelType的副本,更改后的getParent()返回null。 我收到该错误:
The options "label", "label_render", "mapped", "property_path", "sonata_field_description" do not exist. Defined options are: "btn_add", "btn_catalogue", "btn_delete", "btn_list", "choice_loader", "choices", "class", "compound", "expanded", "model_manager", "multiple", "preferred_choices", "property", "query", "template".
我整天都在挣扎。我该怎么做才能创建类型以显示当前管理员的只读信息?