Giter Club home page Giter Club logo

Comments (16)

haivala avatar haivala commented on July 18, 2024 1

You must install symfony/runtime and makes changes to your index.php according to it: https://symfony.com/doc/current/components/runtime.html
after that the page runtime has to be defined in your composer.json.

from sonatapagebundle.

eerison avatar eerison commented on July 18, 2024 1

I was only temporary error. After updating snapshot it works. But it should be in documentation.

<?php

use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return static function (): Kernel {
    if ($_SERVER['APP_DEBUG']) {
        umask(0000);

        Debug::enable();
    }
    if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
        Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
    }

    if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
        Request::setTrustedHosts([$trustedHosts]);
    }
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

I don't get it. Updating snapshot is not related to the runtime, it's a regular process of page if you change something with the paths. Of course if you go from one type to another it should be a part of your migration to update snapshots not related to this specific file. @eerison ?

Well it is a comment from @mesiarm, I guess there is some miss understanding here.

it wasn't provided an issue with steps to reproduce. and yeah snapshot isn't related with runtime, I suspect it was just some cache that should be clean up.

and why I am saying it isn't related with sonata? because his old and current solution just uses symfony's code, nothing from sonata.

the steps provided to reproduce are not reproducible for others, because you and @haivala migrated to symfony runtime and none of you faced this issue.

if it contains issue: it MUST have clear steps what need to do, otherwise it won't be fixed!

from sonatapagebundle.

mesiarm avatar mesiarm commented on July 18, 2024

I installed symfony/runtime and set SonataPagePathRuntime extra. I updated index.php

<?php

use App\Kernel;

require_once dirname(__DIR__).'/private/vendor/autoload_runtime.php';

return static function (): Kernel {
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

It works, but when calling function to get sonata page by alias in controller I got error. It worked before:

$eventsPage = $cmsManagerSelector->retrieve()->getPageByPageAlias($siteSelector->retrieve(), '_page_alias_events');

Sonata\PageBundle\Exception\PageNotFoundException:

  at D:\*****\******\******\sonata\private\vendor\sonata-project\page-bundle\src\CmsManager\CmsSnapshotManager.php:131
  at Sonata\PageBundle\CmsManager\CmsSnapshotManager->getPageBy(object(SonataPageSite), 'pageAlias', '_page_alias_events')
     (D:\*****\******\******\sonata\private\vendor\sonata-project\page-bundle\src\CmsManager\BaseCmsPageManager.php:59)
  at Sonata\PageBundle\CmsManager\BaseCmsPageManager->getPageByPageAlias(object(SonataPageSite), '_page_alias_events')
     (D:\*****\******\******\sonata\private\src\Controller\EventController.php:81)
  at App\Controller\EventController->smallList(object(EntityManager), object(Paginator), object(VariableManager), object(HostPathSiteSelector), object(CmsManagerSelector), null)
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(SiteRequest), 2)
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(SiteRequest), 2, false)
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\HttpCache\SubRequestHandler.php:86)
  at Symfony\Component\HttpKernel\HttpCache\SubRequestHandler::handle(object(HttpKernel), object(SiteRequest), 2, false)
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\Fragment\InlineFragmentRenderer.php:80)
  at Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer->render('/_fragment?_path=_format%3Dhtml%26_locale%3Dcs%26_controller%3DApp%255CController%255CEventController%253A%253AsmallList', object(SiteRequest), array('ignore_errors' => false))
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\Fragment\FragmentHandler.php:85)
  at Symfony\Component\HttpKernel\Fragment\FragmentHandler->render(object(ControllerReference), 'inline', array('ignore_errors' => false))
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\DependencyInjection\LazyLoadingFragmentHandler.php:49)
  at Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler->render(object(ControllerReference), 'inline', array())
     (D:\*****\******\******\sonata\private\vendor\symfony\twig-bridge\Extension\HttpKernelRuntime.php:46)
  at Symfony\Bridge\Twig\Extension\HttpKernelRuntime->renderFragment(object(ControllerReference))
     (D:\*****\******\******\sonata\private\var\cache\dev\twig\53\5343da88602cf24fa51c1032dd51e838.php:115)
  at __TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5->block_content(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_html_tag' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:171)
  at Twig\Template->displayBlock('content', array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_html_tag' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\var\cache\dev\twig\5e\5eae2e4addd979f66667049cc9aba40b.php:428)
  at __TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b->block_sonata_page_container(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_html_tag' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:171)
  at Twig\Template->displayBlock('sonata_page_container', array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_html_tag' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\var\cache\dev\twig\2f\2f51c9c7a027ea3c858425370257e695.php:69)
  at __TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b->doDisplay(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_html_tag' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:394)
  at Twig\Template->displayWithErrorHandling(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_html_tag' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_html_tag'), 'sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_stylesheets' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_stylesheets'), 'sonata_page_javascripts' => array(object(__TwigTemplate_05fa6aa65c86f62ee1262f52b77bab3b), 'block_sonata_page_javascripts'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:367)
  at Twig\Template->display(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer')))
     (D:\*****\******\******\sonata\private\var\cache\dev\twig\5e\5eae2e4addd979f66667049cc9aba40b.php:53)
  at __TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b->doDisplay(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer')))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:394)
  at Twig\Template->displayWithErrorHandling(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('sonata_page_head' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_head'), 'sonata_page_body_tag' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_body_tag'), 'sonata_page_top_bar' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_top_bar'), 'sonata_page_container' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_container'), 'content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content'), 'sonata_page_asset_footer' => array(object(__TwigTemplate_b5a2472c62cae0c42fe8688dd5f2ad9b), 'block_sonata_page_asset_footer')))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:367)
  at Twig\Template->display(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\var\cache\dev\twig\53\5343da88602cf24fa51c1032dd51e838.php:48)
  at __TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5->doDisplay(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:394)
  at Twig\Template->displayWithErrorHandling(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite), 'wrap_fields_with_addons' => true, 'app' => object(AppVariable), 'settings' => object(VariableManager), 'sonata_block' => object(GlobalVariables), 'sonata_config' => object(SonataConfiguration), 'sonata_page' => object(GlobalVariables), 'sonata_page_admin' => object(PageAdmin), 'sonata_user' => object(GlobalVariables), 'sonata_media' => object(GlobalVariables), 'sonata_translation_locales' => array('cs')), array('content' => array(object(__TwigTemplate_b6f6bd103a65a778184b78a5001e8ad5), 'block_content')))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:367)
  at Twig\Template->display(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Template.php:379)
  at Twig\Template->render(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\TemplateWrapper.php:38)
  at Twig\TemplateWrapper->render(array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)))
     (D:\*****\******\******\sonata\private\vendor\twig\twig\src\Environment.php:280)
  at Twig\Environment->render('@SonataPage/homepage_layout.html.twig', array('error_codes' => array('_page_internal_error_not_found', '_page_internal_error_fatal'), 'page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)))
     (D:\*****\******\******\sonata\private\vendor\sonata-project\page-bundle\src\Page\TemplateManager.php:90)
  at Sonata\PageBundle\Page\TemplateManager->renderResponse('homepage', array('page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)), object(Response))
     (D:\*****\******\******\sonata\private\vendor\sonata-project\page-bundle\src\Page\Service\DefaultPageService.php:49)
  at Sonata\PageBundle\Page\Service\DefaultPageService->execute(object(SnapshotPageProxy), object(SiteRequest), array('page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)), object(Response))
     (D:\*****\******\******\sonata\private\vendor\sonata-project\page-bundle\src\Page\PageServiceManager.php:83)
  at Sonata\PageBundle\Page\PageServiceManager->execute(object(SnapshotPageProxy), object(SiteRequest), array('page' => object(SnapshotPageProxy), 'site' => object(SonataPageSite)), object(Response))
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\HttpKernel.php:163)
  at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(SiteRequest), 1)
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\HttpKernel.php:75)
  at Symfony\Component\HttpKernel\HttpKernel->handle(object(SiteRequest), 1, true)
     (D:\*****\******\******\sonata\private\vendor\symfony\http-kernel\Kernel.php:202)
  at Symfony\Component\HttpKernel\Kernel->handle(object(SiteRequest))
     (D:\*****\******\******\sonata\private\vendor\symfony\runtime\Runner\Symfony\HttpKernelRunner.php:35)
  at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run()
     (D:\*****\******\******\sonata\private\vendor\autoload_runtime.php:35)
  at require_once('D:\\projekty\\wisdomfactory\\chopos\\sonata\\private\\vendor\\autoload_runtime.php')
     (D:\*****\******\******\sonata\web\index.php:5) 

from sonatapagebundle.

mesiarm avatar mesiarm commented on July 18, 2024

I was only temporary error. After updating snapshot it works. But it should be in documentation.

<?php

use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return static function (): Kernel {
    if ($_SERVER['APP_DEBUG']) {
        umask(0000);

        Debug::enable();
    }
    if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
        Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
    }

    if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
        Request::setTrustedHosts([$trustedHosts]);
    }
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

from sonatapagebundle.

eerison avatar eerison commented on July 18, 2024

I was only temporary error. After updating snapshot it works. But it should be in documentation.

<?php

use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return static function (): Kernel {
    if ($_SERVER['APP_DEBUG']) {
        umask(0000);

        Debug::enable();
    }
    if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
        Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
    }

    if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
        Request::setTrustedHosts([$trustedHosts]);
    }
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

I guess we could close this issue.

from sonatapagebundle.

mesiarm avatar mesiarm commented on July 18, 2024

Yes but it should be documented.

from sonatapagebundle.

eerison avatar eerison commented on July 18, 2024

Yes but it should be documented.

What should be documented? I don't get it

I was only temporary error. After updating snapshot it works.

do you mean after update your snapshot, it backs to work? if yes maybe it was just cache?

from sonatapagebundle.

mesiarm avatar mesiarm commented on July 18, 2024

https://docs.sonata-project.org/projects/SonataPageBundle/en/5.x/reference/multisite/ - documentation doesn´t contain information about runtime what @haivala mentioned and how index.php should look like.

from sonatapagebundle.

eerison avatar eerison commented on July 18, 2024

https://docs.sonata-project.org/projects/SonataPageBundle/en/5.x/reference/multisite/ - documentation doesn´t contain information about runtime what @haivala mentioned and how index.php should look like.

But you don't need to change anything on index.php file, do you?

from sonatapagebundle.

mesiarm avatar mesiarm commented on July 18, 2024

this works for me (simillar to - https://symfony.com/doc/current/components/runtime.html)

<?php

use App\Kernel;

require_once dirname(__DIR__).'/private/vendor/autoload_runtime.php';

return static function (): Kernel {
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

or this is extended version according previous versions of documentation also works: https://docs.sonata-project.org/projects/SonataPageBundle/en/3.x/reference/multisite/

<?php

use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

require_once dirname(__DIR__).'/private/vendor/autoload_runtime.php';

return static function (): Kernel {
    if ($_SERVER['APP_DEBUG']) {
        umask(0000);

        Debug::enable();
    }
    if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
        Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
    }

    if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
        Request::setTrustedHosts([$trustedHosts]);
    }
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

from sonatapagebundle.

eerison avatar eerison commented on July 18, 2024

this works for me (simillar to - https://symfony.com/doc/current/components/runtime.html)

<?php

use App\Kernel;

require_once dirname(__DIR__).'/private/vendor/autoload_runtime.php';

return static function (): Kernel {
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

or this is extended version according previous versions of documentation also works: https://docs.sonata-project.org/projects/SonataPageBundle/en/3.x/reference/multisite/

<?php

use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

require_once dirname(__DIR__).'/private/vendor/autoload_runtime.php';

return static function (): Kernel {
    if ($_SERVER['APP_DEBUG']) {
        umask(0000);

        Debug::enable();
    }
    if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
        Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
    }

    if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
        Request::setTrustedHosts([$trustedHosts]);
    }
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

IMO those changes are not related with sonata, what symfony's version are you using? and did you update your symfony kernel recipe, via composer recipe ...? it will bring how the new file should be.

from sonatapagebundle.

eerison avatar eerison commented on July 18, 2024
    if ($_SERVER['APP_DEBUG']) {
        umask(0000);

        Debug::enable();
    }
    if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
        Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
    }

    if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
        Request::setTrustedHosts([$trustedHosts]);
    }

if you remove this, and clear your cache, what error are you seeing?

edit 1: My index.php is exctly like this

<?php

use App\Kernel;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
    return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};

and it works without any issue.

Edit 2: I don't know how is your config, but I didn't have this private folder before vendor

from sonatapagebundle.

eerison avatar eerison commented on July 18, 2024

in you description

the doc doesn't not say to you use Sonata\PageBundle\Runtime\SonataPagePathRuntime::createFromGlobals() or any other class.

maybe you could open a PR adding a note in UPGRADE.md

Edit 1: well if you use Runtime, in theory you should see the docs, and see that there aren't anything saying to add stuffs in your index.php file, then you should remove sonata things from there.

Edit 2: as I said above, my index.php file looks really simple, and without your changes, and I didn't have any issue with this.

from sonatapagebundle.

GeraudBourdin avatar GeraudBourdin commented on July 18, 2024

I was only temporary error. After updating snapshot it works. But it should be in documentation.

<?php

use App\Kernel;
use Symfony\Component\ErrorHandler\Debug;
use Symfony\Component\HttpFoundation\Request;

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return static function (): Kernel {
    if ($_SERVER['APP_DEBUG']) {
        umask(0000);

        Debug::enable();
    }
    if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
        Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO);
    }

    if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
        Request::setTrustedHosts([$trustedHosts]);
    }
    return new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
};

I don't get it. Updating snapshot is not related to the runtime, it's a regular process of page if you change something with the paths. Of course if you go from one type to another it should be a part of your migration to update snapshots not related to this specific file. @eerison ?

from sonatapagebundle.

GeraudBourdin avatar GeraudBourdin commented on July 18, 2024

if it contains issue: it MUST have clear steps what need to do, otherwise it won't be fixed!

Thanks for the hint.

from sonatapagebundle.

VincentLanglet avatar VincentLanglet commented on July 18, 2024

I dunno why the doc linked is about 3.x

https://docs.sonata-project.org/projects/SonataPageBundle/en/4.x/reference/multisite/
should be used instead.

from sonatapagebundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.