Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempted to call an undefined method named "buildCreateForm" of class "Sonata\MediaBundle\Block\*MediaBlockService". Did you mean to call "buildEditForm"? #1731

Closed
haivala opened this issue Mar 29, 2020 · 7 comments · Fixed by #1740

Comments

@haivala
Copy link
Contributor

haivala commented Mar 29, 2020

Environment

Sonata packages

$ composer show --latest 'sonata-project/*'
sonata-project/admin-bundle              3.63.0 3.63.0 The missing Symfony Admin Generator
sonata-project/block-bundle              3.18.4 4.2.0  Symfony SonataBlockBundle
sonata-project/cache                     1.1.1  2.0.1  Cache library
sonata-project/cache-bundle              2.4.2  3.2.1  This bundle provides caching services
sonata-project/classification-bundle     3.11.1 3.11.1 Symfony SonataClassificationBundle
sonata-project/core-bundle               3.18.0 3.18.0 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle           2.5.0  3.1.1  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.6.0  1.6.0  Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.15.0 3.15.0 Symfony Sonata / Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/exporter                  2.2.0  2.2.0  Lightweight Exporter library
sonata-project/formatter-bundle          4.1.3  4.1.3  Symfony SonataFormatterBundle
sonata-project/intl-bundle               2.7.0  2.7.0  Symfony SonataIntlBundle
sonata-project/media-bundle              3.24.0 3.24.0 Symfony SonataMediaBundle
sonata-project/notification-bundle       3.7.0  3.7.0  Symfony SonataNotificationBundle
sonata-project/page-bundle               3.16.0 3.16.0 This bundle provides a Site and Page management through container and block services
sonata-project/seo-bundle                2.10.0 2.10.0 Symfony SonataSeoBundle
sonata-project/timeline-bundle           3.5.0  3.5.0  Integrates SpyTimelineBundle into Sonata
sonata-project/translation-bundle        2.4.2  2.4.2  SonataTranslationBundle
sonata-project/user-bundle               4.5.2  4.5.2  Symfony SonataUserBundle

Symfony packages

$ composer show --latest 'symfony/*'
symfony/mime                       v4.4.6  v5.0.6  A library to manipulate MIME messages
symfony/monolog-bridge             v4.4.6  v5.0.6  Symfony Monolog Bridge
symfony/monolog-bundle             v3.5.0  v3.5.0  Symfony MonologBundle
symfony/options-resolver           v4.4.6  v5.0.6  Symfony OptionsResolver Component
symfony/orm-pack                   v1.0.8  v1.0.8  A pack for the Doctrine ORM
symfony/polyfill-ctype             v1.15.0 v1.15.0 Symfony polyfill for ctype functions
symfony/polyfill-iconv             v1.15.0 v1.15.0 Symfony polyfill for the Iconv extension
symfony/polyfill-intl-icu          v1.15.0 v1.15.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn          v1.15.0 v1.15.0 Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-mbstring          v1.15.0 v1.15.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.15.0 v1.15.0 Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.15.0 v1.15.0 Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/process                    v4.4.6  v5.0.6  Symfony Process Component
symfony/profiler-pack              v1.0.4  v1.0.4  A pack for the Symfony web profiler
symfony/property-access            v4.4.6  v5.0.6  Symfony PropertyAccess Component
symfony/routing                    v4.4.6  v5.0.6  Symfony Routing Component
symfony/security-acl               v3.0.4  v3.0.4  Symfony Security Component - ACL (Access Control List)
symfony/security-bundle            v4.4.6  v5.0.6  Symfony SecurityBundle
symfony/security-core              v4.4.6  v5.0.6  Symfony Security Component - Core Library
symfony/security-csrf              v4.4.6  v5.0.6  Symfony Security Component - CSRF Library
symfony/security-guard             v4.4.6  v5.0.6  Symfony Security Component - Guard
symfony/security-http              v4.4.6  v5.0.6  Symfony Security Component - HTTP Integration
symfony/service-contracts          v2.0.1  v2.0.1  Generic abstractions related to writing services
symfony/stopwatch                  v5.0.5  v5.0.6  Symfony Stopwatch Component
symfony/swiftmailer-bundle         v3.4.0  v3.4.0  Symfony SwiftmailerBundle
symfony/templating                 v4.4.6  v5.0.6  Symfony Templating Component
symfony/translation                v4.4.6  v5.0.6  Symfony Translation Component
symfony/translation-contracts      v2.0.1  v2.0.1  Generic abstractions related to translation
symfony/twig-bridge                v4.4.6  v5.0.6  Symfony Twig Bridge
symfony/twig-bundle                v4.4.6  v5.0.6  Symfony TwigBundle
symfony/validator                  v4.4.6  v5.0.6  Symfony Validator Component
symfony/var-dumper                 v5.0.5  v5.0.6  Symfony mechanism for exploring and dumping PHP variables
symfony/var-exporter               v5.0.5  v5.0.6  A blend of var_export() + serialize() to turn any serializable data structure to plain PHP code
symfony/web-profiler-bundle        v5.0.5  v5.0.6  Symfony WebProfilerBundle
symfony/webpack-encore-bundle      v1.7.3  v1.7.3  Integration with your Symfony app & Webpack Encore!
symfony/yaml                       v4.4.6  v5.0.6  Symfony Yaml Component

PHP version

$ php -v
PHP 7.4.2 (cli) (built: Jan 24 2020 07:18:03) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.2, Copyright (c), by Zend Technologies

Subject

Open PageBundles composer and try to add this bundles Block I get this error:
Attempted to call an undefined method named "buildCreateForm" of class "Sonata\MediaBundle\Block\FeatureMediaBlockService". Did you mean to call "buildEditForm"?
The blocks from this bundle don't even have names in page bundles composer.

Steps to reproduce

Open composer in page bundle.
Try to add media block anywhere.

Expected results

No error.

Actual results

Attempted to call an undefined method named "buildCreateForm" of class "Sonata\MediaBundle\Block\FeatureMediaBlockService". Did you mean to call "buildEditForm"?

@haivala haivala changed the title Attempted to call an undefined method named "buildCreateForm" of class "Sonata\MediaBundle\Block\FeatureMediaBlockService". Did you mean to call "buildEditForm"? Attempted to call an undefined method named "buildCreateForm" of class "Sonata\MediaBundle\Block\*MediaBlockService". Did you mean to call "buildEditForm"? Mar 29, 2020
@haivala
Copy link
Contributor Author

haivala commented Mar 29, 2020

I guess adding

    public function buildEditForm(FormMapper $formMapper, BlockInterface $block) 
    {
       $this->buildCreateForm($formMapper, $block);
    }

to MediaBlockService would be enough?
Is this how this should be handled?

@haivala
Copy link
Contributor Author

haivala commented Apr 5, 2020

I'm still waiting for an answer.

@core23
Copy link
Member

core23 commented Apr 5, 2020

Can you provide a PR with a fix @haivala ?

@haivala
Copy link
Contributor Author

haivala commented Apr 5, 2020

@core23 Is that how it should be handled?

@wbloszyk
Copy link
Member

wbloszyk commented Apr 5, 2020

This commit is problem. 9533247 After change AbstractAdminBlockService to AbstractBlockService some methods are missing (for Block 3 support). We should also add EditebleBlockServie to this change to keep info about using in Admin(required in Block 4).

@core23
Copy link
Member

core23 commented Apr 6, 2020

cc @franmomu

@franmomu
Copy link
Member

franmomu commented Apr 10, 2020

Sorry I didn't see the mention, IMHO we should fix the BC break and then (in another PR) see how to be compatible with BlockBundle 4.

franmomu added a commit to franmomu/SonataMediaBundle that referenced this issue Apr 20, 2020
wbloszyk added a commit to wbloszyk/SonataMediaBundle that referenced this issue May 5, 2020
@wbloszyk wbloszyk mentioned this issue May 5, 2020
wbloszyk added a commit to wbloszyk/SonataMediaBundle that referenced this issue May 8, 2020
wbloszyk added a commit to wbloszyk/SonataMediaBundle that referenced this issue May 18, 2020
wbloszyk added a commit to wbloszyk/SonataMediaBundle that referenced this issue May 18, 2020
wbloszyk added a commit to wbloszyk/SonataMediaBundle that referenced this issue May 18, 2020
jordisala1991 pushed a commit that referenced this issue Jun 18, 2020
* Add methods removed from AbstractAdminBlockService

* Improve BlockServices

Co-authored-by: Fran Moreno <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants