https://www.hephaestos.net/en/products/swissboard-v1-0

Exceptions

Impossible to access an attribute ("product") on a null variable.

Exception

Twig\Error\ RuntimeError

  1. {% set product = order_item.variant.product %}
  2. {% form_theme form '@SyliusShop/Form/theme.html.twig' %}
  3. <div class="ui segment" id="sylius-product-selecting-variant">
  4. {{ sonata_block_render_event('sylius.shop.product.show.before_add_to_cart', {'product': product, 'order_item': order_item}) }}
  1. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  2. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@SyliusShop/Product/Show/_addToCart.html.twig"));
  3. // line 1
  4. $context["product"] = twig_get_attribute($this->env, $this->source, twig_get_attribute($this->env, $this->source, (isset($context["order_item"]) || array_key_exists("order_item", $context) ? $context["order_item"] : (function () { throw new RuntimeError('Variable "order_item" does not exist.', 1, $this->source); })()), "variant", [], "any", false, false, false, 1), "product", [], "any", false, false, false, 1);
  5. // line 2
  6. echo "
  7. ";
  8. // line 3
  9. $this->env->getRuntime("Symfony\\Component\\Form\\FormRenderer")->setTheme((isset($context["form"]) || array_key_exists("form", $context) ? $context["form"] : (function () { throw new RuntimeError('Variable "form" does not exist.', 3, $this->source); })()), [0 => "@SyliusShop/Form/theme.html.twig"], true);
in vendor/twig/twig/src/Template.php -> doDisplay (line 405)
  1. }
  2. protected function displayWithErrorHandling(array $context, array $blocks = [])
  3. {
  4. try {
  5. $this->doDisplay($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($this->getSourceContext());
  9. }
in vendor/twig/twig/src/Template.php -> displayWithErrorHandling (line 378)
  1. return $this->blocks;
  2. }
  3. public function display(array $context, array $blocks = [])
  4. {
  5. $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
  6. }
  7. public function render(array $context)
  8. {
  9. $level = ob_get_level();
in vendor/twig/twig/src/Template.php -> display (line 390)
  1. ob_start();
  2. } else {
  3. ob_start(function () { return ''; });
  4. }
  5. try {
  6. $this->display($context);
  7. } catch (\Throwable $e) {
  8. while (ob_get_level() > $level) {
  9. ob_end_clean();
  10. }
  1. */
  2. public function render(array $context = []): string
  3. {
  4. // using func_get_args() allows to not expose the blocks argument
  5. // as it should only be used by internal code
  6. return $this->template->render($context, \func_get_args()[1] ?? []);
  7. }
  8. /**
  9. * Displays the template.
  10. *
  1. * @throws SyntaxError When an error occurred during compilation
  2. * @throws RuntimeError When an error occurred during rendering
  3. */
  4. public function render($name, array $context = [])
  5. {
  6. return $this->load($name)->render($context);
  7. }
  8. /**
  9. * Displays a template.
  10. *
  1. if ($this->container->has('templating')) {
  2. @trigger_error('Using the "templating" service is deprecated since Symfony 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);
  3. $content = $this->container->get('templating')->render($view, $parameters);
  4. } elseif ($this->container->has('twig')) {
  5. $content = $this->container->get('twig')->render($view, $parameters);
  6. } else {
  7. throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
  8. }
  9. if (null === $response) {
  1. if (!$configuration->isHtmlRequest()) {
  2. return $this->handleBadAjaxRequestView($configuration, $form);
  3. }
  4. return $this->render(
  5. $configuration->getTemplate(CartActions::ADD . '.html'),
  6. [
  7. 'configuration' => $configuration,
  8. $this->metadata->getName() => $orderItem,
  9. 'form' => $form->createView(),
  1. $this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
  2. $controller = $event->getController();
  3. $arguments = $event->getArguments();
  4. // call controller
  5. $response = $controller(...$arguments);
  6. // view
  7. if (!$response instanceof Response) {
  8. $event = new ViewEvent($this, $request, $type, $response);
  9. $this->dispatcher->dispatch($event, KernelEvents::VIEW);
  1. {
  2. $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3. $this->requestStack->push($request);
  4. try {
  5. return $this->handleRaw($request, $type);
  6. } catch (\Exception $e) {
  7. if ($e instanceof RequestExceptionInterface) {
  8. $e = new BadRequestHttpException($e->getMessage(), $e);
  9. }
  10. if (false === $catch) {
  1. if (!IpUtils::checkIp('127.0.0.1', $trustedProxies)) {
  2. Request::setTrustedProxies(array_merge($trustedProxies, ['127.0.0.1']), Request::getTrustedHeaderSet());
  3. }
  4. try {
  5. return $kernel->handle($request, $type, $catch);
  6. } finally {
  7. // restore global state
  8. Request::setTrustedProxies($trustedProxies, $trustedHeaderSet);
  9. }
  10. }
  1. $subRequest->attributes->add($reference->attributes);
  2. }
  3. $level = ob_get_level();
  4. try {
  5. return SubRequestHandler::handle($this->kernel, $subRequest, HttpKernelInterface::SUB_REQUEST, false);
  6. } catch (\Exception $e) {
  7. // we dispatch the exception event to trigger the logging
  8. // the response that comes back is ignored
  9. if (isset($options['ignore_errors']) && $options['ignore_errors'] && $this->dispatcher) {
  10. $event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::SUB_REQUEST, $e);
  1. if (!$request = $this->requestStack->getCurrentRequest()) {
  2. throw new \LogicException('Rendering a fragment can only be done when handling a Request.');
  3. }
  4. return $this->deliver($this->renderers[$renderer]->render($uri, $request, $options));
  5. }
  6. /**
  7. * Delivers the Response as a string.
  8. *
  1. if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) {
  2. $this->addRenderer($this->container->get($renderer));
  3. $this->initialized[$renderer] = true;
  4. }
  5. return parent::render($uri, $renderer, $options);
  6. }
  7. }
  1. public function renderFragment($uri, array $options = []): string
  2. {
  3. $strategy = $options['strategy'] ?? 'inline';
  4. unset($options['strategy']);
  5. return $this->handler->render($uri, $strategy, $options);
  6. }
  7. /**
  8. * Renders a fragment.
  9. *
  1. echo " ";
  2. $this->loadTemplate("@SyliusShop/Product/Show/_outOfStock.html.twig", "@SyliusShop/Product/Show/_inventory.html.twig", 2)->display($context);
  3. } else {
  4. // line 4
  5. echo " ";
  6. echo $this->env->getRuntime('Symfony\Bridge\Twig\Extension\HttpKernelRuntime')->renderFragment($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getUrl("sylius_shop_partial_cart_add_item", ["template" => "@SyliusShop/Product/Show/_addToCart.html.twig", "productId" => twig_get_attribute($this->env, $this->source, (isset($context["product"]) || array_key_exists("product", $context) ? $context["product"] : (function () { throw new RuntimeError('Variable "product" does not exist.', 4, $this->source); })()), "id", [], "any", false, false, false, 4)]));
  7. echo "
  8. ";
  9. }
  10. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
in vendor/twig/twig/src/Template.php -> doDisplay (line 405)
  1. }
  2. protected function displayWithErrorHandling(array $context, array $blocks = [])
  3. {
  4. try {
  5. $this->doDisplay($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($this->getSourceContext());
  9. }
in vendor/twig/twig/src/Template.php -> displayWithErrorHandling (line 378)
  1. return $this->blocks;
  2. }
  3. public function display(array $context, array $blocks = [])
  4. {
  5. $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
  6. }
  7. public function render(array $context)
  8. {
  9. $level = ob_get_level();
  1. ";
  2. // line 66
  3. echo "
  4. ";
  5. // line 67
  6. $this->loadTemplate("@SyliusShop/Product/Show/_inventory.html.twig", "@SyliusShop/Product/show.html.twig", 67)->display($context);
  7. // line 68
  8. echo " <div class=\"ui hidden divider\"></div>
  9. ";
  10. // line 71
in vendor/twig/twig/src/Template.php -> block_content (line 182)
  1. throw new \LogicException('A block must be a method on a \Twig\Template instance.');
  2. }
  3. if (null !== $template) {
  4. try {
  5. $template->$block($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($template->getSourceContext());
  9. }
  1. echo $this->env->getRuntime('Sonata\BlockBundle\Templating\Helper\BlockHelper')->renderEvent("sylius.shop.layout.before_content");
  2. echo "
  3. ";
  4. // line 54
  5. $this->displayBlock('content', $context, $blocks);
  6. // line 56
  7. echo " ";
  8. echo $this->env->getRuntime('Symfony\Bridge\Twig\Extension\HttpKernelRuntime')->renderFragment($this->extensions['Symfony\Bridge\Twig\Extension\RoutingExtension']->getPath("bitbag_sylius_cms_plugin_shop_block_index_by_section_code", ["sectionCode" => "blog", "template" => "@BitBagSyliusCmsPlugin/Shop/Block/index.html.twig"]));
  9. echo "
  10. ";
in vendor/twig/twig/src/Template.php -> doDisplay (line 405)
  1. }
  2. protected function displayWithErrorHandling(array $context, array $blocks = [])
  3. {
  4. try {
  5. $this->doDisplay($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($this->getSourceContext());
  9. }
in vendor/twig/twig/src/Template.php -> displayWithErrorHandling (line 378)
  1. return $this->blocks;
  2. }
  3. public function display(array $context, array $blocks = [])
  4. {
  5. $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
  6. }
  7. public function render(array $context)
  8. {
  9. $level = ob_get_level();
  1. $__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  2. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@SyliusShop/Product/show.html.twig"));
  3. $this->parent = $this->loadTemplate("@SyliusShop/layout.html.twig", "@SyliusShop/Product/show.html.twig", 1);
  4. $this->parent->display($context, array_merge($this->blocks, $blocks));
  5. $__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
  6. $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
in vendor/twig/twig/src/Template.php -> doDisplay (line 405)
  1. }
  2. protected function displayWithErrorHandling(array $context, array $blocks = [])
  3. {
  4. try {
  5. $this->doDisplay($context, $blocks);
  6. } catch (Error $e) {
  7. if (!$e->getSourceContext()) {
  8. $e->setSourceContext($this->getSourceContext());
  9. }
in vendor/twig/twig/src/Template.php -> displayWithErrorHandling (line 378)
  1. return $this->blocks;
  2. }
  3. public function display(array $context, array $blocks = [])
  4. {
  5. $this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
  6. }
  7. public function render(array $context)
  8. {
  9. $level = ob_get_level();
in vendor/twig/twig/src/Template.php -> display (line 390)
  1. ob_start();
  2. } else {
  3. ob_start(function () { return ''; });
  4. }
  5. try {
  6. $this->display($context);
  7. } catch (\Throwable $e) {
  8. while (ob_get_level() > $level) {
  9. ob_end_clean();
  10. }
  1. */
  2. public function render(array $context = []): string
  3. {
  4. // using func_get_args() allows to not expose the blocks argument
  5. // as it should only be used by internal code
  6. return $this->template->render($context, \func_get_args()[1] ?? []);
  7. }
  8. /**
  9. * Displays the template.
  10. *
  1. * @throws SyntaxError When an error occurred during compilation
  2. * @throws RuntimeError When an error occurred during rendering
  3. */
  4. public function render($name, array $context = [])
  5. {
  6. return $this->load($name)->render($context);
  7. }
  8. /**
  9. * Displays a template.
  10. *
  1. if ($this->container->has('templating')) {
  2. @trigger_error('Using the "templating" service is deprecated since Symfony 4.3 and will be removed in 5.0; use Twig instead.', \E_USER_DEPRECATED);
  3. $content = $this->container->get('templating')->render($view, $parameters);
  4. } elseif ($this->container->has('twig')) {
  5. $content = $this->container->get('twig')->render($view, $parameters);
  6. } else {
  7. throw new \LogicException('You can not use the "render" method if the Templating Component or the Twig Bundle are not available. Try running "composer require symfony/twig-bundle".');
  8. }
  9. if (null === $response) {
  1. if (null !== $eventResponse) {
  2. return $eventResponse;
  3. }
  4. if ($configuration->isHtmlRequest()) {
  5. return $this->render($configuration->getTemplate(ResourceActions::SHOW . '.html'), [
  6. 'configuration' => $configuration,
  7. 'metadata' => $this->metadata,
  8. 'resource' => $resource,
  9. $this->metadata->getName() => $resource,
  10. ]);
  1. $this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
  2. $controller = $event->getController();
  3. $arguments = $event->getArguments();
  4. // call controller
  5. $response = $controller(...$arguments);
  6. // view
  7. if (!$response instanceof Response) {
  8. $event = new ViewEvent($this, $request, $type, $response);
  9. $this->dispatcher->dispatch($event, KernelEvents::VIEW);
  1. {
  2. $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  3. $this->requestStack->push($request);
  4. try {
  5. return $this->handleRaw($request, $type);
  6. } catch (\Exception $e) {
  7. if ($e instanceof RequestExceptionInterface) {
  8. $e = new BadRequestHttpException($e->getMessage(), $e);
  9. }
  10. if (false === $catch) {
  1. $this->boot();
  2. ++$this->requestStackSize;
  3. $this->resetServices = true;
  4. try {
  5. return $this->getHttpKernel()->handle($request, $type, $catch);
  6. } finally {
  7. --$this->requestStackSize;
  8. }
  9. }
Kernel->handle() in public/index.php (line 25)
  1. Request::setTrustedHosts([$trustedHosts]);
  2. }
  3. $kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
  4. $request = Request::createFromGlobals();
  5. $response = $kernel->handle($request);
  6. $response->send();
  7. $kernel->terminate($request, $response);

Logs

No log messages

Stack Trace

RuntimeError
Twig\Error\RuntimeError:
Impossible to access an attribute ("product") on a null variable.

  at templates/bundles/SyliusShopBundle/Product/Show/_addToCart.html.twig:1
  at twig_get_attribute()
     (var/cache/dev/twig/91/91fc370a0c00ec58b862eacc42ccced0.php:43)
  at __TwigTemplate_3f9a0a4ef7388f1e2388a9b6327ae63a->doDisplay()
     (vendor/twig/twig/src/Template.php:405)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:378)
  at Twig\Template->display()
     (vendor/twig/twig/src/Template.php:390)
  at Twig\Template->render()
     (vendor/twig/twig/src/TemplateWrapper.php:45)
  at Twig\TemplateWrapper->render()
     (vendor/twig/twig/src/Environment.php:318)
  at Twig\Environment->render()
     (vendor/sylius/resource-bundle/src/Bundle/Controller/ControllerTrait.php:247)
  at Sylius\Bundle\ResourceBundle\Controller\ResourceController->render()
     (vendor/sylius/sylius/src/Sylius/Bundle/OrderBundle/Controller/OrderItemController.php:100)
  at Sylius\Bundle\OrderBundle\Controller\OrderItemController->addAction()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php:86)
  at Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle()
     (vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php:80)
  at Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer->render()
     (vendor/symfony/http-kernel/Fragment/FragmentHandler.php:85)
  at Symfony\Component\HttpKernel\Fragment\FragmentHandler->render()
     (vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php:49)
  at Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler->render()
     (vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php:46)
  at Symfony\Bridge\Twig\Extension\HttpKernelRuntime->renderFragment()
     (var/cache/dev/twig/c4/c431578c65f6bdac0c481b2a398fda40.php:50)
  at __TwigTemplate_f1e0c78271cf992099077becc8ce7631->doDisplay()
     (vendor/twig/twig/src/Template.php:405)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:378)
  at Twig\Template->display()
     (var/cache/dev/twig/02/02a9a0ce12c632bc130b172ecc259a82.php:149)
  at __TwigTemplate_012abdf69ab2e1f9e493f768f7a2911d->block_content()
     (vendor/twig/twig/src/Template.php:182)
  at Twig\Template->displayBlock()
     (var/cache/dev/twig/44/443ff7f9e40a46199fe7514c065269c6.php:113)
  at __TwigTemplate_1a196adb34480f127c3fc2ce74236422->doDisplay()
     (vendor/twig/twig/src/Template.php:405)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:378)
  at Twig\Template->display()
     (var/cache/dev/twig/02/02a9a0ce12c632bc130b172ecc259a82.php:49)
  at __TwigTemplate_012abdf69ab2e1f9e493f768f7a2911d->doDisplay()
     (vendor/twig/twig/src/Template.php:405)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:378)
  at Twig\Template->display()
     (vendor/twig/twig/src/Template.php:390)
  at Twig\Template->render()
     (vendor/twig/twig/src/TemplateWrapper.php:45)
  at Twig\TemplateWrapper->render()
     (vendor/twig/twig/src/Environment.php:318)
  at Twig\Environment->render()
     (vendor/sylius/resource-bundle/src/Bundle/Controller/ControllerTrait.php:247)
  at Sylius\Bundle\ResourceBundle\Controller\ResourceController->render()
     (vendor/sylius/resource-bundle/src/Bundle/Controller/ResourceController.php:126)
  at Sylius\Bundle\ResourceBundle\Controller\ResourceController->showAction()
     (vendor/symfony/http-kernel/HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw()
     (vendor/symfony/http-kernel/HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle()
     (vendor/symfony/http-kernel/Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle()
     (public/index.php:25)