edit/create 页面上的 Sonata appBundle 循环依赖

SonataPageBundle circular dependancy on edit/create page

我对 SonataPageBundle 有问题,在使用 composer 进行更新后,当我尝试为我的多站点创建或编辑新页面时出现错误,我尝试查看捆绑文件和问题似乎发生在 SonataPageBundle:Admin:PageAdmin.php

中的 'sonata_page_selector' formMapper

我尝试回滚更新,但没有任何效果,而且我不记得自上次成功创建页面后更改过任何重要代码。

非常感谢您的帮助。

    [1] Symfony\Component\OptionsResolver\Exception\OptionDefinitionException: The options "choices", "choices_as_values", "choice_loader" have a cyclic dependency.
at n/a
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php line 951

at Symfony\Component\OptionsResolver\OptionsResolver->offsetGet('choices')
    in /var/www/vhosts/symfony/var/cache/dev/classes.php line 22103

at Sonata\AdminBundle\Form\Type\ModelType->Sonata\AdminBundle\Form\Type\{closure}(object(OptionsResolver), null)
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php line 859

at Symfony\Component\OptionsResolver\OptionsResolver->offsetGet('choice_loader')
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php line 360

at Symfony\Component\Form\Extension\Core\Type\ChoiceType->Symfony\Component\Form\Extension\Core\Type\{closure}(object(OptionsResolver), false)
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php line 965

at Symfony\Component\OptionsResolver\OptionsResolver->offsetGet('choices_as_values')
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php line 290

at Symfony\Component\Form\Extension\Core\Type\ChoiceType->Symfony\Component\Form\Extension\Core\Type\{closure}(object(OptionsResolver), array())
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php line 965

at Symfony\Component\OptionsResolver\OptionsResolver->offsetGet('choices')
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php line 791

at Symfony\Component\OptionsResolver\OptionsResolver->resolve(array('sonata_field_description' => object(FieldDescription), 'page' => object(Page), 'site' => object(Site), 'model_manager' => object(ModelManager), 'class' => 'Application\Sonata\PageBundle\Entity\Page', 'required' => false, 'filter_choice' => array('hierarchy' => 'root'), 'property_path' => 'parent', 'label_render' => false, 'label' => 'form.label_parent'))
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php line 156

at Symfony\Component\Form\ResolvedFormType->createBuilder(object(FormFactory), 'parent', array('sonata_field_description' => object(FieldDescription), 'page' => object(Page), 'site' => object(Site), 'model_manager' => object(ModelManager), 'class' => 'Application\Sonata\PageBundle\Entity\Page', 'required' => false, 'filter_choice' => array('hierarchy' => 'root'), 'property_path' => 'parent', 'label_render' => false, 'label' => 'form.label_parent'))
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php line 89

at Symfony\Component\Form\Extension\DataCollector\Proxy\ResolvedTypeDataCollectorProxy->createBuilder(object(FormFactory), 'parent', array('sonata_field_description' => object(FieldDescription), 'page' => object(Page), 'site' => object(Site), 'model_manager' => object(ModelManager), 'class' => 'Application\Sonata\PageBundle\Entity\Page', 'required' => false, 'filter_choice' => array('hierarchy' => 'root'), 'property_path' => 'parent', 'label_render' => false, 'label' => 'form.label_parent'))
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php line 114

at Symfony\Component\Form\FormFactory->createNamedBuilder('parent', object(ResolvedTypeDataCollectorProxy), null, array('sonata_field_description' => object(FieldDescription), 'page' => object(Page), 'site' => object(Site), 'model_manager' => object(ModelManager), 'class' => 'Application\Sonata\PageBundle\Entity\Page', 'required' => false, 'filter_choice' => array('hierarchy' => 'root'), 'property_path' => 'parent', 'label_render' => false, 'label' => 'form.label_parent'))
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php line 106

at Symfony\Component\Form\FormBuilder->create('parent', 'sonata_page_selector', array('sonata_field_description' => object(FieldDescription), 'page' => object(Page), 'site' => object(Site), 'model_manager' => object(ModelManager), 'class' => 'Application\Sonata\PageBundle\Entity\Page', 'required' => false, 'filter_choice' => array('hierarchy' => 'root'), 'property_path' => 'parent', 'label_render' => false, 'label' => 'form.label_parent'))
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php line 269

at Symfony\Component\Form\FormBuilder->resolveChildren()
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php line 215

at Symfony\Component\Form\FormBuilder->getForm()
    in /var/www/vhosts/symfony/var/cache/dev/classes.php line 18883

at Sonata\AdminBundle\Admin\AbstractAdmin->buildForm()
    in /var/www/vhosts/symfony/var/cache/dev/classes.php line 17917

at Sonata\AdminBundle\Admin\AbstractAdmin->getForm()
    in /var/www/vhosts/symfony/vendor/sonata-project/admin-bundle/Controller/CRUDController.php line 255

at Sonata\AdminBundle\Controller\CRUDController->editAction('425')
    in  line 

at call_user_func_array(array(object(PageAdminController), 'editAction'), array('425'))
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 144

at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(SiteRequest), '1')
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 64

at Symfony\Component\HttpKernel\HttpKernel->handle(object(SiteRequest), '1', true)
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ContainerAwareHttpKernel.php line 69

at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(SiteRequest), '1', true)
    in /var/www/vhosts/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 185

at Symfony\Component\HttpKernel\Kernel->handle(object(SiteRequest))
    in /var/www/vhosts/symfony/web/app_dev.php line 31

我有同样的问题并通过将 symfony 组件降级到版本 2.8.18(当前是 2.8.19)解决了这个问题。

希望对你有所帮助。