symfony2 Catchable Fatal Error: Object of class could not be converted to string

前端 未结 5 618
眼角桃花
眼角桃花 2020-12-05 01:45

I have this Entity defined:



        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-05 02:30

    You can also use the property accessor into your form:

    ->add('categoryDescription', 'collection',
                array(
                    'type'         => new CategoriesDescriptionType(),
                    'allow_add' => true,
                    'options'      => array('data_class' => 'Apw\BlackbullBundle\Entity\CategoriesDescription'),
                    'by_reference' => false,
    
                ))
    

    And add 'property' => 'name' in your CategoriesDescriptionType.

    By the way the @CoachNono answer is ok too.

提交回复
热议问题