简体   繁体   中英

sonata ecommerce - Impossible to invoke a method ("hasroute") on a null variable

I'm a fan of sonata projet, but setup e-commerce module is quite insane

I have created new product provider, i follow all theses steps https://sonata-project.org/bundles/ecommerce/master/doc/reference/tutorials/create-product.html#configuration-backoffice

product provider is ok

But when i click on it "`Impossible to invoke a method ("hasroute") on a null variable.

Twig\Error\RuntimeError:
Impossible to invoke a method ("hasroute") on a null variable.

  at vendor/sonata-project/admin-bundle/src/Resources/views/Form/form_admin_fields.html.twig:613
  at twig_get_attribute(object(Environment), object(Source), null, 'hasroute', array('list'), 'method', false, false, false, 613)
     (var/cache/dev/twig/1a/1a9bdba03ad1424df284f8c527d3514c85448a804e11ed9ad4d5ad856f76a77a.php:2037)
  at __TwigTemplate_257b0cad492d880883cd5a7582c74613fa66ee34ccb1a1c2088d411013c1176f->block_sonata_type_model_list_widget(array('value' => null, 'attr' => array('class' => ''), 'form' => object(FormView), 'id' => 's60956d878485a_image', 'name' => 'image', 'full_name' => 's60956d878485a[image]', 'disabled' => false, 'label' => 'form.label_image', 'label_format' => null, 'multipart' => false, 'block_prefixes' => array('form', 'text', 'sonata_type_model_list', '_s60956d878485a_image', 'sonata_product_admin_product_sonata_type_model_list', 'sonata_product_admin_product_image_sonata_type_model_list', 'sonata_product_admin_product_image_sonata_type_model_list_image'), 'unique_block_prefix' => '_s60956d878485a_image', 'row_attr' => array(), 'translation_domain' => null, 'label_translation_parameters' => array(), 'attr_translation_parameters' => array(), 'cache_key' => '_s60956d878485a_image_sonata_type_model_list', 'errors' => 

Sonata config

$ /d/wamp64/bin/php/php7.3.5/php.exe bin/composer.phar info sonata*
sonata-project/admin-bundle              3.98.2 The missing Symfony Admin Generator
sonata-project/block-bundle              3.23.1 Symfony SonataBlockBundle
sonata-project/cache                     2.0.1  Cache library
sonata-project/classification-bundle     3.16.0 Symfony SonataClassificationBundle
sonata-project/comment-bundle            3.3.1  Integrate the FOSCommentBundle in the Sonata Project
sonata-project/core-bundle               3.20.0 Symfony SonataCoreBundle (abandoned)
sonata-project/datagrid-bundle           3.3.0  Symfony SonataDatagridBundle
sonata-project/doctrine-extensions       1.12.0 Doctrine2 behavioral extensions
sonata-project/doctrine-orm-admin-bundle 3.34.0 Integrate Doctrine ORM into the SonataAdminBundle
sonata-project/easy-extends-bundle       2.5.0  Symfony SonataEasyExtendsBundle
sonata-project/ecommerce                 3.5.2  E-Commerce solution provided by Sonata
sonata-project/entity-audit-bundle       1.3.1  Audit for Doctrine Entities
sonata-project/exporter                  2.6.2  Lightweight Exporter library
sonata-project/form-extensions           0.1.2  Symfony form extensions
sonata-project/formatter-bundle          4.5.0  Symfony SonataFormatterBundle
sonata-project/intl-bundle               2.10.1 Symfony SonataIntlBundle
sonata-project/media-bundle              3.31.1 Symfony SonataMediaBundle
sonata-project/media-orm-pack            1.0.0  A pack for SonataMediaBundle with ORM support
sonata-project/notification-bundle       3.12.0 Symfony SonataNotificationBundle
sonata-project/seo-bundle                2.13.0 Symfony SonataSeoBundle
sonata-project/timeline-bundle           3.7.0  Integrates SpyTimelineBundle into Sonata
sonata-project/twig-extensions           0.1.1  Sonata twig extensions
sonata-project/user-bundle               4.11.1 Symfony SonataUserBundle

please Help

I had the same issue;
you need to create an admin for the related child entity present in the parent admin.

Can you paste your Entities, Admin and service.yaml files?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM