Symfony Exception

RuntimeError

HTTP 500 Internal Server Error

Key "0" does not exist as the array is empty.

Exception

Twig\Error\ RuntimeError

  1.                         <div class="gallery-header">
  2.                             <h2>{# {{ page.show.one.galleryTitle }} #} Галерея</h2>
  3.                         </div>
  4.                         <div class="row">
  5.                             {% set images = gallery[0].translatable.images %}
  6.                             {% set main_path = '/data/images/gallery/'~gallery[0].translatable.path %}
  7.                             <div class="col-sm-12">
  8.                                 <div class="gallery-fancybox">
  9.                                     <a class="gallery-view-one-current-image" href="{{ main_path|imagine_filter('watermark_filter') }}" data-fancybox="image">
  10.                                         <img src="{{ main_path|imagine_filter('watermark_filter') }}" alt="">
twig_get_attribute(object(Environment), object(Source), array(), 0, array(), 'array', false, false, false, 16) in var/cache/prod/twig/d0/d02cb4e22b8fd7f9aeb06392bd076d03971f7e822331a1bd20b463ad36abb9ee.php (line 75)
  1.                         </div>
  2.                         <div class=\"row\">
  3.                             ";
  4.         // line 16
  5.         $context["images"] = twig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source, (isset($context["gallery"]) || array_key_exists("gallery"$context) ? $context["gallery"] : (function () { throw new RuntimeError('Variable "gallery" does not exist.'16$this->source); })()), 0, [], "array"falsefalsefalse16), "translatable", [], "any"falsefalsefalse16), "images", [], "any"falsefalsefalse16);
  6.         // line 17
  7.         echo "                            ";
  8.         $context["main_path"] = ("/data/images/gallery/" twig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source, (isset($context["gallery"]) || array_key_exists("gallery"$context) ? $context["gallery"] : (function () { throw new RuntimeError('Variable "gallery" does not exist.'17$this->source); })()), 0, [], "array"falsefalsefalse17), "translatable", [], "any"falsefalsefalse17), "path", [], "any"falsefalsefalse17));
  9.         // line 18
  10.         echo "                            <div class=\"col-sm-12\">
__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af->block_body(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer), 'vote_cnt' => 0, 'vote_id' => 0), array('styles' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_styles'), 'body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'), 'script' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_script'))) in vendor/twig/twig/src/Template.php (line 184)
  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.                 }
Template->displayBlock('body', array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer), 'vote_cnt' => 0, 'vote_id' => 0), array('styles' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_styles'), 'body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'), 'script' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_script'))) in var/cache/prod/twig/a2/a20d295267c213b02700e9609bb72af8d70741f9f6288685e5114d59a38ea0c0.php (line 415)
  1.     </header>
  2.     <div class=\"container\" style=\"padding:0;background: #fff;\">
  3.         ";
  4.         // line 265
  5.         $this->displayBlock('body'$context$blocks);
  6.         // line 266
  7.         echo "    </div>
  8.     <div class=\"container\" style=\"background: #fff;\">
  9.         <div class=\"row\">
__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8->doDisplay(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer), 'vote_cnt' => 0, 'vote_id' => 0), array('styles' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_styles'), 'body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'), 'script' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_script'))) in vendor/twig/twig/src/Template.php (line 407)
  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.             }
Template->displayWithErrorHandling(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer)), array('styles' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_styles'), 'body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'), 'script' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_script'))) in vendor/twig/twig/src/Template.php (line 380)
  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();
Template->display(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer)), array('body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'))) in var/cache/prod/twig/d0/d02cb4e22b8fd7f9aeb06392bd076d03971f7e822331a1bd20b463ad36abb9ee.php (line 45)
  1.         $macros $this->macros;
  2.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02 $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  3.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->enter($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""GalleryBundle:Default:gallery_view_one.html.twig"));
  4.         $this->parent $this->loadTemplate("::base.html.twig""GalleryBundle:Default:gallery_view_one.html.twig"1);
  5.         $this->parent->display($contextarray_merge($this->blocks$blocks));
  6.         
  7.         $__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02->leave($__internal_319393461309892924ff6e74d6d6e64287df64b63545b994e100d4ab223aed02_prof);
  8.     }
__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af->doDisplay(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer)), array('body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'))) in vendor/twig/twig/src/Template.php (line 407)
  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.             }
Template->displayWithErrorHandling(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer)), array('body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'))) in vendor/twig/twig/src/Template.php (line 380)
  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();
Template->display(array('gallery' => array())) in vendor/twig/twig/src/Template.php (line 392)
  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.             }
Template->render(array('gallery' => array())) in vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php (line 50)
  1.      *
  2.      * @throws Error if something went wrong like a thrown exception while rendering the template
  3.      */
  4.     public function render($name, array $parameters = [])
  5.     {
  6.         return $this->load($name)->render($parameters);
  7.     }
  8.     /**
  9.      * {@inheritdoc}
  10.      *
TwigEngine->render('GalleryBundle:Default:gallery_view_one.html.twig', array('gallery' => array())) in vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php (line 286)
  1.      * @final since version 3.4
  2.      */
  3.     protected function render($view, array $parameters = [], Response $response null)
  4.     {
  5.         if ($this->container->has('templating')) {
  6.             $content $this->container->get('templating')->render($view$parameters);
  7.         } elseif ($this->container->has('twig')) {
  8.             $content $this->container->get('twig')->render($view$parameters);
  9.         } else {
  10.             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".');
  11.         }
Controller->render('GalleryBundle:Default:gallery_view_one.html.twig', array('gallery' => array())) in src/GalleryBundle/Controller/DefaultController.php (line 249)
  1.             $em->persist($gallery[0]);
  2.             $em->flush();
  3.         }
  4.         // $images = $gallery[0]->getTranslatable()->getImages();
  5.         return $this->render("GalleryBundle:Default:gallery_view_one.html.twig", array('gallery' => $gallery));
  6.     }
  7.     public function galleryViewAllAction(Request $request$page$perpage)
  8.     {
  9. //        $galleries = $this->getDoctrine()->getRepository('GalleryBundle:Gallery')->getAllGallery();
DefaultController->galleryViewOneAction(object(Request), 'feierichne-vidkrittia-vidkrili-porto-franko2018') in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 151)
  1.         $this->dispatcher->dispatch(KernelEvents::CONTROLLER_ARGUMENTS$event);
  2.         $controller $event->getController();
  3.         $arguments $event->getArguments();
  4.         // call controller
  5.         $response = \call_user_func_array($controller$arguments);
  6.         // view
  7.         if (!$response instanceof Response) {
  8.             $event = new GetResponseForControllerResultEvent($this$request$type$response);
  9.             $this->dispatcher->dispatch(KernelEvents::VIEW$event);
HttpKernel->handleRaw(object(Request), 1) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php (line 68)
  1.     public function handle(Request $request$type HttpKernelInterface::MASTER_REQUEST$catch true)
  2.     {
  3.         $request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
  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) {
HttpKernel->handle(object(Request), 1, true) in vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php (line 200)
  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(object(Request)) in web/app.php (line 22)
  1. //$kernel = new AppCache($kernel);
  2. // When using the HttpCache, you need to call the method in your front controller instead of relying on the configuration parameter
  3. //Request::enableHttpMethodParameterOverride();
  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:
Key "0" does not exist as the array is empty.

  at src/GalleryBundle/Resources/views/Default/gallery_view_one.html.twig:16
  at twig_get_attribute(object(Environment), object(Source), array(), 0, array(), 'array', false, false, false, 16)
     (var/cache/prod/twig/d0/d02cb4e22b8fd7f9aeb06392bd076d03971f7e822331a1bd20b463ad36abb9ee.php:75)
  at __TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af->block_body(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer), 'vote_cnt' => 0, 'vote_id' => 0), array('styles' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_styles'), 'body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'), 'script' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_script')))
     (vendor/twig/twig/src/Template.php:184)
  at Twig\Template->displayBlock('body', array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer), 'vote_cnt' => 0, 'vote_id' => 0), array('styles' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_styles'), 'body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'), 'script' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_script')))
     (var/cache/prod/twig/a2/a20d295267c213b02700e9609bb72af8d70741f9f6288685e5114d59a38ea0c0.php:415)
  at __TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8->doDisplay(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer), 'vote_cnt' => 0, 'vote_id' => 0), array('styles' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_styles'), 'body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'), 'script' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_script')))
     (vendor/twig/twig/src/Template.php:407)
  at Twig\Template->displayWithErrorHandling(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer)), array('styles' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_styles'), 'body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body'), 'script' => array(object(__TwigTemplate_8d37b7d43b1c59135eec596401f3fa823fc9cf182636c5994c97273be20cfdb8), 'block_script')))
     (vendor/twig/twig/src/Template.php:380)
  at Twig\Template->display(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer)), array('body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body')))
     (var/cache/prod/twig/d0/d02cb4e22b8fd7f9aeb06392bd076d03971f7e822331a1bd20b463ad36abb9ee.php:45)
  at __TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af->doDisplay(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer)), array('body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body')))
     (vendor/twig/twig/src/Template.php:407)
  at Twig\Template->displayWithErrorHandling(array('gallery' => array(), 'app' => object(AppVariable), 'container' => object(appProdDebugProjectContainer)), array('body' => array(object(__TwigTemplate_abd4fa005cb2d3aa5c1efaa58b1b3ff6c0fd91ab234705782d0ddd295d7e44af), 'block_body')))
     (vendor/twig/twig/src/Template.php:380)
  at Twig\Template->display(array('gallery' => array()))
     (vendor/twig/twig/src/Template.php:392)
  at Twig\Template->render(array('gallery' => array()))
     (vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php:50)
  at Symfony\Bridge\Twig\TwigEngine->render('GalleryBundle:Default:gallery_view_one.html.twig', array('gallery' => array()))
     (vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php:286)
  at Symfony\Bundle\FrameworkBundle\Controller\Controller->render('GalleryBundle:Default:gallery_view_one.html.twig', array('gallery' => array()))
     (src/GalleryBundle/Controller/DefaultController.php:249)
  at GalleryBundle\Controller\DefaultController->galleryViewOneAction(object(Request), 'feierichne-vidkrittia-vidkrili-porto-franko2018')
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:151)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), 1)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php:68)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), 1, true)
     (vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php:200)
  at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
     (web/app.php:22)