Symfony 2.6 "PropertyAccessor" 异常:给定 "object or array"、"NULL" 类型的预期参数

Symfony 2.6 "PropertyAccessor" exception: Expected argument of type "object or array", "NULL" given

Symfony 在我的管理后端的 CRUD 页面上给我一个错误:

Symfony 2.6 exception: Expected argument of type "object or array", "NULL" given

下面是完整的堆栈跟踪,

相关源文件的第 132 行位于此处:

https://github.com/symfony/PropertyAccess/blob/master/PropertyAccessor.php

有没有人以前遇到过这种类型的异常?我到底应该在哪里寻找一个不存在的树枝值?在 FormType 对象中?实体?配置.yml设置?

我已经尝试 git bisect 找到错误,我已经尝试回滚 git 中的代码,但我就是不知道如何调试它, 太抽象了。

完整堆栈跟踪:

[1] Symfony\Component\PropertyAccess\Exception\UnexpectedTypeException: Expected argument of type "object or array", "NULL" given
    at n/a
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php line 232

    at Symfony\Component\PropertyAccess\PropertyAccessor->readPropertiesUntil(object(User), object(PropertyPath), '2', true)
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/PropertyAccess/PropertyAccessor.php line 58

    at Symfony\Component\PropertyAccess\PropertyAccessor->getValue(object(User), object(PropertyPath))
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php line 252

    at Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList->extractLabels(array(object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User)), array('test test', 'test test', 'test test', 'Coughlin Tom', 'test test', 'Smith John', 'Eric Spoelstra', 'James LeBron', 'Chris Bosh', 'Roy Ronalds', 'Development Preview', 'Roy Testing', 'Tester TesterLast'))
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php line 146

    at Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList->initialize(array(object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User), object(User)), array(), array())
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php line 437

    at Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList->load()
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php line 174

    at Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList->getPreferredViews()
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php line 101

    at Symfony\Component\Form\Extension\Core\Type\ChoiceType->buildView(object(FormView), object(Form), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'virtual' => null, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'error_mapping' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_provider' => object(CsrfProviderAdapter), 'intention' => null, 'multiple' => false, 'expanded' => false, 'choices' => null, 'preferred_choices' => array(), 'query_builder' => null, 'group_by' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => '', 'required' => false, 'error_bubbling' => false, 'label_attr' => array(), 'inherit_data' => false, 'compound' => false, 'validation_groups' => null, 'constraints' => array(), 'csrf_token_manager' => object(CsrfProviderAdapter), 'csrf_token_id' => null, 'property' => 'profile.fullname', 'class' => 'SYUsersBundle:User', 'em' => object(EntityManager), 'loader' => object(ORMQueryBuilderLoader), 'choice_list' => object(EntityChoiceList), 'empty_value' => '', 'placeholder' => ''))
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php line 162

    at Symfony\Component\Form\ResolvedFormType->buildView(object(FormView), object(Form), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'virtual' => null, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'error_mapping' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_provider' => object(CsrfProviderAdapter), 'intention' => null, 'multiple' => false, 'expanded' => false, 'choices' => null, 'preferred_choices' => array(), 'query_builder' => null, 'group_by' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => '', 'required' => false, 'error_bubbling' => false, 'label_attr' => array(), 'inherit_data' => false, 'compound' => false, 'validation_groups' => null, 'constraints' => array(), 'csrf_token_manager' => object(CsrfProviderAdapter), 'csrf_token_id' => null, 'property' => 'profile.fullname', 'class' => 'SYUsersBundle:User', 'em' => object(EntityManager), 'loader' => object(ORMQueryBuilderLoader), 'choice_list' => object(EntityChoiceList), 'empty_value' => '', 'placeholder' => ''))
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php line 111

    at Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeDataCollectorProxy->buildView(object(FormView), object(Form), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'virtual' => null, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'error_mapping' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_provider' => object(CsrfProviderAdapter), 'intention' => null, 'multiple' => false, 'expanded' => false, 'choices' => null, 'preferred_choices' => array(), 'query_builder' => null, 'group_by' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => '', 'required' => false, 'error_bubbling' => false, 'label_attr' => array(), 'inherit_data' => false, 'compound' => false, 'validation_groups' => null, 'constraints' => array(), 'csrf_token_manager' => object(CsrfProviderAdapter), 'csrf_token_id' => null, 'property' => 'profile.fullname', 'class' => 'SYUsersBundle:User', 'em' => object(EntityManager), 'loader' => object(ORMQueryBuilderLoader), 'choice_list' => object(EntityChoiceList), 'empty_value' => '', 'placeholder' => ''))
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php line 159

    at Symfony\Component\Form\ResolvedFormType->buildView(object(FormView), object(Form), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'virtual' => null, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'error_mapping' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_provider' => object(CsrfProviderAdapter), 'intention' => null, 'multiple' => false, 'expanded' => false, 'choices' => null, 'preferred_choices' => array(), 'query_builder' => null, 'group_by' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => '', 'required' => false, 'error_bubbling' => false, 'label_attr' => array(), 'inherit_data' => false, 'compound' => false, 'validation_groups' => null, 'constraints' => array(), 'csrf_token_manager' => object(CsrfProviderAdapter), 'csrf_token_id' => null, 'property' => 'profile.fullname', 'class' => 'SYUsersBundle:User', 'em' => object(EntityManager), 'loader' => object(ORMQueryBuilderLoader), 'choice_list' => object(EntityChoiceList), 'empty_value' => '', 'placeholder' => ''))
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php line 111

    at Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeDataCollectorProxy->buildView(object(FormView), object(Form), array('block_name' => null, 'disabled' => false, 'label' => null, 'label_format' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'virtual' => null, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'error_mapping' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'allow_extra_fields' => false, 'extra_fields_message' => 'This form should not contain extra fields.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_provider' => object(CsrfProviderAdapter), 'intention' => null, 'multiple' => false, 'expanded' => false, 'choices' => null, 'preferred_choices' => array(), 'query_builder' => null, 'group_by' => null, 'attr' => array(), 'data_class' => null, 'empty_data' => '', 'required' => false, 'error_bubbling' => false, 'label_attr' => array(), 'inherit_data' => false, 'compound' => false, 'validation_groups' => null, 'constraints' => array(), 'csrf_token_manager' => object(CsrfProviderAdapter), 'csrf_token_id' => null, 'property' => 'profile.fullname', 'class' => 'SYUsersBundle:User', 'em' => object(EntityManager), 'loader' => object(ORMQueryBuilderLoader), 'choice_list' => object(EntityChoiceList), 'empty_value' => '', 'placeholder' => ''))
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php line 1058

    at Symfony\Component\Form\Form->createView(object(FormView))
        in /srv/sy4/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php line 1061

    at Symfony\Component\Form\Form->createView()
        in /srv/sy4/src/SK/AdminBundle/Controller/CrudController.php line 100

    at SK\AdminBundle\Controller\CrudController->doIndex()
        in /srv/sy4/src/SK/AdminBundle/Controller/CrudController.php line 30

    at SK\AdminBundle\Controller\CrudController->indexAction()
        in  line 

    at call_user_func_array(array(object(TeamsController), 'indexAction'), array())
        in /srv/sy4/app/bootstrap.php.cache line 3039

    at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
        in /srv/sy4/app/bootstrap.php.cache line 3001

    at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
        in /srv/sy4/app/bootstrap.php.cache line 3150

    at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
        in /srv/sy4/app/bootstrap.php.cache line 2391

    at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
        in /srv/sy4/web/app_dev.php line 28

似乎它正在尝试呈现带有选项字段(对于用户对象)的表单类型,但选项为空(空)。你能post你的表单类型配置吗,特别是用户选择字段的部分。