Sonataadminbundle: Sonata admin CollectionType::class does not show collections

Created on 15 Aug 2017  路  1Comment  路  Source: sonata-project/SonataAdminBundle

Environment

Operating System: Ubuntu 16.04
Php: Php-fpm7.1
Server: Nginx

Sonata packages

$ composer show --latest 'sonata-project/*'

sonata-project/admin-bundle              3.21.0 3.21.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.3.2  3.3.2  Symfony SonataBlockBundle
sonata-project/cache                     1.0.7  1.0.7  Cache library
sonata-project/cache-bundle              2.3.1  2.3.1  This bundle provides caching services
sonata-project/classification-bundle     3.3.1  3.3.1  Symfony SonataClassificationBundle
sonata-project/core-bundle               3.4.0  3.4.0  Symfony SonataCoreBundle
sonata-project/datagrid-bundle           2.2.1  2.2.1  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.0.2  1.0.2  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.1.6  3.1.6  Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.2.0  2.2.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  1.7.1  1.7.1  Lightweight Exporter library
sonata-project/formatter-bundle          3.2.2  3.2.2  Symfony SonataFormatterBundle
sonata-project/media-bundle              3.6.0  3.6.0  Symfony SonataMediaBundle
sonata-project/notification-bundle       3.1.0  3.1.0  Symfony SonataNotificationBundle

Symfony packages

$ composer show --latest 'symfony/*'

symfony/monolog-bundle     v3.1.0 v3.1.0 Symfony MonologBundle
symfony/phpunit-bridge     v3.3.6 v3.3.6 Symfony PHPUnit Bridge
symfony/polyfill-apcu      v1.4.0 v1.4.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu  v1.4.0 v1.4.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring  v1.4.0 v1.4.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56     v1.4.0 v1.4.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70     v1.4.0 v1.4.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util      v1.4.0 v1.4.0 Symfony utilities for portability of PHP codes
symfony/security-acl       v3.0.0 v3.0.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.6.3 v3.0.3 Symfony SwiftmailerBundle
symfony/symfony            v3.3.6 v3.3.6 The Symfony PHP framework

PHP version

$ php -v
PHP 7.1.8-2+ubuntu16.04.1+deb.sury.org+4 (cli) (built: Aug  4 2017 13:04:12) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.8-2+ubuntu16.04.1+deb.sury.org+4, Copyright (c) 1999-2017, by Zend Technologies
    with Xdebug v2.5.1, Copyright (c) 2002-2017, by Derick Rethans

Sonata admin CollectionType::class is not working as sonata_type_collection

When I am trying to use Sonata Admin following code,

use Sonata\AdminBundle\Form\Type\CollectionType;

....

->with('Phone Numbers', array('class' => 'col-lg-6'))
                ->add('phoneNumbers', CollectionType::class, array(
                    'by_reference' => true
                ), array(
                    'edit' => 'inline',
                    'inline' => 'table'
                ))
            ->end()
...

Collections are not listed on admin page, before I was using sonata_type_collection instead of CollectionType::class and it was working like a charm, but now after using composer update collections are not working. Do the new updates broke the way sonata admin works?

Do you think I am missing a point?

Most helpful comment

@virtualint please try Sonata\CoreBundle\Form\Type\CollectionType instead of Sonata\AdminBundle\Form\Type\CollectionType.

>All comments

@virtualint please try Sonata\CoreBundle\Form\Type\CollectionType instead of Sonata\AdminBundle\Form\Type\CollectionType.

Was this page helpful?
0 / 5 - 0 ratings