Error when administrator modifies an existing store :

Type 	php
Date 	Jeudi, 9 janvier, 2020 - 14:40
Utilisateur 	administrateur
Emplacement 	https://www.example.com/fr/store/19/edit?destination=%2Ffr%2Fadmin%2Fcommerce%2Fconfig%2Fstores
Référent 	https://www.example.com/
Message 	Error: Call to a member function id() on null in Drupal\commerce_marketplace\Form\MarketplaceForm->save() (line 83 of /var/www/www-example-com/web/modules/contrib/commerce_marketplace/src/Form/MarketplaceForm.php) #0 [internal function]: Drupal\commerce_marketplace\Form\MarketplaceForm->save(Array, Object(Drupal\Core\Form\FormState)) #1 /var/www/www-example-com/web/core/lib/Drupal/Core/Form/FormSubmitter.php(112): call_user_func_array(Array, Array) #2 /var/www/www-example-com/web/core/lib/Drupal/Core/Form/FormSubmitter.php(52): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) #3 /var/www/www-example-com/web/core/lib/Drupal/Core/Form/FormBuilder.php(591): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) #4 /var/www/www-example-com/web/core/lib/Drupal/Core/Form/FormBuilder.php(320): Drupal\Core\Form\FormBuilder->processForm('commerce_store_...', Array, Object(Drupal\Core\Form\FormState)) #5 /var/www/www-example-com/web/core/lib/Drupal/Core/Controller/FormController.php(91): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\commerce_marketplace\Form\MarketplaceForm), Object(Drupal\Core\Form\FormState)) #6 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch)) #7 /var/www/www-example-com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #8 /var/www/www-example-com/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #9 /var/www/www-example-com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #10 /var/www/www-example-com/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #11 /var/www/www-example-com/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #12 /var/www/www-example-com/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #13 /var/www/www-example-com/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #14 /var/www/www-example-com/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #15 /var/www/www-example-com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #16 /var/www/www-example-com/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #17 /var/www/www-example-com/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #18 /var/www/www-example-com/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #19 /var/www/www-example-com/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #20 /var/www/www-example-com/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #21 /var/www/www-example-com/web/core/lib/Drupal/Core/DrupalKernel.php(694): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #22 /var/www/www-example-com/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #23 {main}.
Severity 	Erreur
CommentFileSizeAuthor
#7 3105360-7.patch1.97 KBdrugan
#4 store-saved.png130.38 KBdrugan
#4 owner-field-enabled.png119.29 KBdrugan

Comments

zenimagine created an issue. See original summary.

drugan’s picture

Priority: Major » Normal
Related issues: +#3093969: Don't show the uid field by default on the store form

The solution for this issue will be provided a bit later.

In the meantime please, keep the Owner field on a store type form display enabled.

zenimagine’s picture

I just activated the owner field on the form but I still receive the same error when I modify a store

drugan’s picture

Status: Active » Postponed (maintainer needs more info)
StatusFileSize
new119.29 KB
new130.38 KB

I have Drupal 8.8.0 and Drupal Commerce latest dev installed and have no issues when saving a store. See screenshots.

Which versions do you use?

zenimagine’s picture

@drugan Drupal 8.8.1 and Commerce 2.16, here is the content of composer.json :

{
    "name": "drupal-composer/drupal-project",
    "description": "Project template for Drupal 8 projects with composer",
    "type": "project",
    "license": "GPL-2.0+",
    "authors": [
        {
            "name": "",
            "role": ""
        }
    ],
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    },
    "require": {
        "composer/installers": "^1.2",
        "cweagans/composer-patches": "^1.6",
        "drupal-composer/drupal-scaffold": "^2.2",
        "drupal/advanced_pwa": "^1.1",
        "drupal/allowed_formats": "^1.2",
        "drupal/antibot": "^1.2",
        "drupal/bootstrap": "^3.20",
        "drupal/bootstrap_basic_image_gallery": "1.x-dev",
        "drupal/bootstrap_languages": "1.x-dev",
        "drupal/ckwordcount": "^1.0",
        "drupal/commerce": "^2.16",
        "drupal/commerce_checkout": "^2.13",
        "drupal/commerce_marketplace": "1.x-dev",
        "drupal/commerce_pos": "^2.0",
        "drupal/commerce_pricelist": "2.x-dev",
        "drupal/commerce_recurring": "^1.0",
        "drupal/commerce_reports": "^1.0",
        "drupal/commerce_shipping": "^2.0",
        "drupal/commerce_stock": "1.x-dev",
        "drupal/commerce_stripe": "^1.0",
        "drupal/console": "~1.0",
        "drupal/core": "^8.7",
        "drupal/diff": "^1.0",
        "drupal/entity_legal": "^2.0",
        "drupal/entity_print": "^2.1",
        "drupal/entity_reference_revisions": "^1.6",
        "drupal/facets": "^1.0",
        "drupal/field_validation": "^1.0",
        "drupal/flag": "^4.0",
        "drupal/flag_search_api": "^1.3",
        "drupal/flood_unblock": "^1.5",
        "drupal/geolocation": "^3.0",
        "drupal/group": "^1.0",
        "drupal/image_delta_formatter": "^1.0",
        "drupal/image_widget_crop": "^2.2",
        "drupal/masquerade": "^2.0",
        "drupal/message": "^1.0",
        "drupal/message_notify": "^1.0",
        "drupal/message_ui": "1.x-dev",
        "drupal/metatag": "^1.7",
        "drupal/office_hours": "1.x-dev",
        "drupal/paragraphs": "^1.3",
        "drupal/pathauto": "^1.6",
        "drupal/price_difference_formatter": "^1.1",
        "drupal/private_message": "2.x-dev",
        "drupal/private_message_flood": "^1.0",
        "drupal/profile": "^1.0",
        "drupal/pwa": "^1.2",
        "drupal/redirect": "^1.5",
        "drupal/schema_metatag": "^1.0",
        "drupal/search_api": "^1.14",
        "drupal/search_api_autocomplete": "^1.0",
        "drupal/search_api_location": "^1.0",
        "drupal/search_api_solr": "^3.6",
        "drupal/shariff": "^1.6",
        "drupal/simple_sitemap": "^3.2",
        "drupal/swiftmailer": "^1.0",
        "drupal/token": "^1.6",
        "drupal/tour_ui": "^1.0",
        "drupal/twig_tweak": "^2.3",
        "drupal/user_online_status": "^1.0",
        "drupal/views_block_filter_block": "^1.0",
        "drupal/views_bootstrap": "3.x-dev",
        "drupal/views_infinite_scroll": "1.x-dev",
        "drupal/viewsreference": "^1.4",
        "drupal/webform": "^5.0",
        "drupal/webform_views": "^5.0",
        "drupal/yoast_seo": "^2.0",
        "drush/drush": "^9.4",
        "mikehaertl/phpwkhtmltopdf": "~2.1",
        "symfony/event-dispatcher": "4.3.4 as 3.4.99",
        "tecnickcom/tcpdf": "~6",
        "webflo/drupal-finder": "^1.1",
        "webmozart/path-util": "^2.3",
        "wikimedia/composer-merge-plugin": "^1.4"
    },
    "require-dev": {
        "behat/mink": "~1.7",
        "behat/mink-goutte-driver": "~1.2",
        "jcalderonzumba/gastonjs": "~1.0.2",
        "jcalderonzumba/mink-phantomjs-driver": "~0.3.1",
        "mikey179/vfsstream": "~1.2",
        "phpunit/phpunit": ">=4.8.28 <5",
        "symfony/css-selector": "~2.8"
    },
    "conflict": {
        "drupal/drupal": "*"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "sort-packages": true
    },
    "autoload": {
        "classmap": [
            "scripts/composer/ScriptHandler.php"
        ]
    },
    "scripts": {
        "drupal-scaffold": "DrupalComposer\\DrupalScaffold\\Plugin::scaffold",
        "pre-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "pre-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::checkComposerVersion"
        ],
        "post-install-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ],
        "post-update-cmd": [
            "DrupalProject\\composer\\ScriptHandler::createRequiredFiles"
        ]
    },
    "extra": {
        "merge-plugin": {
            "include": [
                "web/modules/contrib/webform/composer.libraries.json"
            ]
        },
        "installer-paths": {
            "web/core": [
                "type:drupal-core"
            ],
            "web/libraries/{$name}": [
                "type:drupal-library"
            ],
            "web/modules/contrib/{$name}": [
                "type:drupal-module"
            ],
            "web/profiles/contrib/{$name}": [
                "type:drupal-profile"
            ],
            "web/themes/contrib/{$name}": [
                "type:drupal-theme"
            ],
            "drush/contrib/{$name}": [
                "type:drupal-drush"
            ]
        },
        "patches": {
            "drupal/core": {
                "Fetch User ID from route context views contextual filter for any entity": "https://www.drupal.org/files/issues/2019-07-28/fetch_user_id_from_route_for_all-2904908-23.patch"
            },
            "drupal/commerce": {
                "Allow products to be duplicated": "https://www.drupal.org/files/issues/2019-03-26/3042258-2-duplicate-product.patch"
            },
            "drupal/group": {
                "Add a field to view and edit content's groups": "https://www.drupal.org/files/issues/2019-11-13/group-field_to_view_and_edit_content_groups-2813405-215.patch"
            },
            "drupal/pathauto": {
                "Make sure path has a value before calling purge in pathauto_entity_delete()": "https://www.drupal.org/files/issues/2019-08-30/2939432-pathauto-25-d8.patch"
            },
            "drupal/commerce_marketplace": {
                "Remove the default_store config key replace it with isDefault() flag": "https://www.drupal.org/files/issues/2019-12-15/support_commerce_2.16_default_store-3099778-6.patch"
            }
        }
    }
}
drugan’s picture

Status: Postponed (maintainer needs more info) » Active

Smells something like the https://www.drupal.org/project/group is a culprit. I remember a couple of issues on the Drupal Commerce were related with this module.

So, in this case please wait a bit until any contrib module agnostic solution will be found for this issue.

drugan’s picture

Status: Active » Needs review
StatusFileSize
new1.97 KB

Let's test it.

zenimagine’s picture

@drugan Great, thank you the patch works

  • drugan committed 7e8e534 on 8.x-1.x
    Issue #3105360 by drugan, zenimagine: Error when administrator modifies...
drugan’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.