In my views with the entity product, I add relation with product variant, add some variant field in views, it's work!
But when I add product variation operations to the views, it failed, the error as below:


[20-Oct-2018 02:34:44 UTC] TypeError: Argument 1 passed to Drupal\Core\Entity\EntityRepository::getTranslationFromContext() must implement interface Drupal\Core\Entity\EntityInterface, null given, called in /Users/leo/projects/isp-docker/workspace/web/modules/contrib/commerce/modules/product/src/ProductVariationListBuilder.php on line 70 in /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Entity/EntityRepository.php on line 82 #0 /Users/leo/projects/isp-docker/workspace/web/modules/contrib/commerce/modules/product/src/ProductVariationListBuilder.php(70): Drupal\Core\Entity\EntityRepository->getTranslationFromContext(NULL)
#1 /Users/leo/projects/isp-docker/workspace/web/modules/contrib/commerce/modules/product/src/ProductVariationListBuilder.php(82): Drupal\commerce_product\ProductVariationListBuilder->__construct(Object(Drupal\Core\Entity\ContentEntityType), Object(Drupal\commerce_product\ProductVariationStorage), Object(Drupal\Core\Entity\EntityRepository), Object(Drupal\Core\Routing\CurrentRouteMatch), Object(Drupal\Core\Form\FormBuilder))
#2 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(250): Drupal\commerce_product\ProductVariationListBuilder::createInstance(Object(Drupal\Core\DependencyInjection\Container), Object(Drupal\Core\Entity\ContentEntityType))
#3 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(239): Drupal\Core\Entity\EntityTypeManager->createHandlerInstance('Drupal\\commerce...', Object(Drupal\Core\Entity\ContentEntityType))
#4 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(177): Drupal\Core\Entity\EntityTypeManager->getHandler('commerce_produc...', 'list_builder')
#5 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Entity/EntityManager.php(92): Drupal\Core\Entity\EntityTypeManager->getListBuilder('commerce_produc...')
#6 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/field/EntityOperations.php(112): Drupal\Core\Entity\EntityManager->getListBuilder('commerce_produc...')
#7 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/field/FieldPluginBase.php(1151): Drupal\views\Plugin\views\field\EntityOperations->render(Object(Drupal\views\ResultRow))
#8 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/views.theme.inc(235): Drupal\views\Plugin\views\field\FieldPluginBase->advancedRender(Object(Drupal\views\ResultRow))
#9 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Theme/ThemeManager.php(287): template_preprocess_views_view_field(Array, 'views_view_fiel...', Array)
#10 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('views_view_fiel...', Array)
#11 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false)
#12 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/field/FieldPluginBase.php(1743): Drupal\Core\Render\Renderer->render(Array)
#13 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(761): Drupal\views\Plugin\views\field\FieldPluginBase->theme(Object(Drupal\views\ResultRow))
#14 [internal function]: Drupal\views\Plugin\views\style\StylePluginBase->elementPreRenderRow(Array)
#15 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array)
#16 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false)
#17 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(709): Drupal\Core\Render\Renderer->render(Array)
#18 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(576): Drupal\views\Plugin\views\style\StylePluginBase->renderFields(Array)
#19 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(468): Drupal\views\Plugin\views\style\StylePluginBase->renderGrouping(Array, Array, true)
#20 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(2111): Drupal\views\Plugin\views\style\StylePluginBase->render(Array)
#21 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/ViewExecutable.php(1533): Drupal\views\Plugin\views\display\DisplayPluginBase->render()
#22 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Plugin/views/display/Page.php(183): Drupal\views\ViewExecutable->render()
#23 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/ViewExecutable.php(1630): Drupal\views\Plugin\views\display\Page->execute()
#24 /Users/leo/projects/isp-docker/workspace/web/core/modules/views/src/Element/View.php(77): Drupal\views\ViewExecutable->executeDisplay('page_1', Array)
#25 [internal function]: Drupal\views\Element\View::preRenderViewElement(Array)
#26 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array)
#27 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false)
#28 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(226): Drupal\Core\Render\Renderer->render(Array, false)
#29 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}()
#30 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(227): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#31 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/Render/MainContent/HtmlRenderer.php(117): Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#32 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/EventSubscriber/MainContentViewSubscriber.php(90): Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\CurrentRouteMatch))
#33 [internal function]: Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#34 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent), 'kernel.view', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#35 /Users/leo/projects/isp-docker/workspace/web/vendor/symfony/http-kernel/HttpKernel.php(156): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object(Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent))
#36 /Users/leo/projects/isp-docker/workspace/web/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#37 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#38 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#39 /Users/leo/projects/isp-docker/workspace/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#40 /Users/leo/projects/isp-docker/workspace/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#41 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#42 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#43 /Users/leo/projects/isp-docker/workspace/web/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#44 /Users/leo/projects/isp-docker/workspace/web/core/lib/Drupal/Core/DrupalKernel.php(669): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#45 /Users/leo/projects/isp-docker/workspace/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#46 {main}

Comments

John.lee created an issue. See original summary.

mglaman’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

But when I add product variation operations to the views, it failed, the error as below:

Can you elaborate? Is this the bulk operation items?

andyg5000’s picture

babipanghang’s picture

Edit: nevermind, solved in another linked issue already.