MySQL, iOS.
sonata-project/admin-bundle 3.33.0 3.33.0 The missing Symfony Admin Generator
sonata-project/block-bundle 3.12.1 3.12.1 Symfony SonataBlockBundle
sonata-project/cache 1.1.1 2.0.1 Cache library
sonata-project/cache-bundle 2.4.2 2.4.2 This bundle provides caching services
sonata-project/core-bundle 3.9.1 3.9.1 Symfony SonataCoreBundle
sonata-project/datagrid-bundle 2.3.1 2.3.1 Symfony SonataDatagridBundle
sonata-project/doctrine-extensions 1.0.2 1.0.2 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.4.2 3.4.2 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle 2.5.0 2.5.0 Symfony SonataEasyExtendsBundle
sonata-project/exporter 1.8.0 1.8.0 Lightweight Exporter library
sonata-project/google-authenticator 1.1.0 2.0.0 Library to integrate Google Authenticator into a PHP project
sonata-project/notification-bundle 3.4.0 3.4.0 Symfony SonataNotificationBundle
sonata-project/page-bundle 3.8.0 3.8.0 This bundle provides a Site and Page management through container and block services
sonata-project/seo-bundle 2.5.1 2.5.1 Symfony SonataSeoBundle
sonata-project/user-bundle 4.1.1 4.1.1 Symfony SonataUserBundle
symfony/monolog-bundle v3.2.0 v3.2.0 Symfony MonologBundle
symfony/phpunit-bridge v3.4.6 v4.0.6 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.7.0 v1.7.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu v1.7.0 v1.7.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.7.0 v1.7.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.7.0 v1.7.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.7.0 v1.7.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.7.0 v1.7.0 Symfony utilities for portability of PHP codes
symfony/security-acl v3.0.1 v3.0.1 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.6.7 v3.2.1 Symfony SwiftmailerBundle
symfony/symfony v3.4.6 v3.4.6 The Symfony PHP framework
PHP 7.1.1 (cli) (built: Jan 23 2017 15:09:57) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
with Xdebug v2.5.0, Copyright (c) 2002-2016, by Derick Rethans
First I will create container block by using command:
php bin/console sonata:page:create-block-container default content_bottom "Left test content”.
During trying to edition this block I got error: I got error: Could not load type "choice": class does not exist. I spent some time look for some place where is not using FQCNs but I didn't found. I change type from choice to 'Symfony\Component\Form\Extension\Core\Type\ChoiceType' in FormFactory during debug code but the result will be next Exception: "Expected argument of type "object, array or empty", "string" given"
Symfony\Component\Form\Exception\UnexpectedTypeException:
Expected argument of type "object, array or empty", "string" given
at vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php:41
at Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper->mapDataToForms('@SonataPage/Block/block_container.html.twig', object(RecursiveIteratorIterator))
(vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:383)
at Symfony\Component\Form\Form->setData('@SonataPage/Block/block_container.html.twig')
(vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php:49)
at Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper->mapDataToForms(array('layout' => '{{ CONTENT }}', 'class' => '', 'template' => '@SonataPage/Block/block_container.html.twig', 'code' => 'content_bottom'), obj
Form to edit block.
Got error: Could not load type "choice": class does not exist.
Can you try and upgrade to newest version of block bundle? It was released yesterday and it should fix this.
Yesterday release resolved problem with: "'sonata_type_collection". Current I use version 3.12.1. Check too 3.x-dev. But on this versions problem appear. I could not found the place where the option choice is connect with field type.
Can you add the full stack trace?
Full stack trace:
Symfony\Component\Form\Exception\InvalidArgumentException:
Could not load type "choice": class does not exist.
at vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php:86
at Symfony\Component\Form\FormRegistry->getType('choice')
(vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php:74)
at Symfony\Component\Form\FormFactory->createNamedBuilder('value', 'choice', null, array('required' => false))
(vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:106)
at Symfony\Component\Form\FormBuilder->create('value', 'choice', array('required' => false))
(vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:269)
at Symfony\Component\Form\FormBuilder->resolveChildren()
(vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:215)
at Symfony\Component\Form\FormBuilder->getForm()
(vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:221)
at Symfony\Component\Form\FormBuilder->getForm()
(vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php:221)
at Symfony\Component\Form\FormBuilder->getForm()
(vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php:2847)
at Sonata\AdminBundle\Admin\AbstractAdmin->buildForm()
(vendor/sonata-project/admin-bundle/src/Admin/AbstractAdmin.php:1232)
at Sonata\AdminBundle\Admin\AbstractAdmin->getForm()
(vendor/sonata-project/admin-bundle/src/Controller/CRUDController.php:312)
at Sonata\AdminBundle\Controller\CRUDController->editAction('14')
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:202)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/app_dev.php:29)
at require('/Users/michal/IdeaProjects/pierwszesoboty.pl/web/app_dev.php')
(vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42)
I had similiar issue. I changed this snippet for enabled: true to fix it.
sonata_core:
form:
mapping:
enabled: false
It would be nice to know where is the 'choice' type. What type of block are you editing?
Change enabled: true fixed the problem with "choice" error.
But during edit block a get new error:
_Symfony\Component\Form\Exception\UnexpectedTypeException:
Expected argument of type "object, array or empty", "string" given
at vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php:41
at Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper->mapDataToForms('@SonataPage/Block/block_container.html.twig', object(RecursiveIteratorIterator))
(vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:383)
at Symfony\Component\Form\Form->setData('@SonataPage/Block/block_container.html.twig')
(vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php:49)
at Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper->mapDataToForms(array('layout' => '{{ CONTENT }}', 'class' => '', 'template' => '@SonataPage/Block/block_container.html.twig', 'code' => 'content_top'), object(RecursiveIteratorIterator))
(vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:383)
at Symfony\Component\Form\Form->setData(array('layout' => '{{ CONTENT }}', 'class' => '', 'template' => '@SonataPage/Block/block_container.html.twig', 'code' => 'content_top'))
(vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php:49)
at Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper->mapDataToForms(object(Block), object(RecursiveIteratorIterator))
(vendor/symfony/symfony/src/Symfony/Component/Form/Form.php:383)
at Symfony\Component\Form\Form->setData(object(Block))
(vendor/sonata-project/admin-bundle/src/Controller/CRUDController.php:313)
at Sonata\AdminBundle\Controller\CRUDController->editAction('28')
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
(vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:202)
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
(web/app_dev.php:29)
at require('/Users/michal/IdeaProjects/pierwszesoboty.pl/web/app_dev.php')
(vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php:42)
On page I have three block. Every one in associate with template: sonata.page.block.container content_top etc. I found on https://sonata-project.org/bundles/page/3-x/doc/reference/getting_started.html information:
When the SonataPageBundle renders this container, it will automatically insert a sonata.page.block.container with the name footer_left if it does not exist yet. You will then be able to add new child blocks to it in the frontend. The second parameter is the name of the page. It can be either a string, or a Page instance. In case of a string, it will create a new page with that name if it doesn’t already exist.
Other way to create container block is command: php bin/console sonata:page:create-block-container default content_bottom "Left test content".
During edition I have the same error.
I some situation method PropertyPathMapper receive in mapDataToForms
$data == @SonataPage/Block/block_container.html.twig.
It have result in exception because the condition if (!$empty && !is_array($data) && !is_object($data)) expect Object or Array.
IMO we should focus this issue on the bundle we have the error.
You should close this one, because everything you said so far is related to page bundle. And open the issue there. Wdyt?
There are not a lot of places where I can find choice as string...
But I found some, I dont think it is related but probably should be fixed too: