Symfony Exception

RuntimeError

HTTP 500 Internal Server Error

Neither the property "nameFr" nor one of the methods "nameFr()", "getnameFr()"/"isnameFr()"/"hasnameFr()" or "__call()" exist and have public access in class "App\Entity\Product".

Exception

Twig\Error\ RuntimeError

  1.         <a href="{{ url('product_details', {'id': product.id , 'name': product.itemNum|replace({'/': ''})|url_encode}) }}">
  2.             <div>
  3.                 <div class="title">
  4.                     {% if  app.request.locale=='ar' and product.nameAr %}
  5.                         {% set name=  product.nameAr %}
  6.                     {% elseif  app.request.locale=='fr' and product.nameFr %}
  7.                         {% set name=  product.nameFr %}
  8.                     {% else %}
  9.                         {% set name=  product.itemNum %}
  10.                     {% endif %}
  11.                     {#                    {% if name|length > 44 %} #}
  1.             // line 10
  2.             echo "                        ";
  3.             $context["name"] = 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.'10$this->source); })()), "nameAr", [], "any"falsefalsefalse10);
  4.             // line 11
  5.             echo "                    ";
  6.         } elseif (((twig_get_attribute($this->env$this->sourcetwig_get_attribute($this->env$this->source, (isset($context["app"]) || array_key_exists("app"$context) ? $context["app"] : (function () { throw new RuntimeError('Variable "app" does not exist.'11$this->source); })()), "request", [], "any"falsefalsefalse11), "locale", [], "any"falsefalsefalse11) == "fr") && 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.'11$this->source); })()), "nameFr", [], "any"falsefalsefalse11))) {
  7.             // line 12
  8.             echo "                        ";
  9.             $context["name"] = 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.'12$this->source); })()), "nameFr", [], "any"falsefalsefalse12);
  10.             // line 13
  11.             echo "                    ";
in vendor/twig/twig/src/Template.php -> doDisplay (line 394)
  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 367)
  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.             $context['loop']['last'] = === $length;
  2.         }
  3.         foreach ($context['_seq'] as $context["index"] => $context["product"]) {
  4.             // line 17
  5.             echo "            ";
  6.             $this->loadTemplate("component/boxes.html.twig""component/products-slider.html.twig"17)->display(twig_array_merge($context, ["product" => $context["product"]]));
  7.             // line 18
  8.             echo "        ";
  9.             ++$context['loop']['index0'];
  10.             ++$context['loop']['index'];
  11.             $context['loop']['first'] = false;
in vendor/twig/twig/src/Template.php -> doDisplay (line 394)
  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 367)
  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.         <div class=\"container\">
  2.             <div class=\"row\">
  3.                 <div class=\"col-12\">
  4.                     ";
  5.         // line 166
  6.         $this->loadTemplate("component/products-slider.html.twig""website/home.html.twig"166)->display(twig_array_merge($context, ["title" => "Latest Products""products" => (isset($context["latestProducts"]) || array_key_exists("latestProducts"$context) ? $context["latestProducts"] : (function () { throw new RuntimeError('Variable "latestProducts" does not exist.'166$this->source); })())]));
  7.         // line 167
  8.         echo "                </div>
  9.                 <div class=\"col-12\">
  10.                     ";
  11.         // line 169
in vendor/twig/twig/src/Template.php -> block_content (line 171)
  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. </script>
  2. <div id=\"main-content\">
  3.     ";
  4.         // line 311
  5.         $this->displayBlock('content'$context$blocks);
  6.         // line 314
  7.         echo "</div>
  8. <script type=\"text/javascript\">
  9.   \$(document).ready(function () {
in vendor/twig/twig/src/Template.php -> doDisplay (line 394)
  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 367)
  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.         $macros $this->macros;
  2.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f $this->extensions["Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension"];
  3.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->enter($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof = new \Twig\Profiler\Profile($this->getTemplateName(), "template""website/home.html.twig"));
  4.         $this->parent $this->loadTemplate("websiteBase.html.twig""website/home.html.twig"1);
  5.         $this->parent->display($contextarray_merge($this->blocks$blocks));
  6.         
  7.         $__internal_6f47bbe9983af81f1e7450e9a3e3768f->leave($__internal_6f47bbe9983af81f1e7450e9a3e3768f_prof);
  8.     }
in vendor/twig/twig/src/Template.php -> doDisplay (line 394)
  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 367)
  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 379)
  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.     public function render(array $context = []): string
  2.     {
  3.         // using func_get_args() allows to not expose the blocks argument
  4.         // as it should only be used by internal code
  5.         return $this->template->render($context\func_get_args()[1] ?? []);
  6.     }
  7.     public function display(array $context = [])
  8.     {
  9.         // using func_get_args() allows to not expose the blocks argument
  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 = []): string
  5.     {
  6.         return $this->load($name)->render($context);
  7.     }
  8.     /**
  9.      * Displays a template.
  10.      *
  1.     {
  2.         if (!$this->container->has('twig')) {
  3.             throw new \LogicException('You cannot use the "renderView" method if the Twig Bundle is not available. Try running "composer require symfony/twig-bundle".');
  4.         }
  5.         return $this->container->get('twig')->render($view$parameters);
  6.     }
  7.     /**
  8.      * Renders a view.
  9.      */
  1.     /**
  2.      * Renders a view.
  3.      */
  4.     protected function render(string $view, array $parameters = [], Response $response null): Response
  5.     {
  6.         $content $this->renderView($view$parameters);
  7.         if (null === $response) {
  8.             $response = new Response();
  9.         }
AbstractController->render() in src/Controller/HomePageController.php (line 49)
  1.         $sectors $entityManager
  2.             ->getRepository(ZSectors::class)
  3.             ->findBy([], ['id' => 'ASC']);
  4.         return $this->render('website/home.html.twig', ['latestProducts' => $latestProducts'topSelling'     => $topSelling'trending'       => $trending'mostFavored'    => $latestProducts'suppliers'      => $suppliers'services'       => $services'sectors'        => $sectors]);
  5.     }
  6. }
  1.         $this->dispatcher->dispatch($eventKernelEvents::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($eventKernelEvents::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.     }
  1.         $this->request $request;
  2.     }
  3.     public function run(): int
  4.     {
  5.         $response $this->kernel->handle($this->request);
  6.         $response->send();
  7.         if ($this->kernel instanceof TerminableInterface) {
  8.             $this->kernel->terminate($this->request$response);
  9.         }
in vendor/autoload_runtime.php -> run (line 29)
  1. $app $app(...$args);
  2. exit(
  3.     $runtime
  4.         ->getRunner($app)
  5.         ->run()
  6. );
require_once('/var/www/html/website/vendor/autoload_runtime.php') in public/index.php (line 5)
  1. <?php
  2. use App\Kernel;
  3. require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
  4. return fn(array $context) => new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

Logs

No log messages

Stack Trace

RuntimeError
Twig\Error\RuntimeError:
Neither the property "nameFr" nor one of the methods "nameFr()", "getnameFr()"/"isnameFr()"/"hasnameFr()" or "__call()" exist and have public access in class "App\Entity\Product".

  at templates/component/boxes.html.twig:11
  at twig_get_attribute()
     (var/cache/dev/twig/18/18c04afdec5b16ad046f6f309f921ede.php:65)
  at __TwigTemplate_9c620ff5ab761609683b25ac13349ecf->doDisplay()
     (vendor/twig/twig/src/Template.php:394)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:367)
  at Twig\Template->display()
     (var/cache/dev/twig/9d/9dfa59328a816adf7370b35d9ab300fd.php:98)
  at __TwigTemplate_d5ae8f5951530df675414ea7dddca93f->doDisplay()
     (vendor/twig/twig/src/Template.php:394)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:367)
  at Twig\Template->display()
     (var/cache/dev/twig/cb/cbe1c2bb65de2766709eb4079c033769.php:188)
  at __TwigTemplate_41df182bf813414c322cd6b817b85899->block_content()
     (vendor/twig/twig/src/Template.php:171)
  at Twig\Template->displayBlock()
     (var/cache/dev/twig/2e/2e2216f5de7257b3f416d9edf5e9f372.php:484)
  at __TwigTemplate_12c51a56b9208cca46433ec0bc84fca5->doDisplay()
     (vendor/twig/twig/src/Template.php:394)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:367)
  at Twig\Template->display()
     (var/cache/dev/twig/cb/cbe1c2bb65de2766709eb4079c033769.php:46)
  at __TwigTemplate_41df182bf813414c322cd6b817b85899->doDisplay()
     (vendor/twig/twig/src/Template.php:394)
  at Twig\Template->displayWithErrorHandling()
     (vendor/twig/twig/src/Template.php:367)
  at Twig\Template->display()
     (vendor/twig/twig/src/Template.php:379)
  at Twig\Template->render()
     (vendor/twig/twig/src/TemplateWrapper.php:40)
  at Twig\TemplateWrapper->render()
     (vendor/twig/twig/src/Environment.php:277)
  at Twig\Environment->render()
     (vendor/symfony/framework-bundle/Controller/AbstractController.php:222)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->renderView()
     (vendor/symfony/framework-bundle/Controller/AbstractController.php:230)
  at Symfony\Bundle\FrameworkBundle\Controller\AbstractController->render()
     (src/Controller/HomePageController.php:49)
  at App\Controller\HomePageController->HomePage()
     (vendor/symfony/http-kernel/HttpKernel.php:153)
  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()
     (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (vendor/autoload_runtime.php:29)
  at require_once('/var/www/html/website/vendor/autoload_runtime.php')
     (public/index.php:5)