Symfony2 Sonata Admin show attribute only as a readyonly text

前端 未结 2 1716
野性不改
野性不改 2021-02-05 21:41

I have some immutable attributes on my entity to administrate with sonata-admin bundle.

I want to show them in the edit-view of the entity, but don\'t want to provide an

2条回答
  •  梦毁少年i
    2021-02-05 22:24

    $formMapper
        ->add('post', 'entity', 
            array(
                'label' => 'Some post',
                'read_only' => true,
                'disabled'  => true,
                'class' => 'Acme\DemoBundle\Entity\Post'
            )
        )
    ;
    

提交回复
热议问题