我正在使用symfony 3.1.4 并安装SonataAdminBundle,SonataFormatterBundle。 我在使用Sonata Formatter Bundle时遇到了麻烦。
按此guide安装SonataFormatterBundle:
我有一个实体:BlogSpost有3个字段:
/** * @var string * * @ORM\Column(name="body", type="blob") */ private $body; /** * @var string * */ private $rawBody; /** * @var string * */ private $bodyFormatter ;
class BlogPostAdmin extends AbstractAdmin { protected function configureFormFields(FormMapper $formMapper) { $formMapper->add('title', 'text') ->add('bodyFormatter', 'sonata_formatter_type', array( 'source_field' => 'rawBody', 'source_field_options' => array('attr' => array('class' => 'span10', 'rows' => 20)), 'format_field' => 'bodyFormatter', 'target_field' => 'body', 'event_dispatcher' => $formMapper->getFormBuilder()->getEventDispatcher() )) ->add('draft') ->add('published_time'); } // ...
选项" event_dispatcher"," format_field"," source_field"," source_field_options"," target_field"不存在。定义的选项包括:"操作"," allow_extra_fields"," attr"," auto_initialize"," block_name",& #34; by_reference","复合","约束"," csrf_field_name"," csrf_message"," csrf_protection&# 34;," csrf_token_id"," csrf_token_manager","数据"," data_class","禁用",&# 34; empty_data"," error_bubbling"," error_mapping"," extra_fields_message"," horizontal_input_wrapper_class"," horizontal_label_class&#34 ;," horizontal_label_offset_class"," inherit_data"," invalid_message"," invalid_message_parameters"," label",&#34 ; label_attr"," label_format"," label_render","映射","方法"," post_max_size_message" ," property_path"," required"," sonata_admin"," sonata_field_description"," sonata_help"," translat ion_domain"," trim"," validation_groups"。 500内部服务器错误 - UndefinedOptionsException
如何解决此问题?
答案 0 :(得分:0)
symfony 3.1.4,option resolver is one of them存在许多兼容性问题。 我建议尝试使用#x; formatter-bundle 4.x-dev',其中包含其他问题。
此外:
form:
resources:
# ...
- 'SonataFormatterBundle:Form:formatter.html.twig'
已弃用且
form_themes:
- 'SonataFormatterBundle:Form:formatter.html.twig'
应该使用。