Exceptions
Exception
Twig\Error\ RuntimeError
{% set product = order_item.variant.product %}
{% form_theme form '@SyliusShop/Form/theme.html.twig' %}
<div class="ui segment" id="sylius-product-selecting-variant">
{{ sonata_block_render_event('sylius.shop.product.show.before_add_to_cart', {'product': product, 'order_item': order_item}) }}
in
var/cache/dev/twig/91/91fc370a0c00ec58b862eacc42ccced0.php
twig_get_attribute
(line 43)
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@SyliusShop/Product/Show/_addToCart.html.twig"));
// line 1
$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);
// line 2
echo "
";
// line 3
$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)
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
in
vendor/twig/twig/src/Template.php
->
displayWithErrorHandling
(line 378)
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
in
vendor/twig/twig/src/Template.php
->
display
(line 390)
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
in
vendor/twig/twig/src/TemplateWrapper.php
->
render
(line 45)
*/
public function render(array $context = []): string
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
return $this->template->render($context, \func_get_args()[1] ?? []);
}
/**
* Displays the template.
*
in
vendor/twig/twig/src/Environment.php
->
render
(line 318)
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function render($name, array $context = [])
{
return $this->load($name)->render($context);
}
/**
* Displays a template.
*
in
vendor/sylius/resource-bundle/src/Bundle/Controller/ControllerTrait.php
->
render
(line 247)
if ($this->container->has('templating')) {
@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);
$content = $this->container->get('templating')->render($view, $parameters);
} elseif ($this->container->has('twig')) {
$content = $this->container->get('twig')->render($view, $parameters);
} else {
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".');
}
if (null === $response) {
in
vendor/sylius/sylius/src/Sylius/Bundle/OrderBundle/Controller/OrderItemController.php
->
render
(line 100)
if (!$configuration->isHtmlRequest()) {
return $this->handleBadAjaxRequestView($configuration, $form);
}
return $this->render(
$configuration->getTemplate(CartActions::ADD . '.html'),
[
'configuration' => $configuration,
$this->metadata->getName() => $orderItem,
'form' => $form->createView(),
in
vendor/symfony/http-kernel/HttpKernel.php
->
addAction
(line 163)
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
in
vendor/symfony/http-kernel/HttpKernel.php
->
handleRaw
(line 75)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
in
vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php
->
handle
(line 86)
if (!IpUtils::checkIp('127.0.0.1', $trustedProxies)) {
Request::setTrustedProxies(array_merge($trustedProxies, ['127.0.0.1']), Request::getTrustedHeaderSet());
}
try {
return $kernel->handle($request, $type, $catch);
} finally {
// restore global state
Request::setTrustedProxies($trustedProxies, $trustedHeaderSet);
}
}
in
vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php
::
handle
(line 80)
$subRequest->attributes->add($reference->attributes);
}
$level = ob_get_level();
try {
return SubRequestHandler::handle($this->kernel, $subRequest, HttpKernelInterface::SUB_REQUEST, false);
} catch (\Exception $e) {
// we dispatch the exception event to trigger the logging
// the response that comes back is ignored
if (isset($options['ignore_errors']) && $options['ignore_errors'] && $this->dispatcher) {
$event = new ExceptionEvent($this->kernel, $request, HttpKernelInterface::SUB_REQUEST, $e);
in
vendor/symfony/http-kernel/Fragment/FragmentHandler.php
->
render
(line 85)
if (!$request = $this->requestStack->getCurrentRequest()) {
throw new \LogicException('Rendering a fragment can only be done when handling a Request.');
}
return $this->deliver($this->renderers[$renderer]->render($uri, $request, $options));
}
/**
* Delivers the Response as a string.
*
in
vendor/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php
->
render
(line 49)
if (!isset($this->initialized[$renderer]) && $this->container->has($renderer)) {
$this->addRenderer($this->container->get($renderer));
$this->initialized[$renderer] = true;
}
return parent::render($uri, $renderer, $options);
}
}
in
vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php
->
render
(line 46)
public function renderFragment($uri, array $options = []): string
{
$strategy = $options['strategy'] ?? 'inline';
unset($options['strategy']);
return $this->handler->render($uri, $strategy, $options);
}
/**
* Renders a fragment.
*
in
var/cache/dev/twig/c4/c431578c65f6bdac0c481b2a398fda40.php
->
renderFragment
(line 50)
echo " ";
$this->loadTemplate("@SyliusShop/Product/Show/_outOfStock.html.twig", "@SyliusShop/Product/Show/_inventory.html.twig", 2)->display($context);
} else {
// line 4
echo " ";
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)]));
echo "
";
}
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
in
vendor/twig/twig/src/Template.php
->
doDisplay
(line 405)
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
in
vendor/twig/twig/src/Template.php
->
displayWithErrorHandling
(line 378)
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
in
var/cache/dev/twig/02/02a9a0ce12c632bc130b172ecc259a82.php
->
display
(line 149)
";
// line 66
echo "
";
// line 67
$this->loadTemplate("@SyliusShop/Product/Show/_inventory.html.twig", "@SyliusShop/Product/show.html.twig", 67)->display($context);
// line 68
echo " <div class=\"ui hidden divider\"></div>
";
// line 71
in
vendor/twig/twig/src/Template.php
->
block_content
(line 182)
throw new \LogicException('A block must be a method on a \Twig\Template instance.');
}
if (null !== $template) {
try {
$template->$block($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($template->getSourceContext());
}
in
var/cache/dev/twig/44/443ff7f9e40a46199fe7514c065269c6.php
->
displayBlock
(line 113)
echo $this->env->getRuntime('Sonata\BlockBundle\Templating\Helper\BlockHelper')->renderEvent("sylius.shop.layout.before_content");
echo "
";
// line 54
$this->displayBlock('content', $context, $blocks);
// line 56
echo " ";
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"]));
echo "
";
in
vendor/twig/twig/src/Template.php
->
doDisplay
(line 405)
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
in
vendor/twig/twig/src/Template.php
->
displayWithErrorHandling
(line 378)
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
in
var/cache/dev/twig/02/02a9a0ce12c632bc130b172ecc259a82.php
->
display
(line 49)
$__internal_6f47bbe9983af81f1e7450e9a3e3768f = $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template", "@SyliusShop/Product/show.html.twig"));
$this->parent = $this->loadTemplate("@SyliusShop/layout.html.twig", "@SyliusShop/Product/show.html.twig", 1);
$this->parent->display($context, array_merge($this->blocks, $blocks));
$__internal_5a27a8ba21ca79b61932376b2fa922d2->leave($__internal_5a27a8ba21ca79b61932376b2fa922d2_prof);
$__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
in
vendor/twig/twig/src/Template.php
->
doDisplay
(line 405)
}
protected function displayWithErrorHandling(array $context, array $blocks = [])
{
try {
$this->doDisplay($context, $blocks);
} catch (Error $e) {
if (!$e->getSourceContext()) {
$e->setSourceContext($this->getSourceContext());
}
in
vendor/twig/twig/src/Template.php
->
displayWithErrorHandling
(line 378)
return $this->blocks;
}
public function display(array $context, array $blocks = [])
{
$this->displayWithErrorHandling($this->env->mergeGlobals($context), array_merge($this->blocks, $blocks));
}
public function render(array $context)
{
$level = ob_get_level();
in
vendor/twig/twig/src/Template.php
->
display
(line 390)
ob_start();
} else {
ob_start(function () { return ''; });
}
try {
$this->display($context);
} catch (\Throwable $e) {
while (ob_get_level() > $level) {
ob_end_clean();
}
in
vendor/twig/twig/src/TemplateWrapper.php
->
render
(line 45)
*/
public function render(array $context = []): string
{
// using func_get_args() allows to not expose the blocks argument
// as it should only be used by internal code
return $this->template->render($context, \func_get_args()[1] ?? []);
}
/**
* Displays the template.
*
in
vendor/twig/twig/src/Environment.php
->
render
(line 318)
* @throws SyntaxError When an error occurred during compilation
* @throws RuntimeError When an error occurred during rendering
*/
public function render($name, array $context = [])
{
return $this->load($name)->render($context);
}
/**
* Displays a template.
*
in
vendor/sylius/resource-bundle/src/Bundle/Controller/ControllerTrait.php
->
render
(line 247)
if ($this->container->has('templating')) {
@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);
$content = $this->container->get('templating')->render($view, $parameters);
} elseif ($this->container->has('twig')) {
$content = $this->container->get('twig')->render($view, $parameters);
} else {
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".');
}
if (null === $response) {
in
vendor/sylius/resource-bundle/src/Bundle/Controller/ResourceController.php
->
render
(line 126)
if (null !== $eventResponse) {
return $eventResponse;
}
if ($configuration->isHtmlRequest()) {
return $this->render($configuration->getTemplate(ResourceActions::SHOW . '.html'), [
'configuration' => $configuration,
'metadata' => $this->metadata,
'resource' => $resource,
$this->metadata->getName() => $resource,
]);
in
vendor/symfony/http-kernel/HttpKernel.php
->
showAction
(line 163)
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
in
vendor/symfony/http-kernel/HttpKernel.php
->
handleRaw
(line 75)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
in
vendor/symfony/http-kernel/Kernel.php
->
handle
(line 202)
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
Request::setTrustedHosts([$trustedHosts]);
}
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$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) |